internal IDisposable RegisterStruct(LexerNode lexer, StructNode node) { if (!CanRegisterGlobalFunction()) { throw new SemanticException($"Unavailable struct declaration '{lexer.Value}' inside another function '{currentRegistration.Name}'"); } var str = new StructGloalObject { Name = lexer, Node = node }; global.Add(lexer.Value, str); currentRegistration = new ScopeRegistration(lexer.Value, str); return(currentRegistration); }
internal IDisposable RegisterFunction(LexerNode lexer, FunctionDeclarationNode node) { if (!CanRegisterGlobalFunction()) { throw new SemanticException($"Unavailable function declaration '{lexer.Value}' inside another function '{currentRegistration.Name}'"); } var f = new FuncGloalObject { Name = lexer, Node = node }; global.Add(lexer.Value, f); scopes.Add(lexer.Value, f); currentRegistration = new ScopeRegistration(lexer.Value, f); return(currentRegistration); }
public SemanticAnalyzer() { currentRegistration = new EmptyRegistration(); }