コード例 #1
0
 public AttributeBlockNode(Token token,
                           AttributeTargets location,
                           ParseNodeList attributes)
     : base(ParseNodeType.AttributeBlock, token) {
     _location = location;
     _attributes = GetParentedNodeList(attributes);
 }
コード例 #2
0
 public SwitchSectionNode(Token token,
                          ParseNodeList labels,
                          ParseNodeList statements)
     : base(ParseNodeType.SwitchSection, token) {
     _labels = GetParentedNodeList(labels);
     _statements = GetParentedNodeList(statements);
 }
コード例 #3
0
 public ConstantFieldDeclarationNode(Token token,
                                     ParseNodeList attributes,
                                     Modifiers modifiers,
                                     ParseNode type,
                                     ParseNodeList initializers)
     : base(ParseNodeType.ConstFieldDeclaration, token, attributes, modifiers, type, initializers, false) {
 }
コード例 #4
0
        public EnumerationFieldNode(ParseNodeList attributes, AtomicNameNode name,
                                    ParseNode value)
            : base(ParseNodeType.EnumerationFieldDeclaration, name.token) {
            _attributes = GetParentedNodeList(AttributeNode.GetAttributeList(attributes));
            _name = (AtomicNameNode)GetParentedNode(name);

            if (value is LiteralNode) {
                LiteralNode literalNode = (LiteralNode)value;
                _value = ((LiteralToken)literalNode.Token).LiteralValue;
            }
            else {
                // TODO: Clearly we need something more general...
                //       C# allows expressions. Likely expressions to be used
                //       include negative values, binary OR'd values,
                //       expressions involving other enum members (esp. hard to deal with)
                // For now, just adding support for negative numbers, as
                // everything else can be worked around in source code.

                UnaryExpressionNode expressionNode = value as UnaryExpressionNode;
                if ((expressionNode != null) && (expressionNode.Operator == TokenType.Minus) &&
                    (expressionNode.Child is LiteralNode)) {

                    try {
                        LiteralToken literalToken =
                            (LiteralToken)((LiteralNode)expressionNode.Child).Token;
                        int numericValue = (int)Convert.ChangeType(literalToken.LiteralValue, typeof(int));

                        _value = -numericValue;
                    }
                    catch {
                    }
                }
            }
        }
コード例 #5
0
 public TypeParameterConstraintNode(AtomicNameNode typeParameter, ParseNodeList typeConstraints,
                             bool hasConstructorConstraint)
     : base(ParseNodeType.ConstraintClause, typeParameter.token) {
     _typeParameter = typeParameter;
     _typeConstraints = typeConstraints;
     _hasConstructorConstraint = hasConstructorConstraint;
 }
コード例 #6
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) {
 }
コード例 #7
0
ファイル: SwitchNode.cs プロジェクト: fugaku/scriptsharp
 public SwitchNode(Token token,
                   ParseNode condition,
                   ParseNodeList cases)
     : base(ParseNodeType.Switch, token) {
     _condition = GetParentedNode(condition);
     _cases = GetParentedNodeList(cases);
 }
コード例 #8
0
 public AttributeBlockNode(Token token,
                           AttributeTargets location,
                           ParseNodeList attributes)
     : base(ParseNodeType.AttributeBlock, token)
 {
     _location   = location;
     _attributes = GetParentedNodeList(attributes);
 }
コード例 #9
0
 public VariableDeclarationNode(Token token,
                                ParseNodeList attributes,
                                Modifiers modifiers,
                                ParseNode type,
                                ParseNodeList initializers,
                                bool isFixed)
     : this(ParseNodeType.VariableDeclaration, token, attributes, modifiers, type, initializers, isFixed) {
 }
コード例 #10
0
 public ConstantFieldDeclarationNode(Token token,
                                     ParseNodeList attributes,
                                     Modifiers modifiers,
                                     ParseNode type,
                                     ParseNodeList initializers)
     : base(ParseNodeType.ConstFieldDeclaration, token, attributes, modifiers, type, initializers, false)
 {
 }
コード例 #11
0
 public SwitchNode(Token token,
                   ParseNode condition,
                   ParseNodeList cases)
     : base(ParseNodeType.Switch, token)
 {
     _condition = GetParentedNode(condition);
     _cases     = GetParentedNodeList(cases);
 }
