Appearance
| 1 | namespace Semantic is | |
| 2 | use IO.Std; | |
| 3 | ||
| 4 | use System.Text.StringBuilder; | |
| 5 | ||
| 6 | use IoC; | |
| 7 | use Logging; | |
| 8 | use Source; | |
| 9 | ||
| 10 | use Types.Type; | |
| 11 | use Symbols.Symbol; | |
| 12 | ||
| 13 | trait Scope is | |
| 14 | name: string; | |
| 15 | qualified_name: string; | |
| 16 | ||
| 17 | symbols: Collections.Iterable[Symbols.Symbol]; | |
| 18 | ||
| 19 | type: Type?; | |
| 20 | ||
| 21 | unspecialized_symbol: Symbols.Symbol?; | |
| 22 | ||
| 23 | // Where this scope stands in for another symbol's scope - an impl | |
| 24 | // or partial block, which declares members into a target type but | |
| 25 | // resolves names at its own write site - the symbol scope it | |
| 26 | // stands in for; self otherwise. Consumers that interpret a scope | |
| 27 | // as a symbol (instance context, declaration context, the symbol | |
| 28 | // associated with a definition node) must look through this. | |
| 29 | underlying_scope: Scope => self; | |
| 30 | ||
| 31 | is_trait: bool => false; | |
| 32 | is_classy: bool => false; | |
| 33 | is_closure: bool => false; | |
| 34 | is_union: bool => false; | |
| 35 | is_variant: bool => false; | |
| 36 | is_closed_root: bool => false; | |
| 37 | is_unit_variant: bool => false; | |
| 38 | is_capture_context: bool => false; | |
| 39 | is_instance_context: bool => false; | |
| 40 | is_namespace: bool => false; | |
| 41 | ||
| 42 | qualify(name: string) -> string; | |
| 43 | find_direct(name: string) -> Symbols.Symbol?; | |
| 44 | find_member(name: string) -> Symbols.Symbol?; | |
| 45 | find_enclosing(name: string) -> Symbols.Symbol?; | |
| 46 | ||
| 47 | find_direct_matches(prefix: string, matches: Collections.MutableMap[string,Symbols.Symbol]); | |
| 48 | find_member_matches(prefix: string, matches: Collections.MutableMap[string,Symbols.Symbol]); | |
| 49 | find_enclosing_matches(prefix: string, matches: Collections.MutableMap[string,Symbols.Symbol]); | |
| 50 | ||
| 51 | gen_dotted_name(buffer: System.Text.StringBuilder, qualifying: Scope); | |
| 52 | gen_dot(buffer: System.Text.StringBuilder); | |
| 53 | ||
| 54 | gen_reference(buffer: StringBuilder); | |
| 55 | gen_type(buffer: StringBuilder); | |
| 56 | si | |
| 57 | ||
| 58 | trait DeclarationContext is | |
| 59 | declare_class(location: LOCATION, span: LOCATION, name: string, arguments: Collections.List[string], enclosing: Scope, symbol_definition_listener: SymbolDefinitionListener?) -> Symbol; | |
| 60 | declare_trait(location: LOCATION, span: LOCATION, name: string, arguments: Collections.List[string], enclosing: Scope, symbol_definition_listener: SymbolDefinitionListener?) -> Symbol; | |
| 61 | declare_struct(location: LOCATION, span: LOCATION, name: string, arguments: Collections.List[string], enclosing: Scope, symbol_definition_listener: SymbolDefinitionListener?) -> Symbol; | |
| 62 | declare_union(location: LOCATION, span: LOCATION, name: string, arguments: Collections.List[string], enclosing: Scope, symbol_definition_listener: SymbolDefinitionListener?) -> Symbol; | |
| 63 | declare_variant(location: LOCATION, span: LOCATION, name: string, enclosing: Scope, symbol_definition_listener: SymbolDefinitionListener?) -> Symbol; | |
| 64 | declare_type(location: LOCATION, name: string, index: int, symbol_definition_listener: SymbolDefinitionListener?) -> Symbol; | |
| 65 | declare_enum(location: LOCATION, span: LOCATION, name: string, enclosing: Scope, symbol_definition_listener: SymbolDefinitionListener?) -> Symbol; | |
| 66 | declare_enum_member(location: LOCATION, name: string, value: string?, symbol_definition_listener: SymbolDefinitionListener?); | |
| 67 | declare_closure(location: LOCATION, name: string, owner: Scope, enclosing: Scope, is_recursive: bool, symbol_definition_listener: SymbolDefinitionListener?) -> Symbol; | |
| 68 | declare_async_closure(location: LOCATION, name: string, owner: Scope, enclosing: Scope, is_recursive: bool, symbol_definition_listener: SymbolDefinitionListener?) -> Symbol; | |
| 69 | declare_innate(location: LOCATION, name: string, innate_name: string, enclosing: Scope, symbol_definition_listener: SymbolDefinitionListener?) -> Symbol; | |
| 70 | ||
| 71 | declare_function(location: LOCATION, span: LOCATION, name: string, is_static: bool, is_private: bool, has_body: bool, enclosing: Scope, symbol_definition_listener: SymbolDefinitionListener?) -> Symbol; | |
| 72 | declare_generator_function(location: LOCATION, span: LOCATION, name: string, is_static: bool, is_private: bool, has_body: bool, enclosing: Scope, symbol_definition_listener: SymbolDefinitionListener?) -> Symbol; | |
| 73 | declare_async_function(location: LOCATION, span: LOCATION, name: string, is_static: bool, is_private: bool, has_body: bool, enclosing: Scope, symbol_definition_listener: SymbolDefinitionListener?) -> Symbol; | |
| 74 | declare_variable(location: LOCATION, name: string, is_static: bool, symbol_definition_listener: SymbolDefinitionListener?) -> Symbol; | |
| 75 | declare_property(location: LOCATION, span: LOCATION, name: string, is_static: bool, is_private: bool, is_assignable: bool, symbol_definition_listener: SymbolDefinitionListener?) -> Symbol; | |
| 76 | declare_label(location: LOCATION, name: string, symbol_definition_listener: SymbolDefinitionListener?); | |
| 77 | si | |
| 78 | ||
| 79 | trait NamespaceContext is | |
| 80 | declare_namespace(location: LOCATION, name: string, `namespace: Symbols.NAMESPACE, symbol_definition_listener: SymbolDefinitionListener?); | |
| 81 | si | |
| 82 | ||
| 83 | trait ClosureContext is | |
| 84 | add_closure(closure: Symbols.Closure); | |
| 85 | ||
| 86 | get_closures() -> Collections.Iterable[Symbols.Closure]; | |
| 87 | si | |
| 88 | ||
| 89 | si |