public DestructorDeclarationNode(Token token,
                                  ParseNodeList attributes,
                                  Modifiers modifiers,
                                  AtomicNameNode name,
                                  BlockStatementNode body)
     : base(ParseNodeType.DestructorDeclaration, token, attributes, modifiers, /* return type */ null, name, new ParseNodeList(), body) {
 }
Пример #2
0
 public DestructorDeclarationNode(Token token,
                                  ParseNodeList attributes,
                                  Modifiers modifiers,
                                  AtomicNameNode name,
                                  BlockStatementNode body)
     : base(ParseNodeType.DestructorDeclaration, token, attributes, modifiers, /* return type */ null, name, new ParseNodeList(), body)
 {
 }
Пример #3
0
 public OperatorDeclarationNode(Token token,
                                ParseNodeList attributes,
                                Modifiers modifiers,
                                TokenType operatorNodeType,
                                ParseNode returnType,
                                ParseNodeList formals,
                                BlockStatementNode body)
     : base(ParseNodeType.OperatorDeclaration, token, attributes, modifiers, returnType, /* name */ null, formals, body) {
     this.operatorTokenType = operatorNodeType;
 }
Пример #4
0
        private SymbolImplementation BuildImplementation(ISymbolTable symbolTable, CodeMemberSymbol symbolContext, BlockStatementNode implementationNode, bool addAllParameters) {
            _rootScope = new SymbolScope(symbolTable);
            _currentScope = _rootScope;

            List<Statement> statements = new List<Statement>();
            StatementBuilder statementBuilder = new StatementBuilder(this, symbolContext, _errorHandler, _options);

            if (symbolContext.Parameters != null) {
                int parameterCount = symbolContext.Parameters.Count;
                if (addAllParameters == false) {
                    // For property getters (including indexers), we don't add the last parameter,
                    // which happens to be the "value" parameter, which only makes sense
                    // for the setter.

                    parameterCount--;
                }
                for (int paramIndex = 0; paramIndex < parameterCount; paramIndex++) {
                    _currentScope.AddSymbol(symbolContext.Parameters[paramIndex]);
                }
            }

            if ((symbolContext.Type == SymbolType.Constructor) &&
                ((((ConstructorSymbol)symbolContext).Visibility & MemberVisibility.Static) == 0)) {
                Debug.Assert(symbolContext.Parent is ClassSymbol);
                if (((ClassSymbol)symbolContext.Parent).BaseClass != null) {
                    BaseInitializerExpression baseExpr = new BaseInitializerExpression();

                    ConstructorDeclarationNode ctorNode = (ConstructorDeclarationNode)symbolContext.ParseContext;
                    if (ctorNode.BaseArguments != null) {
                        ExpressionBuilder expressionBuilder =
                            new ExpressionBuilder(this, symbolContext, _errorHandler, _options);

                        Debug.Assert(ctorNode.BaseArguments is ExpressionListNode);
                        ICollection<Expression> args =
                            expressionBuilder.BuildExpressionList((ExpressionListNode)ctorNode.BaseArguments);

                        foreach (Expression paramExpr in args) {
                            baseExpr.AddParameterValue(paramExpr);
                        }
                    }

                    statements.Add(new ExpressionStatement(baseExpr));
                }
            }

            foreach (StatementNode statementNode in implementationNode.Statements) {
                Statement statement = statementBuilder.BuildStatement(statementNode);
                if (statement != null) {
                    statements.Add(statement);
                }
            }

            return new SymbolImplementation(statements, _rootScope);
        }
Пример #5
0
 public OperatorDeclarationNode(Token token,
                                ParseNodeList attributes,
                                Modifiers modifiers,
                                TokenType operatorNodeType,
                                ParseNode returnType,
                                ParseNodeList formals,
                                BlockStatementNode body)
     : base(ParseNodeType.OperatorDeclaration, token, attributes, modifiers, returnType, /* name */ null, formals, body)
 {
     this.operatorTokenType = operatorNodeType;
 }
Пример #6
0
 public AccessorNode(Token token,
                     ParseNodeList attributes,
                     AtomicNameNode name,
                     BlockStatementNode body,
                     Modifiers modifiers)
     : base(ParseNodeType.AccessorDeclaration, token) {
     _name = (AtomicNameNode)GetParentedNode(name);
     _implementation = (BlockStatementNode)GetParentedNode(body);
     _attributes = GetParentedNodeList(attributes);
     _modifiers = modifiers;
 }
 public ConstructorDeclarationNode(Token token,
                                   ParseNodeList attributes,
                                   Modifiers modifiers,
                                   AtomicNameNode name,
                                   ParseNodeList formals,
                                   bool callBase,
                                   ParseNode baseArguments,
                                   BlockStatementNode body)
     : base(ParseNodeType.ConstructorDeclaration, token, attributes, modifiers, /* return type */ null, name, formals, body) {
     _callBase = callBase;
     _baseArguments = GetParentedNode(baseArguments);
 }
 public AccessorNode(Token token,
                     ParseNodeList attributes,
                     AtomicNameNode name,
                     BlockStatementNode body,
                     Modifiers modifiers)
     : base(ParseNodeType.AccessorDeclaration, token)
 {
     _name           = (AtomicNameNode)GetParentedNode(name);
     _implementation = (BlockStatementNode)GetParentedNode(body);
     _attributes     = GetParentedNodeList(attributes);
     _modifiers      = modifiers;
 }