コード例 #12
0
 public SwitchSectionNode(Token token,
                          ParseNodeList labels,
                          ParseNodeList statements)
     : base(ParseNodeType.SwitchSection, token)
 {
     _labels     = GetParentedNodeList(labels);
     _statements = GetParentedNodeList(statements);
 }
コード例 #13
0
ファイル: NamespaceNode.cs プロジェクト: fugaku/scriptsharp
 public NamespaceNode(Token token, string name,
                      ParseNodeList usingClauses,
                      ParseNodeList members)
     : base(ParseNodeType.Namespace, token) {
     _name = name;
     _usingClauses = GetParentedNodeList(usingClauses);
     _members = GetParentedNodeList(members);
 }
コード例 #14
0
 public TypeParameterConstraintNode(AtomicNameNode typeParameter, ParseNodeList typeConstraints,
                                    bool hasConstructorConstraint)
     : base(ParseNodeType.ConstraintClause, typeParameter.token)
 {
     _typeParameter            = typeParameter;
     _typeConstraints          = typeConstraints;
     _hasConstructorConstraint = hasConstructorConstraint;
 }
コード例 #15
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)
 {
 }
コード例 #16
0
 public NamespaceNode(Token token, string name,
                      ParseNodeList usingClauses,
                      ParseNodeList members)
     : base(ParseNodeType.Namespace, token)
 {
     _name         = name;
     _usingClauses = GetParentedNodeList(usingClauses);
     _members      = GetParentedNodeList(members);
 }
コード例 #17
0
        private void Visit(ParseNode node, PropertyInfo propertyInfo)
        {
            string name  = propertyInfo.Name;
            object value = propertyInfo.GetValue(node, null);

            string text = name + " (" + propertyInfo.PropertyType.Name + ")";

            if (value != null)
            {
                if (value is ParseNodeList)
                {
                    ParseNodeList nodeList = (ParseNodeList)value;

                    if (nodeList.Count == 0)
                    {
                        text += " : Empty";
                    }
                    else
                    {
                        text += " : " + nodeList.Count.ToString();
                    }

                    StartChildren(text);
                    foreach (ParseNode nodeItem in nodeList)
                    {
                        Visit(nodeItem);
                    }
                    EndChildren();
                }
                else if (value is ParseNode)
                {
                    StartChildren(text);
                    Visit((ParseNode)value);
                    EndChildren();
                }
                else
                {
                    if (value is string)
                    {
                        text += " : \"" + (string)value + "\"";
                    }
                    else
                    {
                        text += " : " + value.ToString();
                    }

                    StartChildren(text);
                    EndChildren();
                }
            }
            else
            {
                text += " : null";
                StartChildren(text);
                EndChildren();
            }
        }
コード例 #18
0
ファイル: TryNode.cs プロジェクト: fugaku/scriptsharp
 public TryNode(Token token,
                ParseNode body,
                ParseNodeList catchClauses,
                ParseNode finallyClause)
     : base(ParseNodeType.Try, token) {
     _body = GetParentedNode(body);
     _catchClauses = GetParentedNodeList(catchClauses);
     _finallyClause = GetParentedNode(finallyClause);
 }
コード例 #19
0
 public FieldDeclarationNode(Token token,
                             ParseNodeList attributes,
                             Modifiers modifiers,
                             ParseNode type,
                             ParseNodeList initializers,
                             bool isFixed)
     : this(ParseNodeType.FieldDeclaration, token, attributes, modifiers, type, initializers, isFixed)
 {
 }
コード例 #20
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;
 }
コード例 #21
0
ファイル: NamespaceNode.cs プロジェクト: fugaku/scriptsharp
 public NamespaceNode(Token token, NameNode nameNode,
                      ParseNodeList externAliases,
                      ParseNodeList usingClauses,
                      ParseNodeList members)
     : base(ParseNodeType.Namespace, token) {
     _name = nameNode.Name;
     _externAliases = GetParentedNodeList(externAliases);
     _usingClauses = GetParentedNodeList(usingClauses);
     _members = GetParentedNodeList(members);
 }
