Exemple #1
0
        public override AstNode Visit(LocalVariablesDeclaration node)
        {
            // Get the declarations.
            AstNode declarations = node.GetDeclarations();

            // Visit them.
            VisitList(declarations);

            return node;
        }
Exemple #2
0
        public override AstNode Visit(LocalVariablesDeclaration node)
        {
            // Get the type expression and the variables.
            Expression typeExpression = node.GetTypeExpression();
            AstNode variable = node.GetDeclarations();

            // Visit the type expression.
            typeExpression.Accept(this);

            // Check the type.
            IChelaType type = typeExpression.GetNodeType();
            type = ExtractActualType(typeExpression, type);

            // Class/interfaces instances are held by reference.
            if(type.IsPassedByReference())
                type = ReferenceType.Create(type);
            node.SetNodeType(type);

            // Set the variables types, and visit them.
            while(variable != null)
            {
                // Set the variable type.
                variable.SetNodeType(type);

                // Visit the variable.
                variable.Accept(this);

                // Process the next variable.
                variable = variable.GetNext();
            }

            return node;
        }