Beispiel #1
0
        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;
            }
        }
Beispiel #2
0
 public Scope(FunctionDefinition functionDefinition)
 {
     _functionDefinition = functionDefinition;
 }
Beispiel #3
0
 public Scope()
 {
     _functionDefinition = null;
 }