コード例 #22
0
 public TryNode(Token token,
                ParseNode body,
                ParseNodeList catchClauses,
                ParseNode finallyClause)
     : base(ParseNodeType.Try, token)
 {
     _body          = GetParentedNode(body);
     _catchClauses  = GetParentedNodeList(catchClauses);
     _finallyClause = GetParentedNode(finallyClause);
 }
コード例 #23
0
 public NamespaceNode(Token token, NameNode nameNode,
                      ParseNodeList externAliases,
                      ParseNodeList usingClauses,
                      ParseNodeList members)
     : base(ParseNodeType.Namespace, token)
 {
     _name          = nameNode.Name;
     _externAliases = GetParentedNodeList(externAliases);
     _usingClauses  = GetParentedNodeList(usingClauses);
     _members       = GetParentedNodeList(members);
 }
コード例 #24
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;
 }
コード例 #25
0
 public CompilationUnitNode(Token token,
                            ParseNodeList externAliases,
                            ParseNodeList usingClauses,
                            ParseNodeList attributes,
                            ParseNodeList members)
     : base(ParseNodeType.CompilationUnit, token) {
     _externAliases = GetParentedNodeList(externAliases);
     _usingClauses = GetParentedNodeList(usingClauses);
     _attributes = GetParentedNodeList(attributes);
     _members = GetParentedNodeList(GetNamespaces(members));
 }
コード例 #26
0
 public PropertyDeclarationNode(Token token,
                                ParseNodeList attributes,
                                Modifiers modifiers,
                                ParseNode type,
                                NameNode interfaceType,
                                AtomicNameNode name,
                                AccessorNode getOrRemove,
                                AccessorNode setOrAdd)
     : this(ParseNodeType.PropertyDeclaration, token, attributes, modifiers, type, interfaceType, getOrRemove, setOrAdd) {
     _name = (AtomicNameNode)GetParentedNode(name);
 }
コード例 #27
0
ファイル: ParameterNode.cs プロジェクト: fugaku/scriptsharp
 public ParameterNode(Token token,
                            ParseNodeList attributes,
                            ParameterFlags flags,
                            ParseNode type,
                            AtomicNameNode name)
     : base(ParseNodeType.FormalParameter, token) {
     _attributes = GetParentedNodeList(AttributeNode.GetAttributeList(attributes));
     _flags = flags;
     _type = GetParentedNode(type);
     _name = (AtomicNameNode)GetParentedNode(name);
 }
コード例 #28
0
ファイル: AccessorNode.cs プロジェクト: fugaku/scriptsharp
 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;
 }
コード例 #29
0
 public CompilationUnitNode(Token token,
                            ParseNodeList externAliases,
                            ParseNodeList usingClauses,
                            ParseNodeList attributes,
                            ParseNodeList members)
     : base(ParseNodeType.CompilationUnit, token)
 {
     _externAliases = GetParentedNodeList(externAliases);
     _usingClauses  = GetParentedNodeList(usingClauses);
     _attributes    = GetParentedNodeList(attributes);
     _members       = GetParentedNodeList(GetNamespaces(members));
 }
コード例 #30
0
 public DelegateTypeNode(Token token,
                         ParseNodeList attributes,
                         Modifiers modifiers,
                         ParseNode returnType,
                         AtomicNameNode name,
                         ParseNodeList typeParameters,
                         ParseNodeList parameters,
                         ParseNodeList constraintClauses)
     : base(ParseNodeType.Delegate, token, TokenType.Delegate, attributes, modifiers, name, typeParameters, constraintClauses) {
     _returnType = GetParentedNode(returnType);
     _parameters = GetParentedNodeList(parameters);
 }
コード例 #31
0
 public IndexerDeclarationNode(Token token,
                               ParseNodeList attributes,
                               Modifiers modifiers,
                               ParseNode type,
                               NameNode interfaceType,
                               ParseNodeList parameters,
                               AccessorNode get,
                               AccessorNode set)
     : base(ParseNodeType.IndexerDeclaration, token, attributes, modifiers, type, interfaceType, get, set)
 {
     _parameters = GetParentedNodeList(parameters);
 }
