public override void EnterFunctionDefinition(LittleBigCParser.FunctionDefinitionContext context) { var function = new FunctionDefinition(context); var scope = new Scope(function); if (_scopes.Any(x => x.Name == scope.Name)) { var node = context.Identifier(); _errors.Add(String.Format("[{0}:{1}] Semantic error: Function {2} already defined.", node.Symbol.Line, node.Symbol.StartIndex, scope.Name)); } else { _scopes.Add(scope); _currentScope = scope; } }
public TypeCheckListener(Semantic semantic, Scope scope) { _semantic = semantic; _scope = scope; }
public override void EnterFunctionDefinition(LittleBigCParser.FunctionDefinitionContext context) { var functionName = context.Identifier().GetText(); _currentScope = _semantic.GetScope(functionName); }
public ResolvingListener(Semantic semantic) { _semantic = semantic; _currentScope = _semantic.GlobalScope; }
public override void ExitFunctionDefinition(LittleBigCParser.FunctionDefinitionContext context) { _currentScope = _semantic.GlobalScope; }
public DefinitionListener() : base() { _scopes.Add(_globalScope); _currentScope = _globalScope; }