pub struct Semantic {Show 13 fields
pub symtab: Vec<(u32, SymbolData)>,
pub typetab: Vec<(u32, TypeData)>,
pub sym2type: Vec<(u32, u32)>,
pub node2sym: Vec<(NodeReference, u32)>,
pub node2type: Vec<(NodeReference, u32)>,
pub node_flags: Vec<(NodeReference, u32)>,
pub type_extra: TypeExtra,
pub primtypes: PrimTypes,
pub alias_symbols: Vec<(u32, u32)>,
pub shorthand_symbols: Vec<(NodeReference, u32)>,
pub shorthand_binding_symbols: Vec<(u32, u32)>,
pub parameter_property_symbols: Vec<(NodeReference, u32)>,
pub external_symbols: Vec<ExternalSymbol>,
}Fields§
§symtab: Vec<(u32, SymbolData)>§typetab: Vec<(u32, TypeData)>§sym2type: Vec<(u32, u32)>§node2sym: Vec<(NodeReference, u32)>§node2type: Vec<(NodeReference, u32)>§node_flags: Vec<(NodeReference, u32)>§type_extra: TypeExtra§primtypes: PrimTypes§alias_symbols: Vec<(u32, u32)>§shorthand_symbols: Vec<(NodeReference, u32)>§shorthand_binding_symbols: Vec<(u32, u32)>§parameter_property_symbols: Vec<(NodeReference, u32)>§external_symbols: Vec<ExternalSymbol>Implementations§
Source§impl Semantic
impl Semantic
Sourcepub fn get_shorthand_assignment_value_symbol(
&self,
location: &NodeReference,
) -> Option<u32>
pub fn get_shorthand_assignment_value_symbol( &self, location: &NodeReference, ) -> Option<u32>
Returns the value (local variable) symbol of an identifier in the shorthand property assignment.
This is necessary as an identifier in shorthand property assignment contains two meanings:
property name and property value. For example, in { x }, x is both the property name
and references the variable value.
§Arguments
location- The node reference to query
§Returns
Some(u32)- The symbol ID if found and has Value or Alias flagsNone- If no symbol is found or the symbol doesn’t have the required flags
§Reference
TypeScript implementation: https://github.com/microsoft/TypeScript/blob/9e8eaa1746b0d09c3cd29048126ef9cf24f29c03/src/compiler/checker.ts
Sourcepub fn get_shorthand_binding_property_symbol(
&self,
local_symbol: u32,
) -> Option<u32>
pub fn get_shorthand_binding_property_symbol( &self, local_symbol: u32, ) -> Option<u32>
Returns the source property symbol of a shorthand object binding name.
In const { x } = value, this maps the newly declared local x symbol
to the property symbol equivalent to x in value.x.
Sourcepub fn get_parameter_property_symbol(
&self,
location: &NodeReference,
) -> Option<u32>
pub fn get_parameter_property_symbol( &self, location: &NodeReference, ) -> Option<u32>
Returns the extra symbol declared by a parameter property name.
TypeScript parameter properties such as constructor(private x: string) declare two
symbols at the same source location. The primary symbol remains in node2sym; this
method returns the other one.