コード例 #32
0
 public IndexerDeclarationNode(Token token,
                               ParseNodeList attributes,
                               Modifiers modifiers,
                               ParseNode type,
                               NameNode interfaceType,
                               ParseNodeList parameters,
                               AccessorNode get,
                               AccessorNode set)
     : base(ParseNodeType.IndexerDeclaration, token, attributes, modifiers, type, interfaceType, get, set)
 {
     _parameters = GetParentedNodeList(parameters);
 }
コード例 #33
0
ファイル: CustomTypeNode.cs プロジェクト: fugaku/scriptsharp
 public CustomTypeNode(Token token, TokenType type,
                       ParseNodeList attributes,
                       Modifiers modifiers,
                       AtomicNameNode name,
                       ParseNodeList typeParameters,
                       ParseNodeList baseTypes,
                       ParseNodeList constraintClauses,
                       ParseNodeList members)
     : base(ParseNodeType.Type, token, type, attributes, modifiers, name, typeParameters, constraintClauses) {
     _baseTypes = GetParentedNodeList(baseTypes);
     _members = GetParentedNodeList(members);
 }
コード例 #34
0
 public ParameterNode(Token token,
                      ParseNodeList attributes,
                      ParameterFlags flags,
                      ParseNode type,
                      AtomicNameNode name)
     : base(ParseNodeType.FormalParameter, token)
 {
     _attributes = GetParentedNodeList(AttributeNode.GetAttributeList(attributes));
     _flags      = flags;
     _type       = GetParentedNode(type);
     _name       = (AtomicNameNode)GetParentedNode(name);
 }
コード例 #35
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;
 }
コード例 #36
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);
 }
コード例 #37
0
 public PropertyDeclarationNode(Token token,
                                ParseNodeList attributes,
                                Modifiers modifiers,
                                ParseNode type,
                                NameNode interfaceType,
                                AtomicNameNode name,
                                AccessorNode getOrRemove,
                                AccessorNode setOrAdd)
     : this(ParseNodeType.PropertyDeclaration, token, attributes, modifiers, type, interfaceType, getOrRemove, setOrAdd)
 {
     _name = (AtomicNameNode)GetParentedNode(name);
 }
コード例 #38
0
ファイル: NamespaceNode.cs プロジェクト: fugaku/scriptsharp
        internal void IncludeCompilationUnitUsingClauses() {
            CompilationUnitNode compilationUnit = (CompilationUnitNode)parent;
            if (compilationUnit.UsingClauses.Count != 0) {
                ParseNodeList mergedUsings = new ParseNodeList();
                mergedUsings.Append(compilationUnit.UsingClauses);

                if (_usingClauses.Count != 0) {
                    mergedUsings.Append(_usingClauses);
                }

                _usingClauses = GetParentedNodeList(mergedUsings);
            }
        }
コード例 #39
0
 protected FieldDeclarationNode(ParseNodeType nodeType, Token token,
                                ParseNodeList attributes,
                                Modifiers modifiers,
                                ParseNode type,
                                ParseNodeList initializers,
                                bool isFixed)
     : base(nodeType, token) {
     _attributes = GetParentedNodeList(AttributeNode.GetAttributeList(attributes));
     _modifiers = modifiers;
     _type = GetParentedNode(type);
     _initializers = GetParentedNodeList(initializers);
     _isFixed = isFixed;
 }
コード例 #40
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);
 }
コード例 #41
0
 protected VariableDeclarationNode(ParseNodeType nodeType, Token token,
                                   ParseNodeList attributes,
                                   Modifiers modifiers,
                                   ParseNode type,
                                   ParseNodeList initializers,
                                   bool isFixed)
     : base(nodeType, token) {
     this.attributes = GetParentedNodeList(attributes);
     this.modifiers = modifiers;
     this.type = GetParentedNode(type);
     this.initializers = GetParentedNodeList(initializers);
     this.isFixed = isFixed;
 }
コード例 #42
0
 public CustomTypeNode(Token token, TokenType type,
                       ParseNodeList attributes,
                       Modifiers modifiers,
                       AtomicNameNode name,
                       ParseNodeList typeParameters,
                       ParseNodeList baseTypes,
                       ParseNodeList constraintClauses,
                       ParseNodeList members)
     : base(ParseNodeType.Type, token, type, attributes, modifiers, name, typeParameters, constraintClauses)
 {
     _baseTypes = GetParentedNodeList(baseTypes);
     _members   = GetParentedNodeList(members);
 }
