Exemplo n.º 1
0
        public override void Visit(VariableDecAssignAST variableDecAssign)
        {
            var identInfo = new IdentifierInfo
            {
                name           = variableDecAssign.Name,
                typeAST        = variableDecAssign.Type,
                position       = _currentNodePosition,
                scopeId        = _currentScope.id,
                isFunctionType = variableDecAssign.Type is FunctionTypeAST
            };

            AddIdentInfoToSymTable(identInfo);

            if (variableDecAssign.Type != null)
            {
                return;
            }

            IdentifiersToBeInferred.Add(new IdentExpr
            {
                identInfo = identInfo,
                expr      = variableDecAssign.ExpressionValue as BaseExprAST,
                file      = _symTable.FilePath
            });

            if (_currentScope.id != 0)
            {
                return;
            }

            GlobalIdentifiers.Add(variableDecAssign.Name);
        }
Exemplo n.º 2
0
        public override void Visit(VariableDecAssignAST variableDecAssign)
        {
            if (variableDecAssign.Type == null)
            {
                return;
            }

            var identInfo = _symTableManager.LookupIdentifierInfo(_currentFileName, variableDecAssign.Name,
                                                                  _currentScopeId, _currentNodePosition);

            var exprType = _exprTypeVisitor.GetAstNodeType(_currentFileName, identInfo.scopeId, identInfo.position, variableDecAssign.ExpressionValue);

            if (!IsSameTypeOrNullPtr(variableDecAssign.Type, exprType))
            {
                throw new Exception(string.Format("Type mismatch : variable '{0}' have type '{1}' but assigned '{2}' type",
                                                  variableDecAssign.Name, variableDecAssign.Type, exprType));
            }
        }
Exemplo n.º 3
0
 public override void Visit(VariableDecAssignAST variableDecAssign)
 {
 }
Exemplo n.º 4
0
 public virtual void Visit(VariableDecAssignAST variableDecAssign)
 {
 }