-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
b4502ac
commit a825e9d
Showing
10 changed files
with
450 additions
and
99 deletions.
There are no files selected for viewing
177 changes: 177 additions & 0 deletions
177
crates/analysis/src/symbol_analysis/symbols/annotated_symbols.rs
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,177 @@ | ||
use shrinkwraprs::Shrinkwrap; | ||
use crate::symbol_analysis::symbol_path::SymbolPath; | ||
use super::*; | ||
|
||
|
||
/// Corresponding to @addMethod(Class) functions | ||
#[derive(Debug, Clone, Shrinkwrap)] | ||
#[shrinkwrap(mutable)] | ||
pub struct AddedMemberFunctionSymbol { | ||
pub inner: MemberFunctionSymbol | ||
} | ||
|
||
impl Symbol for AddedMemberFunctionSymbol { | ||
fn typ(&self) -> SymbolType { | ||
SymbolType::AddedMemberFunction | ||
} | ||
|
||
fn path(&self) -> &SymbolPath { | ||
&self.inner.path() | ||
} | ||
} | ||
|
||
impl LocatableSymbol for AddedMemberFunctionSymbol { | ||
fn location(&self) -> &SymbolLocation { | ||
&self.inner.location() | ||
} | ||
} | ||
|
||
impl PrimarySymbol for AddedMemberFunctionSymbol { } | ||
|
||
impl AddedMemberFunctionSymbol { | ||
pub fn new(path: MemberCallableSymbolPath, location: SymbolLocation) -> Self { | ||
Self { | ||
inner: MemberFunctionSymbol::new(path, location) | ||
} | ||
} | ||
} | ||
|
||
|
||
|
||
/// Corresponding to @replaceMethod(Class) functions | ||
#[derive(Debug, Clone, Shrinkwrap)] | ||
#[shrinkwrap(mutable)] | ||
pub struct ReplacedMemberFunctionSymbol { | ||
pub inner: MemberFunctionSymbol | ||
} | ||
|
||
impl Symbol for ReplacedMemberFunctionSymbol { | ||
fn typ(&self) -> SymbolType { | ||
SymbolType::ReplacedMemberFunction | ||
} | ||
|
||
fn path(&self) -> &SymbolPath { | ||
&self.inner.path() | ||
} | ||
} | ||
|
||
impl LocatableSymbol for ReplacedMemberFunctionSymbol { | ||
fn location(&self) -> &SymbolLocation { | ||
&self.inner.location() | ||
} | ||
} | ||
|
||
impl PrimarySymbol for ReplacedMemberFunctionSymbol { } | ||
|
||
impl ReplacedMemberFunctionSymbol { | ||
pub fn new(path: MemberCallableSymbolPath, location: SymbolLocation) -> Self { | ||
Self { | ||
inner: MemberFunctionSymbol::new(path, location) | ||
} | ||
} | ||
} | ||
|
||
|
||
|
||
/// Corresponding to @replaceMethod functions | ||
#[derive(Debug, Clone, Shrinkwrap)] | ||
#[shrinkwrap(mutable)] | ||
pub struct ReplacedGlobalFunctionSymbol { | ||
pub inner: GlobalFunctionSymbol | ||
} | ||
|
||
impl Symbol for ReplacedGlobalFunctionSymbol { | ||
fn typ(&self) -> SymbolType { | ||
SymbolType::ReplacedGlobalFunction | ||
} | ||
|
||
fn path(&self) -> &SymbolPath { | ||
&self.inner.path() | ||
} | ||
} | ||
|
||
impl LocatableSymbol for ReplacedGlobalFunctionSymbol { | ||
fn location(&self) -> &SymbolLocation { | ||
&self.inner.location() | ||
} | ||
} | ||
|
||
impl PrimarySymbol for ReplacedGlobalFunctionSymbol { } | ||
|
||
impl ReplacedGlobalFunctionSymbol { | ||
pub fn new(path: GlobalCallableSymbolPath, location: SymbolLocation) -> Self { | ||
Self { | ||
inner: GlobalFunctionSymbol::new(path, location) | ||
} | ||
} | ||
} | ||
|
||
|
||
|
||
/// Corresponding to @wrapMethod(Class) functions | ||
#[derive(Debug, Clone, Shrinkwrap)] | ||
#[shrinkwrap(mutable)] | ||
pub struct WrappedMemberFunctionSymbol { | ||
pub inner: MemberFunctionSymbol | ||
} | ||
|
||
impl Symbol for WrappedMemberFunctionSymbol { | ||
fn typ(&self) -> SymbolType { | ||
SymbolType::WrappedMemberFunction | ||
} | ||
|
||
fn path(&self) -> &SymbolPath { | ||
&self.inner.path() | ||
} | ||
} | ||
|
||
impl LocatableSymbol for WrappedMemberFunctionSymbol { | ||
fn location(&self) -> &SymbolLocation { | ||
&self.inner.location() | ||
} | ||
} | ||
|
||
impl PrimarySymbol for WrappedMemberFunctionSymbol { } | ||
|
||
impl WrappedMemberFunctionSymbol { | ||
pub fn new(path: MemberCallableSymbolPath, location: SymbolLocation) -> Self { | ||
Self { | ||
inner: MemberFunctionSymbol::new(path, location) | ||
} | ||
} | ||
} | ||
|
||
|
||
|
||
/// Corresponding to @addField(Class) vars | ||
#[derive(Debug, Clone, Shrinkwrap)] | ||
#[shrinkwrap(mutable)] | ||
pub struct AddedMemberVarSymbol { | ||
pub inner: MemberVarSymbol | ||
} | ||
|
||
impl Symbol for AddedMemberVarSymbol { | ||
fn typ(&self) -> SymbolType { | ||
SymbolType::AddedMemberVar | ||
} | ||
|
||
fn path(&self) -> &SymbolPath { | ||
&self.inner.path() | ||
} | ||
} | ||
|
||
impl LocatableSymbol for AddedMemberVarSymbol { | ||
fn location(&self) -> &SymbolLocation { | ||
&self.inner.location() | ||
} | ||
} | ||
|
||
impl PrimarySymbol for AddedMemberVarSymbol { } | ||
|
||
impl AddedMemberVarSymbol { | ||
pub fn new(path: MemberDataSymbolPath, location: SymbolLocation) -> Self { | ||
Self { | ||
inner: MemberVarSymbol::new(path, location) | ||
} | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.