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 { } } } }
public TypeParameterConstraintNode(AtomicNameNode typeParameter, ParseNodeList typeConstraints, bool hasConstructorConstraint) : base(ParseNodeType.ConstraintClause, typeParameter.token) { _typeParameter = typeParameter; _typeConstraints = typeConstraints; _hasConstructorConstraint = hasConstructorConstraint; }
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) { }
public CatchNode(Token token, ParseNode type, AtomicNameNode name, ParseNode body) : base(ParseNodeType.Catch, token) { _type = GetParentedNode(type); _name = (AtomicNameNode)GetParentedNode(name); _body = GetParentedNode(body); }
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 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); }
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); }
public ForeachNode(Token token, ParseNode type, AtomicNameNode name, ParseNode container, ParseNode body) : base(ParseNodeType.Foreach, token) { _type = GetParentedNode(type); _name = (AtomicNameNode)GetParentedNode(name); _container = GetParentedNode(container); _body = GetParentedNode(body); }
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); }
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 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); }
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); }
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); }
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); }
public ExternAliasNode(Token token, AtomicNameNode aliasName) : base(ParseNodeType.ExternAlias, token) { _aliasName = (AtomicNameNode)GetParentedNode(aliasName); }
public TypeParameterNode(ParseNodeList attributes, AtomicNameNode name) : base(ParseNodeType.TypeParameter, name.token) { _attributes = attributes; _name = name; }
public UsingAliasNode(Token token, AtomicNameNode name, NameNode type) : base(ParseNodeType.UsingAlias, token) { _aliasName = (AtomicNameNode)GetParentedNode(name); _typeName = (NameNode)GetParentedNode(type); }
public AliasQualifiedNameNode(AtomicNameNode left, NameNode right) : base(ParseNodeType.AliasQualifiedName, left.token) { _aliasName = (AtomicNameNode)GetParentedNode(left); _name = (NameNode)GetParentedNode(right); }
public VariableInitializerNode(AtomicNameNode name, ParseNode value) : base(ParseNodeType.VariableDeclarator, name.token) { _name = (AtomicNameNode)GetParentedNode(name); _value = GetParentedNode(value); }
public LabeledStatementNode(AtomicNameNode label, ParseNode statement) : base(ParseNodeType.LabeledStatement, label.token) { _label = (AtomicNameNode)GetParentedNode(label); _statement = GetParentedNode(statement); }