Пример #9
0
 public ConstructorDeclarationNode(Token token,
                                   ParseNodeList attributes,
                                   Modifiers modifiers,
                                   AtomicNameNode name,
                                   ParseNodeList formals,
                                   bool callBase,
                                   ParseNode baseArguments,
                                   BlockStatementNode body)
     : base(ParseNodeType.ConstructorDeclaration, token, attributes, modifiers, /* return type */ null, name, formals, body)
 {
     _callBase      = callBase;
     _baseArguments = GetParentedNode(baseArguments);
 }
Пример #10
0
 protected MethodDeclarationNode(ParseNodeType nodeType, Token token,
                                 ParseNodeList attributes,
                                 Modifiers modifiers,
                                 ParseNode returnType,
                                 AtomicNameNode name,
                                 ParseNodeList formals,
                                 BlockStatementNode body)
     : base(nodeType, token) {
     _attributes = GetParentedNodeList(AttributeNode.GetAttributeList(attributes));
     _modifiers = modifiers;
     _returnType = GetParentedNode(returnType);
     _name = (AtomicNameNode)GetParentedNode(name);
     _parameters = GetParentedNodeList(formals);
     _implementation = (BlockStatementNode)GetParentedNode(body);
 }
Пример #11
0
 public MethodDeclarationNode(Token token,
                              ParseNodeList attributes,
                              Modifiers modifiers,
                              ParseNode returnType,
                              NameNode interfaceType,
                              AtomicNameNode name,
                              ParseNodeList typeParameters,
                              ParseNodeList formals,
                              ParseNodeList constraints,
                              BlockStatementNode body)
     : this(ParseNodeType.MethodDeclaration, token, attributes, modifiers, returnType, name, formals, body) {
     _interfaceType = (NameNode)GetParentedNode(interfaceType);
     _typeParameters = GetParentedNodeList(typeParameters);
     _constraints = GetParentedNodeList(constraints);
 }
Пример #12
0
 protected MethodDeclarationNode(ParseNodeType nodeType, Token token,
                                 ParseNodeList attributes,
                                 Modifiers modifiers,
                                 ParseNode returnType,
                                 AtomicNameNode name,
                                 ParseNodeList formals,
                                 BlockStatementNode body)
     : base(nodeType, token)
 {
     _attributes     = GetParentedNodeList(AttributeNode.GetAttributeList(attributes));
     _modifiers      = modifiers;
     _returnType     = GetParentedNode(returnType);
     _name           = (AtomicNameNode)GetParentedNode(name);
     _parameters     = GetParentedNodeList(formals);
     _implementation = (BlockStatementNode)GetParentedNode(body);
 }
Пример #13
0
 public MethodDeclarationNode(Token token,
                              ParseNodeList attributes,
                              Modifiers modifiers,
                              ParseNode returnType,
                              NameNode interfaceType,
                              AtomicNameNode name,
                              ParseNodeList typeParameters,
                              ParseNodeList formals,
                              ParseNodeList constraints,
                              BlockStatementNode body)
     : this(ParseNodeType.MethodDeclaration, token, attributes, modifiers, returnType, name, formals, body)
 {
     _interfaceType  = (NameNode)GetParentedNode(interfaceType);
     _typeParameters = GetParentedNodeList(typeParameters);
     _constraints    = GetParentedNodeList(constraints);
 }
Пример #14
0
        private Statement ProcessBlockStatement(BlockStatementNode node)
        {
            BlockStatement statement = new BlockStatement();

            _symbolTable.PushScope();

            foreach (StatementNode childStatementNode in node.Statements) {
                Statement childStatement = BuildStatement(childStatementNode);
                if (childStatement != null) {
                    statement.AddStatement(childStatement);
                }
            }

            _symbolTable.PopScope();

            return statement;
        }
Пример #15
0
 public AnonymousMethodNode(Token token, ParseNodeList parameterList, BlockStatementNode block)
     : base(ParseNodeType.AnonymousMethod, token) {
     _parameterList = GetParentedNodeList(parameterList);
     _block = (BlockStatementNode)GetParentedNode(block);
 }
 public AnonymousMethodNode(Token token, ParseNodeList parameterList, BlockStatementNode block)
     : base(ParseNodeType.AnonymousMethod, token)
 {
     _parameterList = GetParentedNodeList(parameterList);
     _block         = (BlockStatementNode)GetParentedNode(block);
 }
Пример #17
0
 public UncheckedNode(Token token, BlockStatementNode body)
     : base(ParseNodeType.Unchecked, token)
 {
     _body = (BlockStatementNode)GetParentedNode(body);
 }
Пример #18
0
 public CheckedNode(Token token, BlockStatementNode body)
     : base(ParseNodeType.Checked, token) {
     _body = (BlockStatementNode)GetParentedNode(body);
 }