Exemplo n.º 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;
            }
        }
Exemplo n.º 2
0
 public TypeCheckListener(Semantic semantic, Scope scope)
 {
     _semantic = semantic;
     _scope = scope;
 }
Exemplo n.º 3
0
        public override void EnterFunctionDefinition(LittleBigCParser.FunctionDefinitionContext context)
        {
            var functionName = context.Identifier().GetText();

            _currentScope = _semantic.GetScope(functionName);
        }
Exemplo n.º 4
0
        public ResolvingListener(Semantic semantic)
        {
            _semantic = semantic;

            _currentScope = _semantic.GlobalScope;
        }
Exemplo n.º 5
0
 public override void ExitFunctionDefinition(LittleBigCParser.FunctionDefinitionContext context)
 {
     _currentScope = _semantic.GlobalScope;
 }
Exemplo n.º 6
0
 public DefinitionListener()
     : base()
 {
     _scopes.Add(_globalScope);
     _currentScope = _globalScope;
 }