コード例 #43
0
ファイル: AttributeNode.cs プロジェクト: fugaku/scriptsharp
        public static AttributeNode FindAttribute(ParseNodeList attributeNodes, string attributeName) {
            if ((attributeNodes == null) || (attributeNodes.Count == 0)) {
                return null;
            }

            foreach (AttributeNode attrNode in attributeNodes) {
                if (attrNode.TypeName.Equals(attributeName, StringComparison.Ordinal)) {
                    return attrNode;
                }
            }

            return null;
        }
コード例 #44
0
 protected VariableDeclarationNode(ParseNodeType nodeType, Token token,
                                   ParseNodeList attributes,
                                   Modifiers modifiers,
                                   ParseNode type,
                                   ParseNodeList initializers,
                                   bool isFixed)
     : base(nodeType, token)
 {
     this.attributes   = GetParentedNodeList(attributes);
     this.modifiers    = modifiers;
     this.type         = GetParentedNode(type);
     this.initializers = GetParentedNodeList(initializers);
     this.isFixed      = isFixed;
 }
コード例 #45
0
 protected FieldDeclarationNode(ParseNodeType nodeType, Token token,
                                ParseNodeList attributes,
                                Modifiers modifiers,
                                ParseNode type,
                                ParseNodeList initializers,
                                bool isFixed)
     : base(nodeType, token)
 {
     _attributes   = GetParentedNodeList(AttributeNode.GetAttributeList(attributes));
     _modifiers    = modifiers;
     _type         = GetParentedNode(type);
     _initializers = GetParentedNodeList(initializers);
     _isFixed      = isFixed;
 }
コード例 #46
0
ファイル: UserTypeNode.cs プロジェクト: fugaku/scriptsharp
 public UserTypeNode(ParseNodeType type, Token token, TokenType tokenType,
                     ParseNodeList attributes,
                     Modifiers modifiers,
                     AtomicNameNode name,
                     ParseNodeList typeParameters,
                     ParseNodeList constraintClauses)
     : base(type, token) {
     _type = tokenType;
     _attributes = GetParentedNodeList(AttributeNode.GetAttributeList(attributes));
     _modifiers = modifiers;
     _nameNode = name;
     _typeParameters = GetParentedNodeList(typeParameters);
     _constraintClauses = GetParentedNodeList(constraintClauses);
 }
コード例 #47
0
 protected PropertyDeclarationNode(ParseNodeType nodeType, Token token,
                                   ParseNodeList attributes,
                                   Modifiers modifiers,
                                   ParseNode type,
                                   NameNode interfaceType,
                                   AccessorNode getOrRemove,
                                   AccessorNode setOrAdd)
     : base(nodeType, token) {
     _attributes = GetParentedNodeList(AttributeNode.GetAttributeList(attributes));
     _modifiers = modifiers;
     _type = GetParentedNode(type);
     _interfaceType = (NameNode)GetParentedNode(interfaceType);
     _getOrRemove = (AccessorNode)GetParentedNode(getOrRemove);
     _setOrAdd = (AccessorNode)GetParentedNode(setOrAdd);
 }
コード例 #48
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);
 }
コード例 #49
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);
 }
コード例 #50
0
ファイル: AttributeNode.cs プロジェクト: fugaku/scriptsharp
        public static ParseNodeList GetAttributeList(ParseNodeList attributeBlocks) {
            if ((attributeBlocks == null)  || (attributeBlocks.Count == 0)) {
                return attributeBlocks;
            }

            ParseNodeList attributes = new ParseNodeList();
            foreach (AttributeBlockNode attributeBlock in attributeBlocks) {
                ParseNodeList localAttributes = attributeBlock.Attributes;
                if (localAttributes.Count != 0) {
                    attributes.Append(localAttributes);
                }
            }

            return attributes;
        }
コード例 #51
0
 public UserTypeNode(ParseNodeType type, Token token, TokenType tokenType,
                     ParseNodeList attributes,
                     Modifiers modifiers,
                     AtomicNameNode name,
                     ParseNodeList typeParameters,
                     ParseNodeList constraintClauses)
     : base(type, token)
 {
     _type              = tokenType;
     _attributes        = GetParentedNodeList(AttributeNode.GetAttributeList(attributes));
     _modifiers         = modifiers;
     _nameNode          = name;
     _typeParameters    = GetParentedNodeList(typeParameters);
     _constraintClauses = GetParentedNodeList(constraintClauses);
 }
