Remove scope table usage.
This commit is contained in:
parent
65136c3a1c
commit
d32580a1d4
@ -1,15 +1,15 @@
|
|||||||
|
/// The gather phase must exclusively gather all named items that can be used elsewhere.
|
||||||
use crate::ast::ast_node::{AstNode, AstNodeRef};
|
use crate::ast::ast_node::{AstNode, AstNodeRef};
|
||||||
use crate::ast::node::{
|
use crate::ast::node::{
|
||||||
Class, Closure, ClosureParameter, CompilationUnit, ForStatement, FullyQualifiedName, Function,
|
Class, Closure, ClosureParameter, CompilationUnit, ForStatement, Function, FunctionBody,
|
||||||
FunctionBody, GenericParameters, Identifier, IfClause, Interface, InterfaceDefaultFunction,
|
GenericParameters, Identifier, IfClause, Interface, InterfaceDefaultFunction,
|
||||||
InterfaceDefaultOperatorFunction, InterfaceFunction, InterfaceOperatorFunction, Member, Module,
|
InterfaceDefaultOperatorFunction, InterfaceFunction, InterfaceOperatorFunction, Member, Module,
|
||||||
Namespace, OperatorFunction, Parameter, PlatformFunction, PlatformOperatorFunction,
|
Namespace, OperatorFunction, Parameter, PlatformFunction, PlatformOperatorFunction,
|
||||||
PrimitiveType, TernaryExpression, UseStatement, UseStatementSuffix, VariableDeclaration,
|
TernaryExpression, UseStatement, UseStatementSuffix, VariableDeclaration, VariableUse,
|
||||||
VariableUse, WhileStatement,
|
WhileStatement,
|
||||||
};
|
};
|
||||||
use crate::diagnostic::DmDiagnostic;
|
use crate::diagnostic::DmDiagnostic;
|
||||||
use crate::name_analysis::fqn_context::FqnContext;
|
use crate::name_analysis::fqn_context::FqnContext;
|
||||||
use crate::name_analysis::scope_table::ScopeTable;
|
|
||||||
use crate::name_analysis::symbol::class_member_symbol::ClassMemberSymbol;
|
use crate::name_analysis::symbol::class_member_symbol::ClassMemberSymbol;
|
||||||
use crate::name_analysis::symbol::function_symbol::FunctionSymbol;
|
use crate::name_analysis::symbol::function_symbol::FunctionSymbol;
|
||||||
use crate::name_analysis::symbol::module_symbol::ModuleSymbol;
|
use crate::name_analysis::symbol::module_symbol::ModuleSymbol;
|
||||||
@ -24,6 +24,7 @@ use crate::name_analysis::symbol_table::{SymbolInsertError, SymbolLookupError, S
|
|||||||
use codespan_reporting::diagnostic::{Diagnostic, Label};
|
use codespan_reporting::diagnostic::{Diagnostic, Label};
|
||||||
use std::range::Range;
|
use std::range::Range;
|
||||||
|
|
||||||
|
|
||||||
fn handle_insert_error(
|
fn handle_insert_error(
|
||||||
err: SymbolInsertError,
|
err: SymbolInsertError,
|
||||||
error_symbol_name: &str,
|
error_symbol_name: &str,
|
||||||
@ -83,11 +84,10 @@ fn gather_node_children<'a>(
|
|||||||
node: &'a dyn AstNode<'a>,
|
node: &'a dyn AstNode<'a>,
|
||||||
symbol_table: &mut SymbolTable,
|
symbol_table: &mut SymbolTable,
|
||||||
fqn_context: &mut FqnContext,
|
fqn_context: &mut FqnContext,
|
||||||
scope_table: &mut ScopeTable<'a>,
|
|
||||||
diagnostics: &mut Vec<DmDiagnostic>,
|
diagnostics: &mut Vec<DmDiagnostic>,
|
||||||
) {
|
) {
|
||||||
for child in node.children() {
|
for child in node.children() {
|
||||||
gather_node(child, symbol_table, fqn_context, scope_table, diagnostics);
|
gather_node(child, symbol_table, fqn_context, diagnostics);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -95,22 +95,9 @@ fn gather_node<'a>(
|
|||||||
node: &'a dyn AstNode<'a>,
|
node: &'a dyn AstNode<'a>,
|
||||||
symbol_table: &mut SymbolTable,
|
symbol_table: &mut SymbolTable,
|
||||||
fqn_context: &mut FqnContext,
|
fqn_context: &mut FqnContext,
|
||||||
scope_table: &mut ScopeTable<'a>,
|
|
||||||
diagnostics: &mut Vec<DmDiagnostic>,
|
diagnostics: &mut Vec<DmDiagnostic>,
|
||||||
) {
|
) {
|
||||||
match node.as_node_ref() {
|
match node.as_node_ref() {
|
||||||
AstNodeRef::FullyQualifiedName(fully_qualified_name) => {
|
|
||||||
gather_fully_qualified_name(fully_qualified_name, symbol_table, scope_table);
|
|
||||||
}
|
|
||||||
AstNodeRef::PrimitiveType(primitive_type) => {
|
|
||||||
gather_primitive_type(
|
|
||||||
primitive_type,
|
|
||||||
symbol_table,
|
|
||||||
fqn_context,
|
|
||||||
scope_table,
|
|
||||||
diagnostics,
|
|
||||||
);
|
|
||||||
}
|
|
||||||
AstNodeRef::GenericParameters(generic_parameters) => {
|
AstNodeRef::GenericParameters(generic_parameters) => {
|
||||||
gather_generic_parameters(generic_parameters, symbol_table, diagnostics);
|
gather_generic_parameters(generic_parameters, symbol_table, diagnostics);
|
||||||
}
|
}
|
||||||
@ -124,71 +111,39 @@ fn gather_node<'a>(
|
|||||||
gather_use_statement(use_statement, symbol_table, diagnostics);
|
gather_use_statement(use_statement, symbol_table, diagnostics);
|
||||||
}
|
}
|
||||||
AstNodeRef::Module(module) => {
|
AstNodeRef::Module(module) => {
|
||||||
gather_module(module, symbol_table, fqn_context, scope_table, diagnostics);
|
gather_module(module, symbol_table, fqn_context, diagnostics);
|
||||||
}
|
}
|
||||||
AstNodeRef::Interface(interface) => {
|
AstNodeRef::Interface(interface) => {
|
||||||
gather_interface(
|
gather_interface(interface, symbol_table, fqn_context, diagnostics);
|
||||||
interface,
|
|
||||||
symbol_table,
|
|
||||||
fqn_context,
|
|
||||||
scope_table,
|
|
||||||
diagnostics,
|
|
||||||
);
|
|
||||||
}
|
}
|
||||||
AstNodeRef::Class(class) => {
|
AstNodeRef::Class(class) => {
|
||||||
gather_class(class, symbol_table, fqn_context, scope_table, diagnostics);
|
gather_class(class, symbol_table, fqn_context, diagnostics);
|
||||||
}
|
}
|
||||||
AstNodeRef::Function(function) => {
|
AstNodeRef::Function(function) => {
|
||||||
gather_function(
|
gather_function(function, symbol_table, fqn_context, diagnostics);
|
||||||
function,
|
|
||||||
symbol_table,
|
|
||||||
fqn_context,
|
|
||||||
scope_table,
|
|
||||||
diagnostics,
|
|
||||||
);
|
|
||||||
}
|
}
|
||||||
AstNodeRef::OperatorFunction(operator_function) => {
|
AstNodeRef::OperatorFunction(operator_function) => {
|
||||||
gather_operator_function(
|
gather_operator_function(operator_function, symbol_table, fqn_context, diagnostics);
|
||||||
operator_function,
|
|
||||||
symbol_table,
|
|
||||||
fqn_context,
|
|
||||||
scope_table,
|
|
||||||
diagnostics,
|
|
||||||
);
|
|
||||||
}
|
}
|
||||||
AstNodeRef::PlatformFunction(platform_function) => {
|
AstNodeRef::PlatformFunction(platform_function) => {
|
||||||
gather_platform_function(
|
gather_platform_function(platform_function, symbol_table, fqn_context, diagnostics);
|
||||||
platform_function,
|
|
||||||
symbol_table,
|
|
||||||
fqn_context,
|
|
||||||
scope_table,
|
|
||||||
diagnostics,
|
|
||||||
);
|
|
||||||
}
|
}
|
||||||
AstNodeRef::PlatformOperatorFunction(platform_operator_function) => {
|
AstNodeRef::PlatformOperatorFunction(platform_operator_function) => {
|
||||||
gather_platform_operator_function(
|
gather_platform_operator_function(
|
||||||
platform_operator_function,
|
platform_operator_function,
|
||||||
symbol_table,
|
symbol_table,
|
||||||
fqn_context,
|
fqn_context,
|
||||||
scope_table,
|
|
||||||
diagnostics,
|
diagnostics,
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
AstNodeRef::InterfaceFunction(interface_function) => {
|
AstNodeRef::InterfaceFunction(interface_function) => {
|
||||||
gather_interface_function(
|
gather_interface_function(interface_function, symbol_table, fqn_context, diagnostics);
|
||||||
interface_function,
|
|
||||||
symbol_table,
|
|
||||||
fqn_context,
|
|
||||||
scope_table,
|
|
||||||
diagnostics,
|
|
||||||
);
|
|
||||||
}
|
}
|
||||||
AstNodeRef::InterfaceDefaultFunction(interface_default_function) => {
|
AstNodeRef::InterfaceDefaultFunction(interface_default_function) => {
|
||||||
gather_interface_default_function(
|
gather_interface_default_function(
|
||||||
interface_default_function,
|
interface_default_function,
|
||||||
symbol_table,
|
symbol_table,
|
||||||
fqn_context,
|
fqn_context,
|
||||||
scope_table,
|
|
||||||
diagnostics,
|
diagnostics,
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
@ -197,7 +152,6 @@ fn gather_node<'a>(
|
|||||||
interface_operator_function,
|
interface_operator_function,
|
||||||
symbol_table,
|
symbol_table,
|
||||||
fqn_context,
|
fqn_context,
|
||||||
scope_table,
|
|
||||||
diagnostics,
|
diagnostics,
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
@ -206,122 +160,49 @@ fn gather_node<'a>(
|
|||||||
interface_default_operator_function,
|
interface_default_operator_function,
|
||||||
symbol_table,
|
symbol_table,
|
||||||
fqn_context,
|
fqn_context,
|
||||||
scope_table,
|
|
||||||
diagnostics,
|
diagnostics,
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
AstNodeRef::FunctionBody(function_body) => {
|
AstNodeRef::FunctionBody(function_body) => {
|
||||||
gather_function_body(
|
gather_function_body(function_body, symbol_table, fqn_context, diagnostics);
|
||||||
function_body,
|
|
||||||
symbol_table,
|
|
||||||
fqn_context,
|
|
||||||
scope_table,
|
|
||||||
diagnostics,
|
|
||||||
);
|
|
||||||
}
|
}
|
||||||
AstNodeRef::Member(member) => {
|
AstNodeRef::Member(member) => {
|
||||||
gather_member(member, symbol_table, fqn_context, scope_table, diagnostics);
|
gather_member(member, symbol_table, fqn_context, diagnostics);
|
||||||
}
|
}
|
||||||
AstNodeRef::VariableDeclaration(variable_declaration) => {
|
AstNodeRef::VariableDeclaration(variable_declaration) => {
|
||||||
gather_variable_declaration(
|
gather_variable_declaration(
|
||||||
variable_declaration,
|
variable_declaration,
|
||||||
symbol_table,
|
symbol_table,
|
||||||
fqn_context,
|
fqn_context,
|
||||||
scope_table,
|
|
||||||
diagnostics,
|
diagnostics,
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
AstNodeRef::IfClause(if_clause) => {
|
AstNodeRef::IfClause(if_clause) => {
|
||||||
gather_if_clause(
|
gather_if_clause(if_clause, symbol_table, fqn_context, diagnostics);
|
||||||
if_clause,
|
|
||||||
symbol_table,
|
|
||||||
fqn_context,
|
|
||||||
scope_table,
|
|
||||||
diagnostics,
|
|
||||||
);
|
|
||||||
}
|
}
|
||||||
AstNodeRef::IfElseIf(if_else_if) => {
|
AstNodeRef::IfElseIf(if_else_if) => {
|
||||||
gather_node_children(
|
gather_node_children(if_else_if, symbol_table, fqn_context, diagnostics);
|
||||||
if_else_if,
|
|
||||||
symbol_table,
|
|
||||||
fqn_context,
|
|
||||||
scope_table,
|
|
||||||
diagnostics,
|
|
||||||
);
|
|
||||||
}
|
}
|
||||||
AstNodeRef::WhileStatement(while_statement) => {
|
AstNodeRef::WhileStatement(while_statement) => {
|
||||||
gather_while_statement(
|
gather_while_statement(while_statement, symbol_table, fqn_context, diagnostics);
|
||||||
while_statement,
|
|
||||||
symbol_table,
|
|
||||||
fqn_context,
|
|
||||||
scope_table,
|
|
||||||
diagnostics,
|
|
||||||
);
|
|
||||||
}
|
}
|
||||||
AstNodeRef::ForStatement(for_statement) => {
|
AstNodeRef::ForStatement(for_statement) => {
|
||||||
gather_for_statement(
|
gather_for_statement(for_statement, symbol_table, fqn_context, diagnostics);
|
||||||
for_statement,
|
|
||||||
symbol_table,
|
|
||||||
fqn_context,
|
|
||||||
scope_table,
|
|
||||||
diagnostics,
|
|
||||||
);
|
|
||||||
}
|
}
|
||||||
AstNodeRef::VariableUse(variable_use) => {
|
AstNodeRef::VariableUse(variable_use) => {
|
||||||
gather_variable_use(variable_use, symbol_table, diagnostics);
|
gather_variable_use(variable_use, symbol_table, diagnostics);
|
||||||
}
|
}
|
||||||
AstNodeRef::TernaryExpression(ternary_expression) => {
|
AstNodeRef::TernaryExpression(ternary_expression) => {
|
||||||
gather_ternary_expression(
|
gather_ternary_expression(ternary_expression, symbol_table, fqn_context, diagnostics);
|
||||||
ternary_expression,
|
|
||||||
symbol_table,
|
|
||||||
fqn_context,
|
|
||||||
scope_table,
|
|
||||||
diagnostics,
|
|
||||||
);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
AstNodeRef::Closure(closure) => {
|
AstNodeRef::Closure(closure) => {
|
||||||
gather_closure(closure, symbol_table, fqn_context, scope_table, diagnostics);
|
gather_closure(closure, symbol_table, fqn_context, diagnostics);
|
||||||
}
|
}
|
||||||
AstNodeRef::ClosureParameter(closure_parameter) => {
|
AstNodeRef::ClosureParameter(closure_parameter) => {
|
||||||
gather_closure_parameter(
|
gather_closure_parameter(closure_parameter, symbol_table, fqn_context, diagnostics);
|
||||||
closure_parameter,
|
|
||||||
symbol_table,
|
|
||||||
fqn_context,
|
|
||||||
scope_table,
|
|
||||||
diagnostics,
|
|
||||||
);
|
|
||||||
}
|
}
|
||||||
_ => gather_node_children(node, symbol_table, fqn_context, scope_table, diagnostics),
|
_ => gather_node_children(node, symbol_table, fqn_context, diagnostics),
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
fn gather_fully_qualified_name<'a>(
|
|
||||||
fully_qualified_name: &'a FullyQualifiedName,
|
|
||||||
symbol_table: &mut SymbolTable,
|
|
||||||
scope_table: &mut ScopeTable<'a>,
|
|
||||||
) {
|
|
||||||
scope_table.insert_fqn_scope(fully_qualified_name, symbol_table.current_scope_id());
|
|
||||||
}
|
|
||||||
|
|
||||||
fn gather_primitive_type<'a>(
|
|
||||||
primitive_type: &'a PrimitiveType,
|
|
||||||
symbol_table: &mut SymbolTable,
|
|
||||||
fqn_context: &mut FqnContext,
|
|
||||||
scope_table: &mut ScopeTable<'a>,
|
|
||||||
diagnostics: &mut Vec<DmDiagnostic>,
|
|
||||||
) {
|
|
||||||
match primitive_type {
|
|
||||||
PrimitiveType::TypedArray(typed_array) => {
|
|
||||||
gather_node(
|
|
||||||
typed_array,
|
|
||||||
symbol_table,
|
|
||||||
fqn_context,
|
|
||||||
scope_table,
|
|
||||||
diagnostics,
|
|
||||||
);
|
|
||||||
}
|
|
||||||
_ => {}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -373,7 +254,6 @@ pub fn gather_compilation_unit<'a>(
|
|||||||
compilation_unit: &'a CompilationUnit,
|
compilation_unit: &'a CompilationUnit,
|
||||||
file_name: &str,
|
file_name: &str,
|
||||||
symbol_table: &mut SymbolTable,
|
symbol_table: &mut SymbolTable,
|
||||||
scope_table: &mut ScopeTable<'a>,
|
|
||||||
diagnostics: &mut Vec<DmDiagnostic>,
|
diagnostics: &mut Vec<DmDiagnostic>,
|
||||||
) {
|
) {
|
||||||
let mut fqn_context = FqnContext::new();
|
let mut fqn_context = FqnContext::new();
|
||||||
@ -382,7 +262,6 @@ pub fn gather_compilation_unit<'a>(
|
|||||||
compilation_unit,
|
compilation_unit,
|
||||||
symbol_table,
|
symbol_table,
|
||||||
&mut fqn_context,
|
&mut fqn_context,
|
||||||
scope_table,
|
|
||||||
diagnostics,
|
diagnostics,
|
||||||
);
|
);
|
||||||
symbol_table.pop_scope();
|
symbol_table.pop_scope();
|
||||||
@ -461,7 +340,6 @@ fn gather_module<'a>(
|
|||||||
module: &'a Module,
|
module: &'a Module,
|
||||||
symbol_table: &mut SymbolTable,
|
symbol_table: &mut SymbolTable,
|
||||||
fqn_context: &mut FqnContext,
|
fqn_context: &mut FqnContext,
|
||||||
scope_table: &mut ScopeTable<'a>,
|
|
||||||
diagnostics: &mut Vec<DmDiagnostic>,
|
diagnostics: &mut Vec<DmDiagnostic>,
|
||||||
) {
|
) {
|
||||||
let module_symbol = ModuleSymbol::new(
|
let module_symbol = ModuleSymbol::new(
|
||||||
@ -485,13 +363,7 @@ fn gather_module<'a>(
|
|||||||
symbol_table.push_scope(&format!("ModuleScope {}", module.identifier().name()));
|
symbol_table.push_scope(&format!("ModuleScope {}", module.identifier().name()));
|
||||||
|
|
||||||
for declaration in module.declarations() {
|
for declaration in module.declarations() {
|
||||||
gather_node(
|
gather_node(declaration, symbol_table, fqn_context, diagnostics);
|
||||||
declaration,
|
|
||||||
symbol_table,
|
|
||||||
fqn_context,
|
|
||||||
scope_table,
|
|
||||||
diagnostics,
|
|
||||||
);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
symbol_table.pop_scope();
|
symbol_table.pop_scope();
|
||||||
@ -502,7 +374,6 @@ fn gather_interface<'a>(
|
|||||||
interface: &'a Interface,
|
interface: &'a Interface,
|
||||||
symbol_table: &mut SymbolTable,
|
symbol_table: &mut SymbolTable,
|
||||||
fqn_context: &mut FqnContext,
|
fqn_context: &mut FqnContext,
|
||||||
scope_table: &mut ScopeTable<'a>,
|
|
||||||
diagnostics: &mut Vec<DmDiagnostic>,
|
diagnostics: &mut Vec<DmDiagnostic>,
|
||||||
) {
|
) {
|
||||||
let type_symbol = ConcreteTypeSymbol::new(
|
let type_symbol = ConcreteTypeSymbol::new(
|
||||||
@ -529,13 +400,7 @@ fn gather_interface<'a>(
|
|||||||
symbol_table.push_scope(&format!("InterfaceScope {}", interface.identifier().name()));
|
symbol_table.push_scope(&format!("InterfaceScope {}", interface.identifier().name()));
|
||||||
|
|
||||||
for declaration in interface.declarations() {
|
for declaration in interface.declarations() {
|
||||||
gather_node(
|
gather_node(declaration, symbol_table, fqn_context, diagnostics);
|
||||||
declaration,
|
|
||||||
symbol_table,
|
|
||||||
fqn_context,
|
|
||||||
scope_table,
|
|
||||||
diagnostics,
|
|
||||||
);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
symbol_table.pop_scope();
|
symbol_table.pop_scope();
|
||||||
@ -546,7 +411,6 @@ fn gather_class<'a>(
|
|||||||
class: &'a Class,
|
class: &'a Class,
|
||||||
symbol_table: &mut SymbolTable,
|
symbol_table: &mut SymbolTable,
|
||||||
fqn_context: &mut FqnContext,
|
fqn_context: &mut FqnContext,
|
||||||
scope_table: &mut ScopeTable<'a>,
|
|
||||||
diagnostics: &mut Vec<DmDiagnostic>,
|
diagnostics: &mut Vec<DmDiagnostic>,
|
||||||
) {
|
) {
|
||||||
let class_symbol = ConcreteTypeSymbol::new(
|
let class_symbol = ConcreteTypeSymbol::new(
|
||||||
@ -576,17 +440,10 @@ fn gather_class<'a>(
|
|||||||
class.class_constructor(),
|
class.class_constructor(),
|
||||||
symbol_table,
|
symbol_table,
|
||||||
fqn_context,
|
fqn_context,
|
||||||
scope_table,
|
|
||||||
diagnostics,
|
diagnostics,
|
||||||
);
|
);
|
||||||
for declaration in class.class_level_declarations() {
|
for declaration in class.class_level_declarations() {
|
||||||
gather_node(
|
gather_node(declaration, symbol_table, fqn_context, diagnostics);
|
||||||
declaration,
|
|
||||||
symbol_table,
|
|
||||||
fqn_context,
|
|
||||||
scope_table,
|
|
||||||
diagnostics,
|
|
||||||
);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
symbol_table.pop_scope();
|
symbol_table.pop_scope();
|
||||||
@ -597,7 +454,6 @@ fn gather_function<'a>(
|
|||||||
function: &'a Function,
|
function: &'a Function,
|
||||||
symbol_table: &mut SymbolTable,
|
symbol_table: &mut SymbolTable,
|
||||||
fqn_context: &mut FqnContext,
|
fqn_context: &mut FqnContext,
|
||||||
scope_table: &mut ScopeTable<'a>,
|
|
||||||
diagnostics: &mut Vec<DmDiagnostic>,
|
diagnostics: &mut Vec<DmDiagnostic>,
|
||||||
) {
|
) {
|
||||||
let function_symbol = FunctionSymbol::without_parameters_or_return_type(
|
let function_symbol = FunctionSymbol::without_parameters_or_return_type(
|
||||||
@ -618,32 +474,23 @@ fn gather_function<'a>(
|
|||||||
);
|
);
|
||||||
}
|
}
|
||||||
symbol_table.push_scope(&format!("FunctionScope {}", function.identifier().name()));
|
symbol_table.push_scope(&format!("FunctionScope {}", function.identifier().name()));
|
||||||
gather_node(
|
gather_node(function.generics(), symbol_table, fqn_context, diagnostics);
|
||||||
function.generics(),
|
|
||||||
symbol_table,
|
|
||||||
fqn_context,
|
|
||||||
scope_table,
|
|
||||||
diagnostics,
|
|
||||||
);
|
|
||||||
gather_node(
|
gather_node(
|
||||||
function.parameters(),
|
function.parameters(),
|
||||||
symbol_table,
|
symbol_table,
|
||||||
fqn_context,
|
fqn_context,
|
||||||
scope_table,
|
|
||||||
diagnostics,
|
diagnostics,
|
||||||
);
|
);
|
||||||
gather_node(
|
gather_node(
|
||||||
function.return_type(),
|
function.return_type(),
|
||||||
symbol_table,
|
symbol_table,
|
||||||
fqn_context,
|
fqn_context,
|
||||||
scope_table,
|
|
||||||
diagnostics,
|
diagnostics,
|
||||||
);
|
);
|
||||||
gather_node(
|
gather_node(
|
||||||
function.function_body(),
|
function.function_body(),
|
||||||
symbol_table,
|
symbol_table,
|
||||||
fqn_context,
|
fqn_context,
|
||||||
scope_table,
|
|
||||||
diagnostics,
|
diagnostics,
|
||||||
);
|
);
|
||||||
symbol_table.pop_scope();
|
symbol_table.pop_scope();
|
||||||
@ -653,7 +500,6 @@ fn gather_operator_function<'a>(
|
|||||||
operator_function: &'a OperatorFunction,
|
operator_function: &'a OperatorFunction,
|
||||||
symbol_table: &mut SymbolTable,
|
symbol_table: &mut SymbolTable,
|
||||||
fqn_context: &mut FqnContext,
|
fqn_context: &mut FqnContext,
|
||||||
scope_table: &mut ScopeTable<'a>,
|
|
||||||
diagnostics: &mut Vec<DmDiagnostic>,
|
diagnostics: &mut Vec<DmDiagnostic>,
|
||||||
) {
|
) {
|
||||||
let function_symbol = FunctionSymbol::without_parameters_or_return_type(
|
let function_symbol = FunctionSymbol::without_parameters_or_return_type(
|
||||||
@ -683,28 +529,24 @@ fn gather_operator_function<'a>(
|
|||||||
operator_function.generics(),
|
operator_function.generics(),
|
||||||
symbol_table,
|
symbol_table,
|
||||||
fqn_context,
|
fqn_context,
|
||||||
scope_table,
|
|
||||||
diagnostics,
|
diagnostics,
|
||||||
);
|
);
|
||||||
gather_node(
|
gather_node(
|
||||||
operator_function.parameters(),
|
operator_function.parameters(),
|
||||||
symbol_table,
|
symbol_table,
|
||||||
fqn_context,
|
fqn_context,
|
||||||
scope_table,
|
|
||||||
diagnostics,
|
diagnostics,
|
||||||
);
|
);
|
||||||
gather_node(
|
gather_node(
|
||||||
operator_function.return_type(),
|
operator_function.return_type(),
|
||||||
symbol_table,
|
symbol_table,
|
||||||
fqn_context,
|
fqn_context,
|
||||||
scope_table,
|
|
||||||
diagnostics,
|
diagnostics,
|
||||||
);
|
);
|
||||||
gather_node(
|
gather_node(
|
||||||
operator_function.function_body(),
|
operator_function.function_body(),
|
||||||
symbol_table,
|
symbol_table,
|
||||||
fqn_context,
|
fqn_context,
|
||||||
scope_table,
|
|
||||||
diagnostics,
|
diagnostics,
|
||||||
);
|
);
|
||||||
symbol_table.pop_scope();
|
symbol_table.pop_scope();
|
||||||
@ -714,7 +556,6 @@ fn gather_platform_function<'a>(
|
|||||||
platform_function: &'a PlatformFunction,
|
platform_function: &'a PlatformFunction,
|
||||||
symbol_table: &mut SymbolTable,
|
symbol_table: &mut SymbolTable,
|
||||||
fqn_context: &mut FqnContext,
|
fqn_context: &mut FqnContext,
|
||||||
scope_table: &mut ScopeTable<'a>,
|
|
||||||
diagnostics: &mut Vec<DmDiagnostic>,
|
diagnostics: &mut Vec<DmDiagnostic>,
|
||||||
) {
|
) {
|
||||||
let function_symbol = FunctionSymbol::without_parameters_or_return_type(
|
let function_symbol = FunctionSymbol::without_parameters_or_return_type(
|
||||||
@ -744,21 +585,18 @@ fn gather_platform_function<'a>(
|
|||||||
platform_function.generics(),
|
platform_function.generics(),
|
||||||
symbol_table,
|
symbol_table,
|
||||||
fqn_context,
|
fqn_context,
|
||||||
scope_table,
|
|
||||||
diagnostics,
|
diagnostics,
|
||||||
);
|
);
|
||||||
gather_node(
|
gather_node(
|
||||||
platform_function.parameters(),
|
platform_function.parameters(),
|
||||||
symbol_table,
|
symbol_table,
|
||||||
fqn_context,
|
fqn_context,
|
||||||
scope_table,
|
|
||||||
diagnostics,
|
diagnostics,
|
||||||
);
|
);
|
||||||
gather_node(
|
gather_node(
|
||||||
platform_function.return_type(),
|
platform_function.return_type(),
|
||||||
symbol_table,
|
symbol_table,
|
||||||
fqn_context,
|
fqn_context,
|
||||||
scope_table,
|
|
||||||
diagnostics,
|
diagnostics,
|
||||||
);
|
);
|
||||||
symbol_table.pop_scope();
|
symbol_table.pop_scope();
|
||||||
@ -768,7 +606,6 @@ fn gather_platform_operator_function<'a>(
|
|||||||
platform_operator_function: &'a PlatformOperatorFunction,
|
platform_operator_function: &'a PlatformOperatorFunction,
|
||||||
symbol_table: &mut SymbolTable,
|
symbol_table: &mut SymbolTable,
|
||||||
fqn_context: &mut FqnContext,
|
fqn_context: &mut FqnContext,
|
||||||
scope_table: &mut ScopeTable<'a>,
|
|
||||||
diagnostics: &mut Vec<DmDiagnostic>,
|
diagnostics: &mut Vec<DmDiagnostic>,
|
||||||
) {
|
) {
|
||||||
let function_symbol = FunctionSymbol::without_parameters_or_return_type(
|
let function_symbol = FunctionSymbol::without_parameters_or_return_type(
|
||||||
@ -798,21 +635,18 @@ fn gather_platform_operator_function<'a>(
|
|||||||
platform_operator_function.generics(),
|
platform_operator_function.generics(),
|
||||||
symbol_table,
|
symbol_table,
|
||||||
fqn_context,
|
fqn_context,
|
||||||
scope_table,
|
|
||||||
diagnostics,
|
diagnostics,
|
||||||
);
|
);
|
||||||
gather_node(
|
gather_node(
|
||||||
platform_operator_function.parameters(),
|
platform_operator_function.parameters(),
|
||||||
symbol_table,
|
symbol_table,
|
||||||
fqn_context,
|
fqn_context,
|
||||||
scope_table,
|
|
||||||
diagnostics,
|
diagnostics,
|
||||||
);
|
);
|
||||||
gather_node(
|
gather_node(
|
||||||
platform_operator_function.return_type(),
|
platform_operator_function.return_type(),
|
||||||
symbol_table,
|
symbol_table,
|
||||||
fqn_context,
|
fqn_context,
|
||||||
scope_table,
|
|
||||||
diagnostics,
|
diagnostics,
|
||||||
);
|
);
|
||||||
symbol_table.pop_scope();
|
symbol_table.pop_scope();
|
||||||
@ -822,7 +656,6 @@ fn gather_interface_function<'a>(
|
|||||||
interface_function: &'a InterfaceFunction,
|
interface_function: &'a InterfaceFunction,
|
||||||
symbol_table: &mut SymbolTable,
|
symbol_table: &mut SymbolTable,
|
||||||
fqn_context: &mut FqnContext,
|
fqn_context: &mut FqnContext,
|
||||||
scope_table: &mut ScopeTable<'a>,
|
|
||||||
diagnostics: &mut Vec<DmDiagnostic>,
|
diagnostics: &mut Vec<DmDiagnostic>,
|
||||||
) {
|
) {
|
||||||
let function_symbol = FunctionSymbol::without_parameters_or_return_type(
|
let function_symbol = FunctionSymbol::without_parameters_or_return_type(
|
||||||
@ -852,21 +685,18 @@ fn gather_interface_function<'a>(
|
|||||||
interface_function.generics(),
|
interface_function.generics(),
|
||||||
symbol_table,
|
symbol_table,
|
||||||
fqn_context,
|
fqn_context,
|
||||||
scope_table,
|
|
||||||
diagnostics,
|
diagnostics,
|
||||||
);
|
);
|
||||||
gather_node(
|
gather_node(
|
||||||
interface_function.parameters(),
|
interface_function.parameters(),
|
||||||
symbol_table,
|
symbol_table,
|
||||||
fqn_context,
|
fqn_context,
|
||||||
scope_table,
|
|
||||||
diagnostics,
|
diagnostics,
|
||||||
);
|
);
|
||||||
gather_node(
|
gather_node(
|
||||||
interface_function.return_type(),
|
interface_function.return_type(),
|
||||||
symbol_table,
|
symbol_table,
|
||||||
fqn_context,
|
fqn_context,
|
||||||
scope_table,
|
|
||||||
diagnostics,
|
diagnostics,
|
||||||
);
|
);
|
||||||
symbol_table.pop_scope();
|
symbol_table.pop_scope();
|
||||||
@ -876,7 +706,6 @@ fn gather_interface_default_function<'a>(
|
|||||||
interface_default_function: &'a InterfaceDefaultFunction,
|
interface_default_function: &'a InterfaceDefaultFunction,
|
||||||
symbol_table: &mut SymbolTable,
|
symbol_table: &mut SymbolTable,
|
||||||
fqn_context: &mut FqnContext,
|
fqn_context: &mut FqnContext,
|
||||||
scope_table: &mut ScopeTable<'a>,
|
|
||||||
diagnostics: &mut Vec<DmDiagnostic>,
|
diagnostics: &mut Vec<DmDiagnostic>,
|
||||||
) {
|
) {
|
||||||
let function_symbol = FunctionSymbol::without_parameters_or_return_type(
|
let function_symbol = FunctionSymbol::without_parameters_or_return_type(
|
||||||
@ -906,28 +735,24 @@ fn gather_interface_default_function<'a>(
|
|||||||
interface_default_function.generics(),
|
interface_default_function.generics(),
|
||||||
symbol_table,
|
symbol_table,
|
||||||
fqn_context,
|
fqn_context,
|
||||||
scope_table,
|
|
||||||
diagnostics,
|
diagnostics,
|
||||||
);
|
);
|
||||||
gather_node(
|
gather_node(
|
||||||
interface_default_function.parameters(),
|
interface_default_function.parameters(),
|
||||||
symbol_table,
|
symbol_table,
|
||||||
fqn_context,
|
fqn_context,
|
||||||
scope_table,
|
|
||||||
diagnostics,
|
diagnostics,
|
||||||
);
|
);
|
||||||
gather_node(
|
gather_node(
|
||||||
interface_default_function.return_type(),
|
interface_default_function.return_type(),
|
||||||
symbol_table,
|
symbol_table,
|
||||||
fqn_context,
|
fqn_context,
|
||||||
scope_table,
|
|
||||||
diagnostics,
|
diagnostics,
|
||||||
);
|
);
|
||||||
gather_node(
|
gather_node(
|
||||||
interface_default_function.function_body(),
|
interface_default_function.function_body(),
|
||||||
symbol_table,
|
symbol_table,
|
||||||
fqn_context,
|
fqn_context,
|
||||||
scope_table,
|
|
||||||
diagnostics,
|
diagnostics,
|
||||||
);
|
);
|
||||||
symbol_table.pop_scope();
|
symbol_table.pop_scope();
|
||||||
@ -937,7 +762,6 @@ fn gather_interface_operator_function<'a>(
|
|||||||
interface_operator_function: &'a InterfaceOperatorFunction,
|
interface_operator_function: &'a InterfaceOperatorFunction,
|
||||||
symbol_table: &mut SymbolTable,
|
symbol_table: &mut SymbolTable,
|
||||||
fqn_context: &mut FqnContext,
|
fqn_context: &mut FqnContext,
|
||||||
scope_table: &mut ScopeTable<'a>,
|
|
||||||
diagnostics: &mut Vec<DmDiagnostic>,
|
diagnostics: &mut Vec<DmDiagnostic>,
|
||||||
) {
|
) {
|
||||||
let function_symbol = FunctionSymbol::without_parameters_or_return_type(
|
let function_symbol = FunctionSymbol::without_parameters_or_return_type(
|
||||||
@ -967,21 +791,18 @@ fn gather_interface_operator_function<'a>(
|
|||||||
interface_operator_function.generics(),
|
interface_operator_function.generics(),
|
||||||
symbol_table,
|
symbol_table,
|
||||||
fqn_context,
|
fqn_context,
|
||||||
scope_table,
|
|
||||||
diagnostics,
|
diagnostics,
|
||||||
);
|
);
|
||||||
gather_node(
|
gather_node(
|
||||||
interface_operator_function.parameters(),
|
interface_operator_function.parameters(),
|
||||||
symbol_table,
|
symbol_table,
|
||||||
fqn_context,
|
fqn_context,
|
||||||
scope_table,
|
|
||||||
diagnostics,
|
diagnostics,
|
||||||
);
|
);
|
||||||
gather_node(
|
gather_node(
|
||||||
interface_operator_function.return_type(),
|
interface_operator_function.return_type(),
|
||||||
symbol_table,
|
symbol_table,
|
||||||
fqn_context,
|
fqn_context,
|
||||||
scope_table,
|
|
||||||
diagnostics,
|
diagnostics,
|
||||||
);
|
);
|
||||||
symbol_table.pop_scope();
|
symbol_table.pop_scope();
|
||||||
@ -991,7 +812,6 @@ fn gather_interface_default_operator_function<'a>(
|
|||||||
interface_default_operator_function: &'a InterfaceDefaultOperatorFunction,
|
interface_default_operator_function: &'a InterfaceDefaultOperatorFunction,
|
||||||
symbol_table: &mut SymbolTable,
|
symbol_table: &mut SymbolTable,
|
||||||
fqn_context: &mut FqnContext,
|
fqn_context: &mut FqnContext,
|
||||||
scope_table: &mut ScopeTable<'a>,
|
|
||||||
diagnostics: &mut Vec<DmDiagnostic>,
|
diagnostics: &mut Vec<DmDiagnostic>,
|
||||||
) {
|
) {
|
||||||
let function_symbol = FunctionSymbol::without_parameters_or_return_type(
|
let function_symbol = FunctionSymbol::without_parameters_or_return_type(
|
||||||
@ -1035,28 +855,24 @@ fn gather_interface_default_operator_function<'a>(
|
|||||||
interface_default_operator_function.generics(),
|
interface_default_operator_function.generics(),
|
||||||
symbol_table,
|
symbol_table,
|
||||||
fqn_context,
|
fqn_context,
|
||||||
scope_table,
|
|
||||||
diagnostics,
|
diagnostics,
|
||||||
);
|
);
|
||||||
gather_node(
|
gather_node(
|
||||||
interface_default_operator_function.parameters(),
|
interface_default_operator_function.parameters(),
|
||||||
symbol_table,
|
symbol_table,
|
||||||
fqn_context,
|
fqn_context,
|
||||||
scope_table,
|
|
||||||
diagnostics,
|
diagnostics,
|
||||||
);
|
);
|
||||||
gather_node(
|
gather_node(
|
||||||
interface_default_operator_function.return_type(),
|
interface_default_operator_function.return_type(),
|
||||||
symbol_table,
|
symbol_table,
|
||||||
fqn_context,
|
fqn_context,
|
||||||
scope_table,
|
|
||||||
diagnostics,
|
diagnostics,
|
||||||
);
|
);
|
||||||
gather_node(
|
gather_node(
|
||||||
interface_default_operator_function.function_body(),
|
interface_default_operator_function.function_body(),
|
||||||
symbol_table,
|
symbol_table,
|
||||||
fqn_context,
|
fqn_context,
|
||||||
scope_table,
|
|
||||||
diagnostics,
|
diagnostics,
|
||||||
);
|
);
|
||||||
symbol_table.pop_scope();
|
symbol_table.pop_scope();
|
||||||
@ -1066,17 +882,10 @@ fn gather_function_body<'a>(
|
|||||||
function_body: &'a FunctionBody,
|
function_body: &'a FunctionBody,
|
||||||
symbol_table: &mut SymbolTable,
|
symbol_table: &mut SymbolTable,
|
||||||
fqn_context: &mut FqnContext,
|
fqn_context: &mut FqnContext,
|
||||||
scope_table: &mut ScopeTable<'a>,
|
|
||||||
diagnostics: &mut Vec<DmDiagnostic>,
|
diagnostics: &mut Vec<DmDiagnostic>,
|
||||||
) {
|
) {
|
||||||
symbol_table.push_scope("FunctionBodyScope");
|
symbol_table.push_scope("FunctionBodyScope");
|
||||||
gather_node_children(
|
gather_node_children(function_body, symbol_table, fqn_context, diagnostics);
|
||||||
function_body,
|
|
||||||
symbol_table,
|
|
||||||
fqn_context,
|
|
||||||
scope_table,
|
|
||||||
diagnostics,
|
|
||||||
);
|
|
||||||
symbol_table.pop_scope();
|
symbol_table.pop_scope();
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -1084,7 +893,6 @@ fn gather_member<'a>(
|
|||||||
member: &'a Member,
|
member: &'a Member,
|
||||||
symbol_table: &mut SymbolTable,
|
symbol_table: &mut SymbolTable,
|
||||||
fqn_context: &mut FqnContext,
|
fqn_context: &mut FqnContext,
|
||||||
scope_table: &mut ScopeTable<'a>,
|
|
||||||
diagnostics: &mut Vec<DmDiagnostic>,
|
diagnostics: &mut Vec<DmDiagnostic>,
|
||||||
) {
|
) {
|
||||||
let member_symbol = ClassMemberSymbol::new(
|
let member_symbol = ClassMemberSymbol::new(
|
||||||
@ -1103,20 +911,13 @@ fn gather_member<'a>(
|
|||||||
diagnostics,
|
diagnostics,
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
gather_node(
|
gather_node(member.type_use(), symbol_table, fqn_context, diagnostics);
|
||||||
member.type_use(),
|
|
||||||
symbol_table,
|
|
||||||
fqn_context,
|
|
||||||
scope_table,
|
|
||||||
diagnostics,
|
|
||||||
);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
fn gather_variable_declaration<'a>(
|
fn gather_variable_declaration<'a>(
|
||||||
variable_declaration: &'a VariableDeclaration,
|
variable_declaration: &'a VariableDeclaration,
|
||||||
symbol_table: &mut SymbolTable,
|
symbol_table: &mut SymbolTable,
|
||||||
fqn_context: &mut FqnContext,
|
fqn_context: &mut FqnContext,
|
||||||
scope_table: &mut ScopeTable<'a>,
|
|
||||||
diagnostics: &mut Vec<DmDiagnostic>,
|
diagnostics: &mut Vec<DmDiagnostic>,
|
||||||
) {
|
) {
|
||||||
let variable_symbol = VariableSymbol::new(
|
let variable_symbol = VariableSymbol::new(
|
||||||
@ -1137,13 +938,7 @@ fn gather_variable_declaration<'a>(
|
|||||||
);
|
);
|
||||||
}
|
}
|
||||||
if let Some(expression) = variable_declaration.expression() {
|
if let Some(expression) = variable_declaration.expression() {
|
||||||
gather_node(
|
gather_node(expression, symbol_table, fqn_context, diagnostics);
|
||||||
expression,
|
|
||||||
symbol_table,
|
|
||||||
fqn_context,
|
|
||||||
scope_table,
|
|
||||||
diagnostics,
|
|
||||||
);
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -1151,7 +946,6 @@ fn gather_if_clause<'a>(
|
|||||||
if_clause: &'a IfClause,
|
if_clause: &'a IfClause,
|
||||||
symbol_table: &mut SymbolTable,
|
symbol_table: &mut SymbolTable,
|
||||||
fqn_context: &mut FqnContext,
|
fqn_context: &mut FqnContext,
|
||||||
scope_table: &mut ScopeTable<'a>,
|
|
||||||
diagnostics: &mut Vec<DmDiagnostic>,
|
diagnostics: &mut Vec<DmDiagnostic>,
|
||||||
) {
|
) {
|
||||||
symbol_table.push_scope("IfClauseScope");
|
symbol_table.push_scope("IfClauseScope");
|
||||||
@ -1159,18 +953,11 @@ fn gather_if_clause<'a>(
|
|||||||
if_clause.expression(),
|
if_clause.expression(),
|
||||||
symbol_table,
|
symbol_table,
|
||||||
fqn_context,
|
fqn_context,
|
||||||
scope_table,
|
|
||||||
diagnostics,
|
diagnostics,
|
||||||
);
|
);
|
||||||
symbol_table.push_scope("IfClauseStatementsScope");
|
symbol_table.push_scope("IfClauseStatementsScope");
|
||||||
for statement in if_clause.statements() {
|
for statement in if_clause.statements() {
|
||||||
gather_node(
|
gather_node(statement, symbol_table, fqn_context, diagnostics);
|
||||||
statement,
|
|
||||||
symbol_table,
|
|
||||||
fqn_context,
|
|
||||||
scope_table,
|
|
||||||
diagnostics,
|
|
||||||
);
|
|
||||||
}
|
}
|
||||||
symbol_table.pop_scope();
|
symbol_table.pop_scope();
|
||||||
symbol_table.pop_scope();
|
symbol_table.pop_scope();
|
||||||
@ -1180,7 +967,6 @@ fn gather_while_statement<'a>(
|
|||||||
while_statement: &'a WhileStatement,
|
while_statement: &'a WhileStatement,
|
||||||
symbol_table: &mut SymbolTable,
|
symbol_table: &mut SymbolTable,
|
||||||
fqn_context: &mut FqnContext,
|
fqn_context: &mut FqnContext,
|
||||||
scope_table: &mut ScopeTable<'a>,
|
|
||||||
diagnostics: &mut Vec<DmDiagnostic>,
|
diagnostics: &mut Vec<DmDiagnostic>,
|
||||||
) {
|
) {
|
||||||
symbol_table.push_scope("WhileStatementScope");
|
symbol_table.push_scope("WhileStatementScope");
|
||||||
@ -1188,18 +974,11 @@ fn gather_while_statement<'a>(
|
|||||||
while_statement.expression(),
|
while_statement.expression(),
|
||||||
symbol_table,
|
symbol_table,
|
||||||
fqn_context,
|
fqn_context,
|
||||||
scope_table,
|
|
||||||
diagnostics,
|
diagnostics,
|
||||||
);
|
);
|
||||||
symbol_table.push_scope("WhileStatementStatementsScope");
|
symbol_table.push_scope("WhileStatementStatementsScope");
|
||||||
for statement in while_statement.statements() {
|
for statement in while_statement.statements() {
|
||||||
gather_node(
|
gather_node(statement, symbol_table, fqn_context, diagnostics);
|
||||||
statement,
|
|
||||||
symbol_table,
|
|
||||||
fqn_context,
|
|
||||||
scope_table,
|
|
||||||
diagnostics,
|
|
||||||
);
|
|
||||||
}
|
}
|
||||||
symbol_table.pop_scope();
|
symbol_table.pop_scope();
|
||||||
symbol_table.pop_scope();
|
symbol_table.pop_scope();
|
||||||
@ -1209,14 +988,12 @@ fn gather_for_statement<'a>(
|
|||||||
for_statement: &'a ForStatement,
|
for_statement: &'a ForStatement,
|
||||||
symbol_table: &mut SymbolTable,
|
symbol_table: &mut SymbolTable,
|
||||||
fqn_context: &mut FqnContext,
|
fqn_context: &mut FqnContext,
|
||||||
scope_table: &mut ScopeTable<'a>,
|
|
||||||
diagnostics: &mut Vec<DmDiagnostic>,
|
diagnostics: &mut Vec<DmDiagnostic>,
|
||||||
) {
|
) {
|
||||||
gather_node(
|
gather_node(
|
||||||
for_statement.expression(),
|
for_statement.expression(),
|
||||||
symbol_table,
|
symbol_table,
|
||||||
fqn_context,
|
fqn_context,
|
||||||
scope_table,
|
|
||||||
diagnostics,
|
diagnostics,
|
||||||
);
|
);
|
||||||
symbol_table.push_scope("ForStatementScope");
|
symbol_table.push_scope("ForStatementScope");
|
||||||
@ -1239,13 +1016,7 @@ fn gather_for_statement<'a>(
|
|||||||
}
|
}
|
||||||
symbol_table.push_scope("ForStatementStatementsScope");
|
symbol_table.push_scope("ForStatementStatementsScope");
|
||||||
for statement in for_statement.statements() {
|
for statement in for_statement.statements() {
|
||||||
gather_node(
|
gather_node(statement, symbol_table, fqn_context, diagnostics);
|
||||||
statement,
|
|
||||||
symbol_table,
|
|
||||||
fqn_context,
|
|
||||||
scope_table,
|
|
||||||
diagnostics,
|
|
||||||
);
|
|
||||||
}
|
}
|
||||||
symbol_table.pop_scope();
|
symbol_table.pop_scope();
|
||||||
symbol_table.pop_scope();
|
symbol_table.pop_scope();
|
||||||
@ -1275,17 +1046,10 @@ fn gather_ternary_expression<'a>(
|
|||||||
ternary_expression: &'a TernaryExpression,
|
ternary_expression: &'a TernaryExpression,
|
||||||
symbol_table: &mut SymbolTable,
|
symbol_table: &mut SymbolTable,
|
||||||
fqn_context: &mut FqnContext,
|
fqn_context: &mut FqnContext,
|
||||||
scope_table: &mut ScopeTable<'a>,
|
|
||||||
diagnostics: &mut Vec<DmDiagnostic>,
|
diagnostics: &mut Vec<DmDiagnostic>,
|
||||||
) {
|
) {
|
||||||
symbol_table.push_scope("TernaryExpressionScope");
|
symbol_table.push_scope("TernaryExpressionScope");
|
||||||
gather_node_children(
|
gather_node_children(ternary_expression, symbol_table, fqn_context, diagnostics);
|
||||||
ternary_expression,
|
|
||||||
symbol_table,
|
|
||||||
fqn_context,
|
|
||||||
scope_table,
|
|
||||||
diagnostics,
|
|
||||||
);
|
|
||||||
symbol_table.pop_scope();
|
symbol_table.pop_scope();
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -1293,7 +1057,6 @@ fn gather_closure<'a>(
|
|||||||
closure: &'a Closure,
|
closure: &'a Closure,
|
||||||
symbol_table: &mut SymbolTable,
|
symbol_table: &mut SymbolTable,
|
||||||
fqn_context: &mut FqnContext,
|
fqn_context: &mut FqnContext,
|
||||||
scope_table: &mut ScopeTable<'a>,
|
|
||||||
diagnostics: &mut Vec<DmDiagnostic>,
|
diagnostics: &mut Vec<DmDiagnostic>,
|
||||||
) {
|
) {
|
||||||
symbol_table.push_scope("ClosureScope");
|
symbol_table.push_scope("ClosureScope");
|
||||||
@ -1301,18 +1064,11 @@ fn gather_closure<'a>(
|
|||||||
closure.closure_parameters(),
|
closure.closure_parameters(),
|
||||||
symbol_table,
|
symbol_table,
|
||||||
fqn_context,
|
fqn_context,
|
||||||
scope_table,
|
|
||||||
diagnostics,
|
diagnostics,
|
||||||
);
|
);
|
||||||
symbol_table.push_scope("ClosureStatementsScope");
|
symbol_table.push_scope("ClosureStatementsScope");
|
||||||
for statement in closure.statements() {
|
for statement in closure.statements() {
|
||||||
gather_node(
|
gather_node(statement, symbol_table, fqn_context, diagnostics);
|
||||||
statement,
|
|
||||||
symbol_table,
|
|
||||||
fqn_context,
|
|
||||||
scope_table,
|
|
||||||
diagnostics,
|
|
||||||
);
|
|
||||||
}
|
}
|
||||||
symbol_table.pop_scope();
|
symbol_table.pop_scope();
|
||||||
symbol_table.pop_scope();
|
symbol_table.pop_scope();
|
||||||
@ -1322,7 +1078,6 @@ fn gather_closure_parameter<'a>(
|
|||||||
closure_parameter: &'a ClosureParameter,
|
closure_parameter: &'a ClosureParameter,
|
||||||
symbol_table: &mut SymbolTable,
|
symbol_table: &mut SymbolTable,
|
||||||
fqn_context: &mut FqnContext,
|
fqn_context: &mut FqnContext,
|
||||||
scope_table: &mut ScopeTable<'a>,
|
|
||||||
diagnostics: &mut Vec<DmDiagnostic>,
|
diagnostics: &mut Vec<DmDiagnostic>,
|
||||||
) {
|
) {
|
||||||
let parameter_symbol = ParameterSymbol::new(
|
let parameter_symbol = ParameterSymbol::new(
|
||||||
@ -1342,12 +1097,6 @@ fn gather_closure_parameter<'a>(
|
|||||||
);
|
);
|
||||||
}
|
}
|
||||||
if let Some(type_use) = closure_parameter.type_use() {
|
if let Some(type_use) = closure_parameter.type_use() {
|
||||||
gather_node(
|
gather_node(type_use, symbol_table, fqn_context, diagnostics);
|
||||||
type_use,
|
|
||||||
symbol_table,
|
|
||||||
fqn_context,
|
|
||||||
scope_table,
|
|
||||||
diagnostics,
|
|
||||||
);
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@ -26,9 +26,7 @@ use crate::diagnostic::DmDiagnostic;
|
|||||||
use crate::name_analysis::gather::gather_compilation_unit;
|
use crate::name_analysis::gather::gather_compilation_unit;
|
||||||
use crate::name_analysis::symbol_table::SymbolTable;
|
use crate::name_analysis::symbol_table::SymbolTable;
|
||||||
use codespan_reporting::files::Files;
|
use codespan_reporting::files::Files;
|
||||||
use std::collections::HashMap;
|
|
||||||
use std::hash::Hash;
|
use std::hash::Hash;
|
||||||
use crate::name_analysis::scope_table::ScopeTable;
|
|
||||||
|
|
||||||
pub(self) mod fqn_context;
|
pub(self) mod fqn_context;
|
||||||
mod gather;
|
mod gather;
|
||||||
@ -43,7 +41,6 @@ pub fn analyze_names<'a, F: Files<'a, FileId = usize, Name = String>>(
|
|||||||
symbol_table: &mut SymbolTable,
|
symbol_table: &mut SymbolTable,
|
||||||
) -> Vec<DmDiagnostic> {
|
) -> Vec<DmDiagnostic> {
|
||||||
let mut diagnostics = vec![];
|
let mut diagnostics = vec![];
|
||||||
let mut scope_table = ScopeTable::new();
|
|
||||||
|
|
||||||
// gather symbols
|
// gather symbols
|
||||||
for compilation_unit in compilation_units {
|
for compilation_unit in compilation_units {
|
||||||
@ -52,7 +49,6 @@ pub fn analyze_names<'a, F: Files<'a, FileId = usize, Name = String>>(
|
|||||||
compilation_unit,
|
compilation_unit,
|
||||||
&file_name,
|
&file_name,
|
||||||
symbol_table,
|
symbol_table,
|
||||||
&mut scope_table,
|
|
||||||
&mut diagnostics,
|
&mut diagnostics,
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user