本文整理汇总了C#中ScriptSharp.CodeModel.ParseNodeList类的典型用法代码示例。如果您正苦于以下问题:C# ParseNodeList类的具体用法?C# ParseNodeList怎么用?C# ParseNodeList使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。
ParseNodeList类属于ScriptSharp.CodeModel命名空间,在下文中一共展示了ParseNodeList类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: EnumerationFieldNode
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 {
}
}
}
}
示例2: SwitchNode
public SwitchNode(Token token,
ParseNode condition,
ParseNodeList cases)
: base(ParseNodeType.Switch, token) {
_condition = GetParentedNode(condition);
_cases = GetParentedNodeList(cases);
}
示例3: ConstantFieldDeclarationNode
public ConstantFieldDeclarationNode(Token token,
ParseNodeList attributes,
Modifiers modifiers,
ParseNode type,
ParseNodeList initializers)
: base(ParseNodeType.ConstFieldDeclaration, token, attributes, modifiers, type, initializers, false) {
}
示例4: DestructorDeclarationNode
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) {
}
示例5: SwitchSectionNode
public SwitchSectionNode(Token token,
ParseNodeList labels,
ParseNodeList statements)
: base(ParseNodeType.SwitchSection, token) {
_labels = GetParentedNodeList(labels);
_statements = GetParentedNodeList(statements);
}
示例6: TypeParameterConstraintNode
public TypeParameterConstraintNode(AtomicNameNode typeParameter, ParseNodeList typeConstraints,
bool hasConstructorConstraint)
: base(ParseNodeType.ConstraintClause, typeParameter.token) {
_typeParameter = typeParameter;
_typeConstraints = typeConstraints;
_hasConstructorConstraint = hasConstructorConstraint;
}
示例7: AttributeBlockNode
public AttributeBlockNode(Token token,
AttributeTargets location,
ParseNodeList attributes)
: base(ParseNodeType.AttributeBlock, token) {
_location = location;
_attributes = GetParentedNodeList(attributes);
}
示例8: NamespaceNode
public NamespaceNode(Token token, string name,
ParseNodeList usingClauses,
ParseNodeList members)
: base(ParseNodeType.Namespace, token) {
_name = name;
_usingClauses = GetParentedNodeList(usingClauses);
_members = GetParentedNodeList(members);
}
示例9: VariableDeclarationNode
public VariableDeclarationNode(Token token,
ParseNodeList attributes,
Modifiers modifiers,
ParseNode type,
ParseNodeList initializers,
bool isFixed)
: this(ParseNodeType.VariableDeclaration, token, attributes, modifiers, type, initializers, isFixed) {
}
示例10: TryNode
public TryNode(Token token,
ParseNode body,
ParseNodeList catchClauses,
ParseNode finallyClause)
: base(ParseNodeType.Try, token) {
_body = GetParentedNode(body);
_catchClauses = GetParentedNodeList(catchClauses);
_finallyClause = GetParentedNode(finallyClause);
}
示例11: OperatorDeclarationNode
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;
}
示例12: PropertyDeclarationNode
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);
}
示例13: AccessorNode
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;
}
示例14: ParameterNode
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);
}
示例15: CompilationUnitNode
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));
}