コード例 #52
0
ファイル: ScriptCompiler.cs プロジェクト: fugaku/scriptsharp
        private void BuildCodeModel() {
            _compilationUnitList = new ParseNodeList();

            CodeModelBuilder codeModelBuilder = new CodeModelBuilder(_options, this);
            CodeModelValidator codeModelValidator = new CodeModelValidator(this);
            CodeModelProcessor validationProcessor = new CodeModelProcessor(codeModelValidator, _options);

            foreach (IStreamSource source in _options.Sources) {
                CompilationUnitNode compilationUnit = codeModelBuilder.BuildCodeModel(source);
                if (compilationUnit != null) {
                    validationProcessor.Process(compilationUnit);

                    _compilationUnitList.Append(compilationUnit);
                }
            }
        }
コード例 #53
0
 protected PropertyDeclarationNode(ParseNodeType nodeType, Token token,
                                   ParseNodeList attributes,
                                   Modifiers modifiers,
                                   ParseNode type,
                                   NameNode interfaceType,
                                   AccessorNode getOrRemove,
                                   AccessorNode setOrAdd)
     : base(nodeType, token)
 {
     _attributes    = GetParentedNodeList(AttributeNode.GetAttributeList(attributes));
     _modifiers     = modifiers;
     _type          = GetParentedNode(type);
     _interfaceType = (NameNode)GetParentedNode(interfaceType);
     _getOrRemove   = (AccessorNode)GetParentedNode(getOrRemove);
     _setOrAdd      = (AccessorNode)GetParentedNode(setOrAdd);
 }
コード例 #54
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);
 }
コード例 #55
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);
 }
コード例 #56
0
        public static AttributeNode FindAttribute(ParseNodeList attributeNodes, string attributeName)
        {
            if ((attributeNodes == null) || (attributeNodes.Count == 0))
            {
                return(null);
            }

            foreach (AttributeNode attrNode in attributeNodes)
            {
                if (attrNode.TypeName.Equals(attributeName, StringComparison.Ordinal))
                {
                    return(attrNode);
                }
            }

            return(null);
        }
コード例 #57
0
        internal void IncludeCompilationUnitUsingClauses()
        {
            CompilationUnitNode compilationUnit = (CompilationUnitNode)parent;

            if (compilationUnit.UsingClauses.Count != 0)
            {
                ParseNodeList mergedUsings = new ParseNodeList();
                mergedUsings.Append(compilationUnit.UsingClauses);

                if (_usingClauses.Count != 0)
                {
                    mergedUsings.Append(_usingClauses);
                }

                _usingClauses = GetParentedNodeList(mergedUsings);
            }
        }
コード例 #58
0
        public static ParseNodeList GetAttributeList(ParseNodeList attributeBlocks)
        {
            if ((attributeBlocks == null) || (attributeBlocks.Count == 0))
            {
                return(attributeBlocks);
            }

            ParseNodeList attributes = new ParseNodeList();

            foreach (AttributeBlockNode attributeBlock in attributeBlocks)
            {
                ParseNodeList localAttributes = attributeBlock.Attributes;
                if (localAttributes.Count != 0)
                {
                    attributes.Append(localAttributes);
                }
            }

            return(attributes);
        }
コード例 #59
0
        private ParseNodeList GetNamespaces(ParseNodeList members)
        {
            ParseNodeList namespaceList = new ParseNodeList();

            foreach (ParseNode memberNode in members)
            {
                NamespaceNode namespaceNode = memberNode as NamespaceNode;

                if (namespaceNode == null)
                {
                    // Top-level type nodes are turned into children of a namespace with
                    // an empty name.

                    Token nsToken = new Token(TokenType.Namespace, memberNode.Token.SourcePath, memberNode.Token.Position);
                    namespaceNode = new NamespaceNode(nsToken, String.Empty, _usingClauses, new ParseNodeList(memberNode));
                }

                namespaceList.Append(namespaceNode);
            }

            return(namespaceList);
        }