//------------------------------------------------------------------------------ // // This code was generated by a tool. // Runtime Version:2.0.50727.1433 // // Changes to this file may cause incorrect behavior and will be lost if // the code is regenerated. // //------------------------------------------------------------------------------ namespace ICSharpCode.NRefactory.Ast { using System; using System.Collections.Generic; public class AddHandlerStatement : Statement { Expression eventExpression; Expression handlerExpression; public Expression EventExpression { get { return eventExpression; } set { eventExpression = value ?? Expression.Null; if (!eventExpression.IsNull) eventExpression.Parent = this; } } public Expression HandlerExpression { get { return handlerExpression; } set { handlerExpression = value ?? Expression.Null; if (!handlerExpression.IsNull) handlerExpression.Parent = this; } } public AddHandlerStatement(Expression eventExpression, Expression handlerExpression) { EventExpression = eventExpression; HandlerExpression = handlerExpression; } public override object AcceptVisitor(IAstVisitor visitor, object data) { return visitor.VisitAddHandlerStatement(this, data); } public override string ToString() { return string.Format("[AddHandlerStatement EventExpression={0} HandlerExpression={1}]", EventExpression, HandlerExpression); } } public class AddressOfExpression : Expression { Expression expression; public Expression Expression { get { return expression; } set { expression = value ?? Expression.Null; if (!expression.IsNull) expression.Parent = this; } } public AddressOfExpression(Expression expression) { Expression = expression; } public override object AcceptVisitor(IAstVisitor visitor, object data) { return visitor.VisitAddressOfExpression(this, data); } public override string ToString() { return string.Format("[AddressOfExpression Expression={0}]", Expression); } } public class AnonymousMethodExpression : Expression { List parameters; BlockStatement body; bool hasParameterList; public List Parameters { get { return parameters; } set { parameters = value ?? new List(); } } public BlockStatement Body { get { return body; } set { body = value ?? BlockStatement.Null; if (!body.IsNull) body.Parent = this; } } public bool HasParameterList { get { return hasParameterList; } set { hasParameterList = value; } } public AnonymousMethodExpression() { parameters = new List(); body = BlockStatement.Null; } public override object AcceptVisitor(IAstVisitor visitor, object data) { return visitor.VisitAnonymousMethodExpression(this, data); } public override string ToString() { return string.Format("[AnonymousMethodExpression Parameters={0} Body={1} HasParameterList={2}]", GetCollectionString(Parameters), Body, HasParameterList); } } public class ArrayCreateExpression : Expression { TypeReference createType; List arguments; CollectionInitializerExpression arrayInitializer; public TypeReference CreateType { get { return createType; } set { createType = value ?? TypeReference.Null; } } public List Arguments { get { return arguments; } set { arguments = value ?? new List(); } } public CollectionInitializerExpression ArrayInitializer { get { return arrayInitializer; } set { arrayInitializer = value ?? CollectionInitializerExpression.Null; if (!arrayInitializer.IsNull) arrayInitializer.Parent = this; } } public ArrayCreateExpression(TypeReference createType) { CreateType = createType; arguments = new List(); arrayInitializer = CollectionInitializerExpression.Null; } public ArrayCreateExpression(TypeReference createType, List arguments) { CreateType = createType; Arguments = arguments; arrayInitializer = CollectionInitializerExpression.Null; } public ArrayCreateExpression(TypeReference createType, CollectionInitializerExpression arrayInitializer) { CreateType = createType; ArrayInitializer = arrayInitializer; arguments = new List(); } public bool IsImplicitlyTyped { get { return createType.IsNull || string.IsNullOrEmpty(createType.Type); } } public override object AcceptVisitor(IAstVisitor visitor, object data) { return visitor.VisitArrayCreateExpression(this, data); } public override string ToString() { return string.Format("[ArrayCreateExpression CreateType={0} Arguments={1} ArrayInitializer={2}]", CreateType, GetCollectionString(Arguments), ArrayInitializer); } } public class AssignmentExpression : Expression { Expression left; AssignmentOperatorType op; Expression right; public Expression Left { get { return left; } set { left = value ?? Expression.Null; if (!left.IsNull) left.Parent = this; } } public AssignmentOperatorType Op { get { return op; } set { op = value; } } public Expression Right { get { return right; } set { right = value ?? Expression.Null; if (!right.IsNull) right.Parent = this; } } public AssignmentExpression(Expression left, AssignmentOperatorType op, Expression right) { Left = left; Op = op; Right = right; } public override object AcceptVisitor(IAstVisitor visitor, object data) { return visitor.VisitAssignmentExpression(this, data); } public override string ToString() { return string.Format("[AssignmentExpression Left={0} Op={1} Right={2}]", Left, Op, Right); } } public class Attribute : AbstractNode { string name; List positionalArguments; List namedArguments; public string Name { get { return name; } set { name = value ?? ""; } } public List PositionalArguments { get { return positionalArguments; } set { positionalArguments = value ?? new List(); } } public List NamedArguments { get { return namedArguments; } set { namedArguments = value ?? new List(); } } public Attribute() { name = ""; positionalArguments = new List(); namedArguments = new List(); } public Attribute(string name, List positionalArguments, List namedArguments) { Name = name; PositionalArguments = positionalArguments; NamedArguments = namedArguments; } public override object AcceptVisitor(IAstVisitor visitor, object data) { return visitor.VisitAttribute(this, data); } public override string ToString() { return string.Format("[Attribute Name={0} PositionalArguments={1} NamedArguments={2}]", Name, GetCollectionString(PositionalArguments), GetCollectionString(NamedArguments)); } } public abstract class AttributedNode : AbstractNode { List attributes; Modifiers modifier; public List Attributes { get { return attributes; } set { attributes = value ?? new List(); } } public Modifiers Modifier { get { return modifier; } set { modifier = value; } } protected AttributedNode() { attributes = new List(); } protected AttributedNode(List attributes) { Attributes = attributes; } protected AttributedNode(Modifiers modifier, List attributes) { Modifier = modifier; Attributes = attributes; } } public class AttributeSection : AbstractNode { string attributeTarget; List attributes; public string AttributeTarget { get { return attributeTarget; } set { attributeTarget = value ?? ""; } } public List Attributes { get { return attributes; } set { attributes = value ?? new List(); } } public AttributeSection() { attributeTarget = ""; attributes = new List(); } public override object AcceptVisitor(IAstVisitor visitor, object data) { return visitor.VisitAttributeSection(this, data); } public override string ToString() { return string.Format("[AttributeSection AttributeTarget={0} Attributes={1}]", AttributeTarget, GetCollectionString(Attributes)); } } public class BaseReferenceExpression : Expression { public BaseReferenceExpression() { } public override object AcceptVisitor(IAstVisitor visitor, object data) { return visitor.VisitBaseReferenceExpression(this, data); } public override string ToString() { return "[BaseReferenceExpression]"; } } public class BinaryOperatorExpression : Expression { Expression left; BinaryOperatorType op; Expression right; public Expression Left { get { return left; } set { left = value ?? Expression.Null; if (!left.IsNull) left.Parent = this; } } public BinaryOperatorType Op { get { return op; } set { op = value; } } public Expression Right { get { return right; } set { right = value ?? Expression.Null; if (!right.IsNull) right.Parent = this; } } public BinaryOperatorExpression(Expression left, BinaryOperatorType op, Expression right) { Left = left; Op = op; Right = right; } public override object AcceptVisitor(IAstVisitor visitor, object data) { return visitor.VisitBinaryOperatorExpression(this, data); } public override string ToString() { return string.Format("[BinaryOperatorExpression Left={0} Op={1} Right={2}]", Left, Op, Right); } } public class BreakStatement : Statement { public BreakStatement() { } public override object AcceptVisitor(IAstVisitor visitor, object data) { return visitor.VisitBreakStatement(this, data); } public override string ToString() { return "[BreakStatement]"; } } public class CaseLabel : AbstractNode { Expression label; BinaryOperatorType binaryOperatorType; Expression toExpression; public Expression Label { get { return label; } set { label = value ?? Expression.Null; if (!label.IsNull) label.Parent = this; } } public BinaryOperatorType BinaryOperatorType { get { return binaryOperatorType; } set { binaryOperatorType = value; } } public Expression ToExpression { get { return toExpression; } set { toExpression = value ?? Expression.Null; if (!toExpression.IsNull) toExpression.Parent = this; } } public CaseLabel() { label = Expression.Null; toExpression = Expression.Null; } public CaseLabel(Expression label) { Label = label; toExpression = Expression.Null; } public CaseLabel(Expression label, Expression toExpression) { Label = label; ToExpression = toExpression; } public CaseLabel(BinaryOperatorType binaryOperatorType, Expression label) { BinaryOperatorType = binaryOperatorType; Label = label; toExpression = Expression.Null; } public bool IsDefault { get { return label.IsNull; } } public override object AcceptVisitor(IAstVisitor visitor, object data) { return visitor.VisitCaseLabel(this, data); } public override string ToString() { return string.Format("[CaseLabel Label={0} BinaryOperatorType={1} ToExpression={2}]", Label, BinaryOperatorType, ToExpression); } } public class CastExpression : Expression { TypeReference castTo; Expression expression; CastType castType; public TypeReference CastTo { get { return castTo; } set { castTo = value ?? TypeReference.Null; } } public Expression Expression { get { return expression; } set { expression = value ?? Expression.Null; if (!expression.IsNull) expression.Parent = this; } } public CastType CastType { get { return castType; } set { castType = value; } } public CastExpression(TypeReference castTo) { CastTo = castTo; expression = Expression.Null; } public CastExpression(TypeReference castTo, Expression expression, CastType castType) { CastTo = castTo; Expression = expression; CastType = castType; } public override object AcceptVisitor(IAstVisitor visitor, object data) { return visitor.VisitCastExpression(this, data); } public override string ToString() { return string.Format("[CastExpression CastTo={0} Expression={1} CastType={2}]", CastTo, Expression, CastType); } } public class CatchClause : AbstractNode { TypeReference typeReference; string variableName; Statement statementBlock; Expression condition; public TypeReference TypeReference { get { return typeReference; } set { typeReference = value ?? TypeReference.Null; } } public string VariableName { get { return variableName; } set { variableName = value ?? ""; } } public Statement StatementBlock { get { return statementBlock; } set { statementBlock = value ?? Statement.Null; if (!statementBlock.IsNull) statementBlock.Parent = this; } } public Expression Condition { get { return condition; } set { condition = value ?? Expression.Null; if (!condition.IsNull) condition.Parent = this; } } public CatchClause(TypeReference typeReference, string variableName, Statement statementBlock) { TypeReference = typeReference; VariableName = variableName; StatementBlock = statementBlock; condition = Expression.Null; } public CatchClause(TypeReference typeReference, string variableName, Statement statementBlock, Expression condition) { TypeReference = typeReference; VariableName = variableName; StatementBlock = statementBlock; Condition = condition; } public CatchClause(Statement statementBlock) { StatementBlock = statementBlock; typeReference = TypeReference.Null; variableName = ""; condition = Expression.Null; } public override object AcceptVisitor(IAstVisitor visitor, object data) { return visitor.VisitCatchClause(this, data); } public override string ToString() { return string.Format("[CatchClause TypeReference={0} VariableName={1} StatementBlock={2} Condition={3}]" + "", TypeReference, VariableName, StatementBlock, Condition); } } public class CheckedExpression : Expression { Expression expression; public Expression Expression { get { return expression; } set { expression = value ?? Expression.Null; if (!expression.IsNull) expression.Parent = this; } } public CheckedExpression(Expression expression) { Expression = expression; } public override object AcceptVisitor(IAstVisitor visitor, object data) { return visitor.VisitCheckedExpression(this, data); } public override string ToString() { return string.Format("[CheckedExpression Expression={0}]", Expression); } } public class CheckedStatement : Statement { Statement block; public Statement Block { get { return block; } set { block = value ?? Statement.Null; if (!block.IsNull) block.Parent = this; } } public CheckedStatement(Statement block) { Block = block; } public override object AcceptVisitor(IAstVisitor visitor, object data) { return visitor.VisitCheckedStatement(this, data); } public override string ToString() { return string.Format("[CheckedStatement Block={0}]", Block); } } public class ClassReferenceExpression : Expression { public ClassReferenceExpression() { } public override object AcceptVisitor(IAstVisitor visitor, object data) { return visitor.VisitClassReferenceExpression(this, data); } public override string ToString() { return "[ClassReferenceExpression]"; } } public class CollectionInitializerExpression : Expression { List createExpressions; public List CreateExpressions { get { return createExpressions; } set { createExpressions = value ?? new List(); } } public CollectionInitializerExpression() { createExpressions = new List(); } public CollectionInitializerExpression(List createExpressions) { CreateExpressions = createExpressions; } public new static CollectionInitializerExpression Null { get { return NullCollectionInitializerExpression.Instance; } } public override object AcceptVisitor(IAstVisitor visitor, object data) { return visitor.VisitCollectionInitializerExpression(this, data); } public override string ToString() { return string.Format("[CollectionInitializerExpression CreateExpressions={0}]", GetCollectionString(CreateExpressions)); } } internal sealed class NullCollectionInitializerExpression : CollectionInitializerExpression { internal static NullCollectionInitializerExpression Instance = new NullCollectionInitializerExpression(); public override bool IsNull { get { return true; } } public override object AcceptVisitor(IAstVisitor visitor, object data) { return null; } public override string ToString() { return "[NullCollectionInitializerExpression]"; } } public class ConditionalExpression : Expression { Expression condition; Expression trueExpression; Expression falseExpression; public Expression Condition { get { return condition; } set { condition = value ?? Expression.Null; if (!condition.IsNull) condition.Parent = this; } } public Expression TrueExpression { get { return trueExpression; } set { trueExpression = value ?? Expression.Null; if (!trueExpression.IsNull) trueExpression.Parent = this; } } public Expression FalseExpression { get { return falseExpression; } set { falseExpression = value ?? Expression.Null; if (!falseExpression.IsNull) falseExpression.Parent = this; } } public ConditionalExpression(Expression condition, Expression trueExpression, Expression falseExpression) { Condition = condition; TrueExpression = trueExpression; FalseExpression = falseExpression; } public override object AcceptVisitor(IAstVisitor visitor, object data) { return visitor.VisitConditionalExpression(this, data); } public override string ToString() { return string.Format("[ConditionalExpression Condition={0} TrueExpression={1} FalseExpression={2}]", Condition, TrueExpression, FalseExpression); } } public class ConstructorDeclaration : ParametrizedNode { ConstructorInitializer constructorInitializer; BlockStatement body; public ConstructorInitializer ConstructorInitializer { get { return constructorInitializer; } set { constructorInitializer = value ?? ConstructorInitializer.Null; if (!constructorInitializer.IsNull) constructorInitializer.Parent = this; } } public BlockStatement Body { get { return body; } set { body = value ?? BlockStatement.Null; if (!body.IsNull) body.Parent = this; } } public ConstructorDeclaration(string name, Modifiers modifier, List parameters, List attributes) { Name = name; Modifier = modifier; Parameters = parameters; Attributes = attributes; constructorInitializer = ConstructorInitializer.Null; body = BlockStatement.Null; } public ConstructorDeclaration(string name, Modifiers modifier, List parameters, ConstructorInitializer constructorInitializer, List attributes) { Name = name; Modifier = modifier; Parameters = parameters; ConstructorInitializer = constructorInitializer; Attributes = attributes; body = BlockStatement.Null; } public override object AcceptVisitor(IAstVisitor visitor, object data) { return visitor.VisitConstructorDeclaration(this, data); } public override string ToString() { return string.Format("[ConstructorDeclaration ConstructorInitializer={0} Body={1} Name={2} Parameters={" + "3} Attributes={4} Modifier={5}]", ConstructorInitializer, Body, Name, GetCollectionString(Parameters), GetCollectionString(Attributes), Modifier); } } public class ConstructorInitializer : AbstractNode, INullable { ConstructorInitializerType constructorInitializerType; List arguments; public ConstructorInitializerType ConstructorInitializerType { get { return constructorInitializerType; } set { constructorInitializerType = value; } } public List Arguments { get { return arguments; } set { arguments = value ?? new List(); } } public ConstructorInitializer() { arguments = new List(); } public virtual bool IsNull { get { return false; } } public static ConstructorInitializer Null { get { return NullConstructorInitializer.Instance; } } public override object AcceptVisitor(IAstVisitor visitor, object data) { return visitor.VisitConstructorInitializer(this, data); } public override string ToString() { return string.Format("[ConstructorInitializer ConstructorInitializerType={0} Arguments={1}]", ConstructorInitializerType, GetCollectionString(Arguments)); } } internal sealed class NullConstructorInitializer : ConstructorInitializer { internal static NullConstructorInitializer Instance = new NullConstructorInitializer(); public override bool IsNull { get { return true; } } public override object AcceptVisitor(IAstVisitor visitor, object data) { return null; } public override string ToString() { return "[NullConstructorInitializer]"; } } public class ContinueStatement : Statement { ContinueType continueType; public ContinueType ContinueType { get { return continueType; } set { continueType = value; } } public ContinueStatement() { } public ContinueStatement(ContinueType continueType) { ContinueType = continueType; } public override object AcceptVisitor(IAstVisitor visitor, object data) { return visitor.VisitContinueStatement(this, data); } public override string ToString() { return string.Format("[ContinueStatement ContinueType={0}]", ContinueType); } } public class DeclareDeclaration : ParametrizedNode { string alias; string library; CharsetModifier charset; TypeReference typeReference; public string Alias { get { return alias; } set { alias = value ?? ""; } } public string Library { get { return library; } set { library = value ?? ""; } } public CharsetModifier Charset { get { return charset; } set { charset = value; } } public TypeReference TypeReference { get { return typeReference; } set { typeReference = value ?? TypeReference.Null; } } public DeclareDeclaration(string name, Modifiers modifier, TypeReference typeReference, List parameters, List attributes, string library, string alias, CharsetModifier charset) { Name = name; Modifier = modifier; TypeReference = typeReference; Parameters = parameters; Attributes = attributes; Library = library; Alias = alias; Charset = charset; } public override object AcceptVisitor(IAstVisitor visitor, object data) { return visitor.VisitDeclareDeclaration(this, data); } public override string ToString() { return string.Format("[DeclareDeclaration Alias={0} Library={1} Charset={2} TypeReference={3} Name={4} " + "Parameters={5} Attributes={6} Modifier={7}]", Alias, Library, Charset, TypeReference, Name, GetCollectionString(Parameters), GetCollectionString(Attributes), Modifier); } } public class DefaultValueExpression : Expression { TypeReference typeReference; public TypeReference TypeReference { get { return typeReference; } set { typeReference = value ?? TypeReference.Null; } } public DefaultValueExpression(TypeReference typeReference) { TypeReference = typeReference; } public override object AcceptVisitor(IAstVisitor visitor, object data) { return visitor.VisitDefaultValueExpression(this, data); } public override string ToString() { return string.Format("[DefaultValueExpression TypeReference={0}]", TypeReference); } } public class DelegateDeclaration : AttributedNode { string name; TypeReference returnType; List parameters; List templates; public string Name { get { return name; } set { name = string.IsNullOrEmpty(value) ? "?" : value; } } public TypeReference ReturnType { get { return returnType; } set { returnType = value ?? TypeReference.Null; } } public List Parameters { get { return parameters; } set { parameters = value ?? new List(); } } public List Templates { get { return templates; } set { templates = value ?? new List(); } } public DelegateDeclaration(Modifiers modifier, List attributes) { Modifier = modifier; Attributes = attributes; name = "?"; returnType = TypeReference.Null; parameters = new List(); templates = new List(); } public override object AcceptVisitor(IAstVisitor visitor, object data) { return visitor.VisitDelegateDeclaration(this, data); } public override string ToString() { return string.Format("[DelegateDeclaration Name={0} ReturnType={1} Parameters={2} Templates={3} Attribu" + "tes={4} Modifier={5}]", Name, ReturnType, GetCollectionString(Parameters), GetCollectionString(Templates), GetCollectionString(Attributes), Modifier); } } public class DestructorDeclaration : AttributedNode { string name; BlockStatement body; public string Name { get { return name; } set { name = value ?? ""; } } public BlockStatement Body { get { return body; } set { body = value ?? BlockStatement.Null; if (!body.IsNull) body.Parent = this; } } public DestructorDeclaration(string name, Modifiers modifier, List attributes) { Name = name; Modifier = modifier; Attributes = attributes; body = BlockStatement.Null; } public override object AcceptVisitor(IAstVisitor visitor, object data) { return visitor.VisitDestructorDeclaration(this, data); } public override string ToString() { return string.Format("[DestructorDeclaration Name={0} Body={1} Attributes={2} Modifier={3}]", Name, Body, GetCollectionString(Attributes), Modifier); } } public class DirectionExpression : Expression { FieldDirection fieldDirection; Expression expression; public FieldDirection FieldDirection { get { return fieldDirection; } set { fieldDirection = value; } } public Expression Expression { get { return expression; } set { expression = value ?? Expression.Null; if (!expression.IsNull) expression.Parent = this; } } public DirectionExpression(FieldDirection fieldDirection, Expression expression) { FieldDirection = fieldDirection; Expression = expression; } public override object AcceptVisitor(IAstVisitor visitor, object data) { return visitor.VisitDirectionExpression(this, data); } public override string ToString() { return string.Format("[DirectionExpression FieldDirection={0} Expression={1}]", FieldDirection, Expression); } } public class DoLoopStatement : StatementWithEmbeddedStatement { Expression condition; ConditionType conditionType; ConditionPosition conditionPosition; public Expression Condition { get { return condition; } set { condition = value ?? Expression.Null; if (!condition.IsNull) condition.Parent = this; } } public ConditionType ConditionType { get { return conditionType; } set { conditionType = value; } } public ConditionPosition ConditionPosition { get { return conditionPosition; } set { conditionPosition = value; } } public DoLoopStatement(Expression condition, Statement embeddedStatement, ConditionType conditionType, ConditionPosition conditionPosition) { Condition = condition; EmbeddedStatement = embeddedStatement; ConditionType = conditionType; ConditionPosition = conditionPosition; } public override object AcceptVisitor(IAstVisitor visitor, object data) { return visitor.VisitDoLoopStatement(this, data); } public override string ToString() { return string.Format("[DoLoopStatement Condition={0} ConditionType={1} ConditionPosition={2} EmbeddedSt" + "atement={3}]", Condition, ConditionType, ConditionPosition, EmbeddedStatement); } } public class ElseIfSection : StatementWithEmbeddedStatement { Expression condition; public Expression Condition { get { return condition; } set { condition = value ?? Expression.Null; if (!condition.IsNull) condition.Parent = this; } } public ElseIfSection(Expression condition, Statement embeddedStatement) { Condition = condition; EmbeddedStatement = embeddedStatement; } public override object AcceptVisitor(IAstVisitor visitor, object data) { return visitor.VisitElseIfSection(this, data); } public override string ToString() { return string.Format("[ElseIfSection Condition={0} EmbeddedStatement={1}]", Condition, EmbeddedStatement); } } public class EmptyStatement : Statement { public EmptyStatement() { } public override object AcceptVisitor(IAstVisitor visitor, object data) { return visitor.VisitEmptyStatement(this, data); } public override string ToString() { return "[EmptyStatement]"; } } public class EndStatement : Statement { public EndStatement() { } public override object AcceptVisitor(IAstVisitor visitor, object data) { return visitor.VisitEndStatement(this, data); } public override string ToString() { return "[EndStatement]"; } } public class EraseStatement : Statement { List expressions; public List Expressions { get { return expressions; } set { expressions = value ?? new List(); } } public EraseStatement() { expressions = new List(); } public EraseStatement(List expressions) { Expressions = expressions; } public override object AcceptVisitor(IAstVisitor visitor, object data) { return visitor.VisitEraseStatement(this, data); } public override string ToString() { return string.Format("[EraseStatement Expressions={0}]", GetCollectionString(Expressions)); } } public class ErrorStatement : Statement { Expression expression; public Expression Expression { get { return expression; } set { expression = value ?? Expression.Null; if (!expression.IsNull) expression.Parent = this; } } public ErrorStatement(Expression expression) { Expression = expression; } public override object AcceptVisitor(IAstVisitor visitor, object data) { return visitor.VisitErrorStatement(this, data); } public override string ToString() { return string.Format("[ErrorStatement Expression={0}]", Expression); } } public class EventAddRegion : EventAddRemoveRegion { public EventAddRegion(List attributes) : base(attributes) { } public static EventAddRegion Null { get { return NullEventAddRegion.Instance; } } public override object AcceptVisitor(IAstVisitor visitor, object data) { return visitor.VisitEventAddRegion(this, data); } public override string ToString() { return string.Format("[EventAddRegion Block={0} Parameters={1} Attributes={2} Modifier={3}]", Block, GetCollectionString(Parameters), GetCollectionString(Attributes), Modifier); } } internal sealed class NullEventAddRegion : EventAddRegion { private NullEventAddRegion() : base(null) { } internal static NullEventAddRegion Instance = new NullEventAddRegion(); public override bool IsNull { get { return true; } } public override object AcceptVisitor(IAstVisitor visitor, object data) { return null; } public override string ToString() { return "[NullEventAddRegion]"; } } public abstract class EventAddRemoveRegion : AttributedNode, INullable { BlockStatement block; List parameters; public BlockStatement Block { get { return block; } set { block = value ?? BlockStatement.Null; if (!block.IsNull) block.Parent = this; } } public List Parameters { get { return parameters; } set { parameters = value ?? new List(); } } protected EventAddRemoveRegion(List attributes) { Attributes = attributes; block = BlockStatement.Null; parameters = new List(); } public virtual bool IsNull { get { return false; } } } public class EventDeclaration : MemberNode { EventAddRegion addRegion; EventRemoveRegion removeRegion; EventRaiseRegion raiseRegion; Location bodyStart; Location bodyEnd; Expression initializer; public EventAddRegion AddRegion { get { return addRegion; } set { addRegion = value ?? EventAddRegion.Null; } } public EventRemoveRegion RemoveRegion { get { return removeRegion; } set { removeRegion = value ?? EventRemoveRegion.Null; } } public EventRaiseRegion RaiseRegion { get { return raiseRegion; } set { raiseRegion = value ?? EventRaiseRegion.Null; } } public Location BodyStart { get { return bodyStart; } set { bodyStart = value; } } public Location BodyEnd { get { return bodyEnd; } set { bodyEnd = value; } } public Expression Initializer { get { return initializer; } set { initializer = value ?? Expression.Null; if (!initializer.IsNull) initializer.Parent = this; } } public EventDeclaration() { addRegion = EventAddRegion.Null; removeRegion = EventRemoveRegion.Null; raiseRegion = EventRaiseRegion.Null; bodyStart = Location.Empty; bodyEnd = Location.Empty; initializer = Expression.Null; } public bool HasRaiseRegion { get { return !raiseRegion.IsNull; } } public bool HasRemoveRegion { get { return !removeRegion.IsNull; } } public bool HasAddRegion { get { return !addRegion.IsNull; } } public override object AcceptVisitor(IAstVisitor visitor, object data) { return visitor.VisitEventDeclaration(this, data); } public override string ToString() { return string.Format("[EventDeclaration AddRegion={0} RemoveRegion={1} RaiseRegion={2} BodyStart={3} Bo" + "dyEnd={4} Initializer={5} InterfaceImplementations={6} TypeReference={7} Name={8" + "} Parameters={9} Attributes={10} Modifier={11}]", AddRegion, RemoveRegion, RaiseRegion, BodyStart, BodyEnd, Initializer, GetCollectionString(InterfaceImplementations), TypeReference, Name, GetCollectionString(Parameters), GetCollectionString(Attributes), Modifier); } } public class EventRaiseRegion : EventAddRemoveRegion { public EventRaiseRegion(List attributes) : base(attributes) { } public static EventRaiseRegion Null { get { return NullEventRaiseRegion.Instance; } } public override object AcceptVisitor(IAstVisitor visitor, object data) { return visitor.VisitEventRaiseRegion(this, data); } public override string ToString() { return string.Format("[EventRaiseRegion Block={0} Parameters={1} Attributes={2} Modifier={3}]", Block, GetCollectionString(Parameters), GetCollectionString(Attributes), Modifier); } } internal sealed class NullEventRaiseRegion : EventRaiseRegion { private NullEventRaiseRegion() : base(null) { } internal static NullEventRaiseRegion Instance = new NullEventRaiseRegion(); public override bool IsNull { get { return true; } } public override object AcceptVisitor(IAstVisitor visitor, object data) { return null; } public override string ToString() { return "[NullEventRaiseRegion]"; } } public class EventRemoveRegion : EventAddRemoveRegion { public EventRemoveRegion(List attributes) : base(attributes) { } public static EventRemoveRegion Null { get { return NullEventRemoveRegion.Instance; } } public override object AcceptVisitor(IAstVisitor visitor, object data) { return visitor.VisitEventRemoveRegion(this, data); } public override string ToString() { return string.Format("[EventRemoveRegion Block={0} Parameters={1} Attributes={2} Modifier={3}]", Block, GetCollectionString(Parameters), GetCollectionString(Attributes), Modifier); } } internal sealed class NullEventRemoveRegion : EventRemoveRegion { private NullEventRemoveRegion() : base(null) { } internal static NullEventRemoveRegion Instance = new NullEventRemoveRegion(); public override bool IsNull { get { return true; } } public override object AcceptVisitor(IAstVisitor visitor, object data) { return null; } public override string ToString() { return "[NullEventRemoveRegion]"; } } public class ExitStatement : Statement { ExitType exitType; public ExitType ExitType { get { return exitType; } set { exitType = value; } } public ExitStatement(ExitType exitType) { ExitType = exitType; } public override object AcceptVisitor(IAstVisitor visitor, object data) { return visitor.VisitExitStatement(this, data); } public override string ToString() { return string.Format("[ExitStatement ExitType={0}]", ExitType); } } public class ExpressionStatement : Statement { Expression expression; public Expression Expression { get { return expression; } set { expression = value ?? Expression.Null; if (!expression.IsNull) expression.Parent = this; } } public ExpressionStatement(Expression expression) { Expression = expression; } public override object AcceptVisitor(IAstVisitor visitor, object data) { return visitor.VisitExpressionStatement(this, data); } public override string ToString() { return string.Format("[ExpressionStatement Expression={0}]", Expression); } } public class FieldDeclaration : AttributedNode { TypeReference typeReference; List fields; public TypeReference TypeReference { get { return typeReference; } set { typeReference = value ?? TypeReference.Null; } } public List Fields { get { return fields; } set { fields = value ?? new List(); } } public FieldDeclaration(List attributes) { Attributes = attributes; typeReference = TypeReference.Null; fields = new List(); } public FieldDeclaration(List attributes, TypeReference typeReference, Modifiers modifier) { Attributes = attributes; TypeReference = typeReference; Modifier = modifier; fields = new List(); } public TypeReference GetTypeForField(int fieldIndex) { if (!typeReference.IsNull) { return typeReference; } return ((VariableDeclaration)Fields[fieldIndex]).TypeReference; } public VariableDeclaration GetVariableDeclaration(string variableName) { foreach (VariableDeclaration variableDeclaration in Fields) { if (variableDeclaration.Name == variableName) { return variableDeclaration; } } return null; } public override object AcceptVisitor(IAstVisitor visitor, object data) { return visitor.VisitFieldDeclaration(this, data); } public override string ToString() { return string.Format("[FieldDeclaration TypeReference={0} Fields={1} Attributes={2} Modifier={3}]", TypeReference, GetCollectionString(Fields), GetCollectionString(Attributes), Modifier); } } public class FixedStatement : StatementWithEmbeddedStatement { TypeReference typeReference; List pointerDeclarators; public TypeReference TypeReference { get { return typeReference; } set { typeReference = value ?? TypeReference.Null; } } public List PointerDeclarators { get { return pointerDeclarators; } set { pointerDeclarators = value ?? new List(); } } public FixedStatement(TypeReference typeReference, List pointerDeclarators, Statement embeddedStatement) { TypeReference = typeReference; PointerDeclarators = pointerDeclarators; EmbeddedStatement = embeddedStatement; } public override object AcceptVisitor(IAstVisitor visitor, object data) { return visitor.VisitFixedStatement(this, data); } public override string ToString() { return string.Format("[FixedStatement TypeReference={0} PointerDeclarators={1} EmbeddedStatement={2}]", TypeReference, GetCollectionString(PointerDeclarators), EmbeddedStatement); } } public class ForeachStatement : StatementWithEmbeddedStatement { TypeReference typeReference; string variableName; Expression expression; Expression nextExpression; public TypeReference TypeReference { get { return typeReference; } set { typeReference = value ?? TypeReference.Null; } } public string VariableName { get { return variableName; } set { variableName = value ?? ""; } } public Expression Expression { get { return expression; } set { expression = value ?? Expression.Null; if (!expression.IsNull) expression.Parent = this; } } public Expression NextExpression { get { return nextExpression; } set { nextExpression = value ?? Expression.Null; if (!nextExpression.IsNull) nextExpression.Parent = this; } } public ForeachStatement(TypeReference typeReference, string variableName, Expression expression, Statement embeddedStatement) { TypeReference = typeReference; VariableName = variableName; Expression = expression; EmbeddedStatement = embeddedStatement; nextExpression = Expression.Null; } public ForeachStatement(TypeReference typeReference, string variableName, Expression expression, Statement embeddedStatement, Expression nextExpression) { TypeReference = typeReference; VariableName = variableName; Expression = expression; EmbeddedStatement = embeddedStatement; NextExpression = nextExpression; } public override object AcceptVisitor(IAstVisitor visitor, object data) { return visitor.VisitForeachStatement(this, data); } public override string ToString() { return string.Format("[ForeachStatement TypeReference={0} VariableName={1} Expression={2} NextExpressio" + "n={3} EmbeddedStatement={4}]", TypeReference, VariableName, Expression, NextExpression, EmbeddedStatement); } } public class ForNextStatement : StatementWithEmbeddedStatement { Expression start; Expression end; Expression step; List nextExpressions; TypeReference typeReference; string variableName; public Expression Start { get { return start; } set { start = value ?? Expression.Null; if (!start.IsNull) start.Parent = this; } } public Expression End { get { return end; } set { end = value ?? Expression.Null; if (!end.IsNull) end.Parent = this; } } public Expression Step { get { return step; } set { step = value ?? Expression.Null; if (!step.IsNull) step.Parent = this; } } public List NextExpressions { get { return nextExpressions; } set { nextExpressions = value ?? new List(); } } public TypeReference TypeReference { get { return typeReference; } set { typeReference = value ?? TypeReference.Null; } } public string VariableName { get { return variableName; } set { variableName = value ?? ""; } } public ForNextStatement(TypeReference typeReference, string variableName, Expression start, Expression end, Expression step, Statement embeddedStatement, List nextExpressions) { TypeReference = typeReference; VariableName = variableName; Start = start; End = end; Step = step; EmbeddedStatement = embeddedStatement; NextExpressions = nextExpressions; } public override object AcceptVisitor(IAstVisitor visitor, object data) { return visitor.VisitForNextStatement(this, data); } public override string ToString() { return string.Format("[ForNextStatement Start={0} End={1} Step={2} NextExpressions={3} TypeReference={4" + "} VariableName={5} EmbeddedStatement={6}]", Start, End, Step, GetCollectionString(NextExpressions), TypeReference, VariableName, EmbeddedStatement); } } public class ForStatement : StatementWithEmbeddedStatement { List initializers; Expression condition; List iterator; public List Initializers { get { return initializers; } set { initializers = value ?? new List(); } } public Expression Condition { get { return condition; } set { condition = value ?? Expression.Null; if (!condition.IsNull) condition.Parent = this; } } public List Iterator { get { return iterator; } set { iterator = value ?? new List(); } } public ForStatement(List initializers, Expression condition, List iterator, Statement embeddedStatement) { Initializers = initializers; Condition = condition; Iterator = iterator; EmbeddedStatement = embeddedStatement; } public override object AcceptVisitor(IAstVisitor visitor, object data) { return visitor.VisitForStatement(this, data); } public override string ToString() { return string.Format("[ForStatement Initializers={0} Condition={1} Iterator={2} EmbeddedStatement={3}]", GetCollectionString(Initializers), Condition, GetCollectionString(Iterator), EmbeddedStatement); } } public class GotoCaseStatement : Statement { Expression expression; public Expression Expression { get { return expression; } set { expression = value ?? Expression.Null; if (!expression.IsNull) expression.Parent = this; } } public GotoCaseStatement(Expression expression) { Expression = expression; } public bool IsDefaultCase { get { return expression.IsNull; } } public override object AcceptVisitor(IAstVisitor visitor, object data) { return visitor.VisitGotoCaseStatement(this, data); } public override string ToString() { return string.Format("[GotoCaseStatement Expression={0}]", Expression); } } public class GotoStatement : Statement { string label; public string Label { get { return label; } set { label = value ?? ""; } } public GotoStatement(string label) { Label = label; } public override object AcceptVisitor(IAstVisitor visitor, object data) { return visitor.VisitGotoStatement(this, data); } public override string ToString() { return string.Format("[GotoStatement Label={0}]", Label); } } public class IdentifierExpression : Expression { string identifier; List typeArguments; public string Identifier { get { return identifier; } set { identifier = value ?? ""; } } public List TypeArguments { get { return typeArguments; } set { typeArguments = value ?? new List(); } } public IdentifierExpression(string identifier) { Identifier = identifier; typeArguments = new List(); } public override object AcceptVisitor(IAstVisitor visitor, object data) { return visitor.VisitIdentifierExpression(this, data); } public override string ToString() { return string.Format("[IdentifierExpression Identifier={0} TypeArguments={1}]", Identifier, GetCollectionString(TypeArguments)); } } public class IfElseStatement : Statement { Expression condition; List trueStatement; List falseStatement; List elseIfSections; public Expression Condition { get { return condition; } set { condition = value ?? Expression.Null; if (!condition.IsNull) condition.Parent = this; } } public List TrueStatement { get { return trueStatement; } set { trueStatement = value ?? new List(); } } public List FalseStatement { get { return falseStatement; } set { falseStatement = value ?? new List(); } } public List ElseIfSections { get { return elseIfSections; } set { elseIfSections = value ?? new List(); } } public IfElseStatement(Expression condition) { Condition = condition; trueStatement = new List(); falseStatement = new List(); elseIfSections = new List(); } public bool HasElseIfSections { get { return elseIfSections.Count > 0; } } public IfElseStatement(Expression condition, Statement trueStatement) : this(condition) { this.trueStatement.Add(Statement.CheckNull(trueStatement)); } public IfElseStatement(Expression condition, Statement trueStatement, Statement falseStatement) : this(condition) { this.trueStatement.Add(Statement.CheckNull(trueStatement)); this.falseStatement.Add(Statement.CheckNull(falseStatement)); } public bool HasElseStatements { get { return falseStatement.Count > 0; } } public override object AcceptVisitor(IAstVisitor visitor, object data) { return visitor.VisitIfElseStatement(this, data); } public override string ToString() { return string.Format("[IfElseStatement Condition={0} TrueStatement={1} FalseStatement={2} ElseIfSection" + "s={3}]", Condition, GetCollectionString(TrueStatement), GetCollectionString(FalseStatement), GetCollectionString(ElseIfSections)); } } public class IndexerDeclaration : AttributedNode { List parameters; List interfaceImplementations; TypeReference typeReference; Location bodyStart; Location bodyEnd; PropertyGetRegion getRegion; PropertySetRegion setRegion; public List Parameters { get { return parameters; } set { parameters = value ?? new List(); } } public List InterfaceImplementations { get { return interfaceImplementations; } set { interfaceImplementations = value ?? new List(); } } public TypeReference TypeReference { get { return typeReference; } set { typeReference = value ?? TypeReference.Null; } } public Location BodyStart { get { return bodyStart; } set { bodyStart = value; } } public Location BodyEnd { get { return bodyEnd; } set { bodyEnd = value; } } public PropertyGetRegion GetRegion { get { return getRegion; } set { getRegion = value ?? PropertyGetRegion.Null; } } public PropertySetRegion SetRegion { get { return setRegion; } set { setRegion = value ?? PropertySetRegion.Null; } } public IndexerDeclaration(Modifiers modifier, List parameters, List attributes) { Modifier = modifier; Parameters = parameters; Attributes = attributes; interfaceImplementations = new List(); typeReference = TypeReference.Null; bodyStart = Location.Empty; bodyEnd = Location.Empty; getRegion = PropertyGetRegion.Null; setRegion = PropertySetRegion.Null; } public IndexerDeclaration(TypeReference typeReference, List parameters, Modifiers modifier, List attributes) { TypeReference = typeReference; Parameters = parameters; Modifier = modifier; Attributes = attributes; interfaceImplementations = new List(); bodyStart = Location.Empty; bodyEnd = Location.Empty; getRegion = PropertyGetRegion.Null; setRegion = PropertySetRegion.Null; } public bool HasSetRegion { get { return !setRegion.IsNull; } } public bool HasGetRegion { get { return !getRegion.IsNull; } } public bool IsReadOnly { get { return HasGetRegion && !HasSetRegion; } } public bool IsWriteOnly { get { return !HasGetRegion && HasSetRegion; } } public override object AcceptVisitor(IAstVisitor visitor, object data) { return visitor.VisitIndexerDeclaration(this, data); } public override string ToString() { return string.Format("[IndexerDeclaration Parameters={0} InterfaceImplementations={1} TypeReference={2}" + " BodyStart={3} BodyEnd={4} GetRegion={5} SetRegion={6} Attributes={7} Modifier={" + "8}]", GetCollectionString(Parameters), GetCollectionString(InterfaceImplementations), TypeReference, BodyStart, BodyEnd, GetRegion, SetRegion, GetCollectionString(Attributes), Modifier); } } public class IndexerExpression : Expression { Expression targetObject; List indexes; public Expression TargetObject { get { return targetObject; } set { targetObject = value ?? Expression.Null; if (!targetObject.IsNull) targetObject.Parent = this; } } public List Indexes { get { return indexes; } set { indexes = value ?? new List(); } } public IndexerExpression(Expression targetObject, List indexes) { TargetObject = targetObject; Indexes = indexes; } public override object AcceptVisitor(IAstVisitor visitor, object data) { return visitor.VisitIndexerExpression(this, data); } public override string ToString() { return string.Format("[IndexerExpression TargetObject={0} Indexes={1}]", TargetObject, GetCollectionString(Indexes)); } } public class InterfaceImplementation : AbstractNode { TypeReference interfaceType; string memberName; public TypeReference InterfaceType { get { return interfaceType; } set { interfaceType = value ?? TypeReference.Null; } } public string MemberName { get { return memberName; } set { memberName = string.IsNullOrEmpty(value) ? "?" : value; } } public InterfaceImplementation(TypeReference interfaceType, string memberName) { InterfaceType = interfaceType; MemberName = memberName; } public override object AcceptVisitor(IAstVisitor visitor, object data) { return visitor.VisitInterfaceImplementation(this, data); } public override string ToString() { return string.Format("[InterfaceImplementation InterfaceType={0} MemberName={1}]", InterfaceType, MemberName); } } public class InvocationExpression : Expression { Expression targetObject; List arguments; public Expression TargetObject { get { return targetObject; } set { targetObject = value ?? Expression.Null; if (!targetObject.IsNull) targetObject.Parent = this; } } public List Arguments { get { return arguments; } set { arguments = value ?? new List(); } } public InvocationExpression(Expression targetObject) { TargetObject = targetObject; arguments = new List(); } public InvocationExpression(Expression targetObject, List arguments) { TargetObject = targetObject; Arguments = arguments; } public override object AcceptVisitor(IAstVisitor visitor, object data) { return visitor.VisitInvocationExpression(this, data); } public override string ToString() { return string.Format("[InvocationExpression TargetObject={0} Arguments={1}]", TargetObject, GetCollectionString(Arguments)); } } public class LabelStatement : Statement { string label; public string Label { get { return label; } set { label = value ?? ""; } } public LabelStatement(string label) { Label = label; } public override object AcceptVisitor(IAstVisitor visitor, object data) { return visitor.VisitLabelStatement(this, data); } public override string ToString() { return string.Format("[LabelStatement Label={0}]", Label); } } public class LambdaExpression : Expression { List parameters; BlockStatement statementBody; Expression expressionBody; public List Parameters { get { return parameters; } set { parameters = value ?? new List(); } } public BlockStatement StatementBody { get { return statementBody; } set { statementBody = value ?? BlockStatement.Null; if (!statementBody.IsNull) statementBody.Parent = this; } } public Expression ExpressionBody { get { return expressionBody; } set { expressionBody = value ?? Expression.Null; if (!expressionBody.IsNull) expressionBody.Parent = this; } } public LambdaExpression() { parameters = new List(); statementBody = BlockStatement.Null; expressionBody = Expression.Null; } public override object AcceptVisitor(IAstVisitor visitor, object data) { return visitor.VisitLambdaExpression(this, data); } public override string ToString() { return string.Format("[LambdaExpression Parameters={0} StatementBody={1} ExpressionBody={2}]", GetCollectionString(Parameters), StatementBody, ExpressionBody); } } public class LockStatement : StatementWithEmbeddedStatement { Expression lockExpression; public Expression LockExpression { get { return lockExpression; } set { lockExpression = value ?? Expression.Null; if (!lockExpression.IsNull) lockExpression.Parent = this; } } public LockStatement(Expression lockExpression, Statement embeddedStatement) { LockExpression = lockExpression; EmbeddedStatement = embeddedStatement; } public override object AcceptVisitor(IAstVisitor visitor, object data) { return visitor.VisitLockStatement(this, data); } public override string ToString() { return string.Format("[LockStatement LockExpression={0} EmbeddedStatement={1}]", LockExpression, EmbeddedStatement); } } public abstract class MemberNode : ParametrizedNode { List interfaceImplementations; TypeReference typeReference; public List InterfaceImplementations { get { return interfaceImplementations; } set { interfaceImplementations = value ?? new List(); } } public TypeReference TypeReference { get { return typeReference; } set { typeReference = value ?? TypeReference.Null; } } protected MemberNode() { interfaceImplementations = new List(); typeReference = TypeReference.Null; } protected MemberNode(Modifiers modifier, List attributes, string name, List parameters) { Modifier = modifier; Attributes = attributes; Name = name; Parameters = parameters; interfaceImplementations = new List(); typeReference = TypeReference.Null; } } public class MemberReferenceExpression : Expression { Expression targetObject; string memberName; List typeArguments; public Expression TargetObject { get { return targetObject; } set { targetObject = value ?? Expression.Null; if (!targetObject.IsNull) targetObject.Parent = this; } } public string MemberName { get { return memberName; } set { memberName = value ?? ""; } } public List TypeArguments { get { return typeArguments; } set { typeArguments = value ?? new List(); } } public MemberReferenceExpression(Expression targetObject, string memberName) { TargetObject = targetObject; MemberName = memberName; typeArguments = new List(); } [Obsolete] public string FieldName { get { return MemberName; } set { MemberName = value; } } public override object AcceptVisitor(IAstVisitor visitor, object data) { return visitor.VisitMemberReferenceExpression(this, data); } public override string ToString() { return string.Format("[MemberReferenceExpression TargetObject={0} MemberName={1} TypeArguments={2}]", TargetObject, MemberName, GetCollectionString(TypeArguments)); } } public class MethodDeclaration : MemberNode { BlockStatement body; List handlesClause; List templates; bool isExtensionMethod; public BlockStatement Body { get { return body; } set { body = value ?? BlockStatement.Null; if (!body.IsNull) body.Parent = this; } } public List HandlesClause { get { return handlesClause; } set { handlesClause = value ?? new List(); } } public List Templates { get { return templates; } set { templates = value ?? new List(); } } public bool IsExtensionMethod { get { return isExtensionMethod; } set { isExtensionMethod = value; } } public MethodDeclaration() { body = BlockStatement.Null; handlesClause = new List(); templates = new List(); } public override object AcceptVisitor(IAstVisitor visitor, object data) { return visitor.VisitMethodDeclaration(this, data); } public override string ToString() { return string.Format("[MethodDeclaration Body={0} HandlesClause={1} Templates={2} IsExtensionMethod={3}" + " InterfaceImplementations={4} TypeReference={5} Name={6} Parameters={7} Attribut" + "es={8} Modifier={9}]", Body, GetCollectionString(HandlesClause), GetCollectionString(Templates), IsExtensionMethod, GetCollectionString(InterfaceImplementations), TypeReference, Name, GetCollectionString(Parameters), GetCollectionString(Attributes), Modifier); } } public class NamedArgumentExpression : Expression { string name; Expression expression; public string Name { get { return name; } set { name = value ?? ""; } } public Expression Expression { get { return expression; } set { expression = value ?? Expression.Null; if (!expression.IsNull) expression.Parent = this; } } public NamedArgumentExpression(string name, Expression expression) { Name = name; Expression = expression; } public override object AcceptVisitor(IAstVisitor visitor, object data) { return visitor.VisitNamedArgumentExpression(this, data); } public override string ToString() { return string.Format("[NamedArgumentExpression Name={0} Expression={1}]", Name, Expression); } } public class NamespaceDeclaration : AbstractNode { string name; public string Name { get { return name; } set { name = value ?? ""; } } public NamespaceDeclaration(string name) { Name = name; } public override object AcceptVisitor(IAstVisitor visitor, object data) { return visitor.VisitNamespaceDeclaration(this, data); } public override string ToString() { return string.Format("[NamespaceDeclaration Name={0}]", Name); } } public class ObjectCreateExpression : Expression { TypeReference createType; List parameters; CollectionInitializerExpression objectInitializer; public TypeReference CreateType { get { return createType; } set { createType = value ?? TypeReference.Null; } } public List Parameters { get { return parameters; } set { parameters = value ?? new List(); } } public CollectionInitializerExpression ObjectInitializer { get { return objectInitializer; } set { objectInitializer = value ?? CollectionInitializerExpression.Null; if (!objectInitializer.IsNull) objectInitializer.Parent = this; } } public ObjectCreateExpression(TypeReference createType, List parameters) { CreateType = createType; Parameters = parameters; objectInitializer = CollectionInitializerExpression.Null; } public bool IsAnonymousType { get { return createType.IsNull || string.IsNullOrEmpty(createType.Type); } } public override object AcceptVisitor(IAstVisitor visitor, object data) { return visitor.VisitObjectCreateExpression(this, data); } public override string ToString() { return string.Format("[ObjectCreateExpression CreateType={0} Parameters={1} ObjectInitializer={2}]", CreateType, GetCollectionString(Parameters), ObjectInitializer); } } public class OnErrorStatement : StatementWithEmbeddedStatement { public OnErrorStatement(Statement embeddedStatement) { EmbeddedStatement = embeddedStatement; } public override object AcceptVisitor(IAstVisitor visitor, object data) { return visitor.VisitOnErrorStatement(this, data); } public override string ToString() { return string.Format("[OnErrorStatement EmbeddedStatement={0}]", EmbeddedStatement); } } public class OperatorDeclaration : MethodDeclaration { ConversionType conversionType; List returnTypeAttributes; OverloadableOperatorType overloadableOperator; public ConversionType ConversionType { get { return conversionType; } set { conversionType = value; } } public List ReturnTypeAttributes { get { return returnTypeAttributes; } set { returnTypeAttributes = value ?? new List(); } } public OverloadableOperatorType OverloadableOperator { get { return overloadableOperator; } set { overloadableOperator = value; } } public OperatorDeclaration() { returnTypeAttributes = new List(); } public bool IsConversionOperator { get { return conversionType != ConversionType.None; } } public override object AcceptVisitor(IAstVisitor visitor, object data) { return visitor.VisitOperatorDeclaration(this, data); } public override string ToString() { return string.Format("[OperatorDeclaration ConversionType={0} ReturnTypeAttributes={1} OverloadableOper" + "ator={2} Body={3} HandlesClause={4} Templates={5} IsExtensionMethod={6} Interfac" + "eImplementations={7} TypeReference={8} Name={9} Parameters={10} Attributes={11} " + "Modifier={12}]", ConversionType, GetCollectionString(ReturnTypeAttributes), OverloadableOperator, Body, GetCollectionString(HandlesClause), GetCollectionString(Templates), IsExtensionMethod, GetCollectionString(InterfaceImplementations), TypeReference, Name, GetCollectionString(Parameters), GetCollectionString(Attributes), Modifier); } } public class OptionDeclaration : AbstractNode { OptionType optionType; bool optionValue; public OptionType OptionType { get { return optionType; } set { optionType = value; } } public bool OptionValue { get { return optionValue; } set { optionValue = value; } } public OptionDeclaration(OptionType optionType, bool optionValue) { OptionType = optionType; OptionValue = optionValue; } public override object AcceptVisitor(IAstVisitor visitor, object data) { return visitor.VisitOptionDeclaration(this, data); } public override string ToString() { return string.Format("[OptionDeclaration OptionType={0} OptionValue={1}]", OptionType, OptionValue); } } public class ParameterDeclarationExpression : Expression { List attributes; string parameterName; TypeReference typeReference; ParameterModifiers paramModifier; Expression defaultValue; public List Attributes { get { return attributes; } set { attributes = value ?? new List(); } } public string ParameterName { get { return parameterName; } set { parameterName = string.IsNullOrEmpty(value) ? "?" : value; } } public TypeReference TypeReference { get { return typeReference; } set { typeReference = value ?? TypeReference.Null; } } public ParameterModifiers ParamModifier { get { return paramModifier; } set { paramModifier = value; } } public Expression DefaultValue { get { return defaultValue; } set { defaultValue = value ?? Expression.Null; if (!defaultValue.IsNull) defaultValue.Parent = this; } } public ParameterDeclarationExpression(TypeReference typeReference, string parameterName) { TypeReference = typeReference; ParameterName = parameterName; attributes = new List(); defaultValue = Expression.Null; } public ParameterDeclarationExpression(TypeReference typeReference, string parameterName, ParameterModifiers paramModifier) { TypeReference = typeReference; ParameterName = parameterName; ParamModifier = paramModifier; attributes = new List(); defaultValue = Expression.Null; } public ParameterDeclarationExpression(TypeReference typeReference, string parameterName, ParameterModifiers paramModifier, Expression defaultValue) { TypeReference = typeReference; ParameterName = parameterName; ParamModifier = paramModifier; DefaultValue = defaultValue; attributes = new List(); } public override object AcceptVisitor(IAstVisitor visitor, object data) { return visitor.VisitParameterDeclarationExpression(this, data); } public override string ToString() { return string.Format("[ParameterDeclarationExpression Attributes={0} ParameterName={1} TypeReference={2" + "} ParamModifier={3} DefaultValue={4}]", GetCollectionString(Attributes), ParameterName, TypeReference, ParamModifier, DefaultValue); } } public abstract class ParametrizedNode : AttributedNode { string name; List parameters; public string Name { get { return name; } set { name = value ?? ""; } } public List Parameters { get { return parameters; } set { parameters = value ?? new List(); } } protected ParametrizedNode() { name = ""; parameters = new List(); } protected ParametrizedNode(Modifiers modifier, List attributes, string name, List parameters) { Modifier = modifier; Attributes = attributes; Name = name; Parameters = parameters; } } public class ParenthesizedExpression : Expression { Expression expression; public Expression Expression { get { return expression; } set { expression = value ?? Expression.Null; if (!expression.IsNull) expression.Parent = this; } } public ParenthesizedExpression(Expression expression) { Expression = expression; } public override object AcceptVisitor(IAstVisitor visitor, object data) { return visitor.VisitParenthesizedExpression(this, data); } public override string ToString() { return string.Format("[ParenthesizedExpression Expression={0}]", Expression); } } public class PointerReferenceExpression : Expression { Expression targetObject; string identifier; List typeArguments; public Expression TargetObject { get { return targetObject; } set { targetObject = value ?? Expression.Null; if (!targetObject.IsNull) targetObject.Parent = this; } } public string Identifier { get { return identifier; } set { identifier = value ?? ""; } } public List TypeArguments { get { return typeArguments; } set { typeArguments = value ?? new List(); } } public PointerReferenceExpression(Expression targetObject, string identifier) { TargetObject = targetObject; Identifier = identifier; typeArguments = new List(); } public override object AcceptVisitor(IAstVisitor visitor, object data) { return visitor.VisitPointerReferenceExpression(this, data); } public override string ToString() { return string.Format("[PointerReferenceExpression TargetObject={0} Identifier={1} TypeArguments={2}]", TargetObject, Identifier, GetCollectionString(TypeArguments)); } } public class PropertyDeclaration : MemberNode { Location bodyStart; Location bodyEnd; PropertyGetRegion getRegion; PropertySetRegion setRegion; public Location BodyStart { get { return bodyStart; } set { bodyStart = value; } } public Location BodyEnd { get { return bodyEnd; } set { bodyEnd = value; } } public PropertyGetRegion GetRegion { get { return getRegion; } set { getRegion = value ?? PropertyGetRegion.Null; } } public PropertySetRegion SetRegion { get { return setRegion; } set { setRegion = value ?? PropertySetRegion.Null; } } public PropertyDeclaration(Modifiers modifier, List attributes, string name, List parameters) { Modifier = modifier; Attributes = attributes; Name = name; Parameters = parameters; bodyStart = Location.Empty; bodyEnd = Location.Empty; getRegion = PropertyGetRegion.Null; setRegion = PropertySetRegion.Null; } public bool HasSetRegion { get { return !setRegion.IsNull; } } public bool HasGetRegion { get { return !getRegion.IsNull; } } public bool IsWriteOnly { get { return !HasGetRegion && HasSetRegion; } } internal PropertyDeclaration(string name, TypeReference typeReference, Modifiers modifier, List attributes) : this(modifier, attributes, name, null) { this.TypeReference = typeReference; if ((modifier & Modifiers.ReadOnly) != Modifiers.ReadOnly) { this.SetRegion = new PropertySetRegion(null, null); } if ((modifier & Modifiers.WriteOnly) != Modifiers.WriteOnly) { this.GetRegion = new PropertyGetRegion(null, null); } } public bool IsReadOnly { get { return HasGetRegion && !HasSetRegion; } } public override object AcceptVisitor(IAstVisitor visitor, object data) { return visitor.VisitPropertyDeclaration(this, data); } public override string ToString() { return string.Format("[PropertyDeclaration BodyStart={0} BodyEnd={1} GetRegion={2} SetRegion={3} Interf" + "aceImplementations={4} TypeReference={5} Name={6} Parameters={7} Attributes={8} " + "Modifier={9}]", BodyStart, BodyEnd, GetRegion, SetRegion, GetCollectionString(InterfaceImplementations), TypeReference, Name, GetCollectionString(Parameters), GetCollectionString(Attributes), Modifier); } } public class PropertyGetRegion : PropertyGetSetRegion { public PropertyGetRegion(BlockStatement block, List attributes) : base(block, attributes) { } public static PropertyGetRegion Null { get { return NullPropertyGetRegion.Instance; } } public override object AcceptVisitor(IAstVisitor visitor, object data) { return visitor.VisitPropertyGetRegion(this, data); } public override string ToString() { return string.Format("[PropertyGetRegion Block={0} Attributes={1} Modifier={2}]", Block, GetCollectionString(Attributes), Modifier); } } internal sealed class NullPropertyGetRegion : PropertyGetRegion { private NullPropertyGetRegion() : base(null, null) { } internal static NullPropertyGetRegion Instance = new NullPropertyGetRegion(); public override bool IsNull { get { return true; } } public override object AcceptVisitor(IAstVisitor visitor, object data) { return null; } public override string ToString() { return "[NullPropertyGetRegion]"; } } public abstract class PropertyGetSetRegion : AttributedNode, INullable { BlockStatement block; public BlockStatement Block { get { return block; } set { block = value ?? BlockStatement.Null; if (!block.IsNull) block.Parent = this; } } protected PropertyGetSetRegion(BlockStatement block, List attributes) { Block = block; Attributes = attributes; } public virtual bool IsNull { get { return false; } } } public class PropertySetRegion : PropertyGetSetRegion { List parameters; public List Parameters { get { return parameters; } set { parameters = value ?? new List(); } } public PropertySetRegion(BlockStatement block, List attributes) : base(block, attributes) { parameters = new List(); } public static PropertySetRegion Null { get { return NullPropertySetRegion.Instance; } } public override object AcceptVisitor(IAstVisitor visitor, object data) { return visitor.VisitPropertySetRegion(this, data); } public override string ToString() { return string.Format("[PropertySetRegion Parameters={0} Block={1} Attributes={2} Modifier={3}]", GetCollectionString(Parameters), Block, GetCollectionString(Attributes), Modifier); } } internal sealed class NullPropertySetRegion : PropertySetRegion { private NullPropertySetRegion() : base(null, null) { } internal static NullPropertySetRegion Instance = new NullPropertySetRegion(); public override bool IsNull { get { return true; } } public override object AcceptVisitor(IAstVisitor visitor, object data) { return null; } public override string ToString() { return "[NullPropertySetRegion]"; } } public class QueryExpression : Expression { QueryExpressionFromClause fromClause; List fromLetWhereClauses; List orderings; QueryExpressionClause selectOrGroupClause; QueryExpressionIntoClause intoClause; public QueryExpressionFromClause FromClause { get { return fromClause; } set { fromClause = value ?? QueryExpressionFromClause.Null; if (!fromClause.IsNull) fromClause.Parent = this; } } public List FromLetWhereClauses { get { return fromLetWhereClauses; } set { fromLetWhereClauses = value ?? new List(); } } public List Orderings { get { return orderings; } set { orderings = value ?? new List(); } } public QueryExpressionClause SelectOrGroupClause { get { return selectOrGroupClause; } set { selectOrGroupClause = value ?? QueryExpressionClause.Null; if (!selectOrGroupClause.IsNull) selectOrGroupClause.Parent = this; } } public QueryExpressionIntoClause IntoClause { get { return intoClause; } set { intoClause = value ?? QueryExpressionIntoClause.Null; if (!intoClause.IsNull) intoClause.Parent = this; } } public QueryExpression() { fromClause = QueryExpressionFromClause.Null; fromLetWhereClauses = new List(); orderings = new List(); selectOrGroupClause = QueryExpressionClause.Null; intoClause = QueryExpressionIntoClause.Null; } public new static QueryExpression Null { get { return NullQueryExpression.Instance; } } public override object AcceptVisitor(IAstVisitor visitor, object data) { return visitor.VisitQueryExpression(this, data); } public override string ToString() { return string.Format("[QueryExpression FromClause={0} FromLetWhereClauses={1} Orderings={2} SelectOrGro" + "upClause={3} IntoClause={4}]", FromClause, GetCollectionString(FromLetWhereClauses), GetCollectionString(Orderings), SelectOrGroupClause, IntoClause); } } internal sealed class NullQueryExpression : QueryExpression { internal static NullQueryExpression Instance = new NullQueryExpression(); public override bool IsNull { get { return true; } } public override object AcceptVisitor(IAstVisitor visitor, object data) { return null; } public override string ToString() { return "[NullQueryExpression]"; } } public abstract class QueryExpressionClause : AbstractNode, INullable { public virtual bool IsNull { get { return false; } } public static QueryExpressionClause Null { get { return NullQueryExpressionClause.Instance; } } } internal sealed class NullQueryExpressionClause : QueryExpressionClause { internal static NullQueryExpressionClause Instance = new NullQueryExpressionClause(); public override bool IsNull { get { return true; } } public override object AcceptVisitor(IAstVisitor visitor, object data) { return null; } public override string ToString() { return "[NullQueryExpressionClause]"; } } public class QueryExpressionFromClause : QueryExpressionFromOrJoinClause { public QueryExpressionFromClause() { } public new static QueryExpressionFromClause Null { get { return NullQueryExpressionFromClause.Instance; } } public override object AcceptVisitor(IAstVisitor visitor, object data) { return visitor.VisitQueryExpressionFromClause(this, data); } public override string ToString() { return string.Format("[QueryExpressionFromClause Type={0} Identifier={1} InExpression={2}]", Type, Identifier, InExpression); } } internal sealed class NullQueryExpressionFromClause : QueryExpressionFromClause { internal static NullQueryExpressionFromClause Instance = new NullQueryExpressionFromClause(); public override bool IsNull { get { return true; } } public override object AcceptVisitor(IAstVisitor visitor, object data) { return null; } public override string ToString() { return "[NullQueryExpressionFromClause]"; } } public abstract class QueryExpressionFromOrJoinClause : QueryExpressionClause { TypeReference type; string identifier; Expression inExpression; public TypeReference Type { get { return type; } set { type = value ?? TypeReference.Null; } } public string Identifier { get { return identifier; } set { identifier = string.IsNullOrEmpty(value) ? "?" : value; } } public Expression InExpression { get { return inExpression; } set { inExpression = value ?? Expression.Null; if (!inExpression.IsNull) inExpression.Parent = this; } } } public class QueryExpressionGroupClause : QueryExpressionClause { Expression projection; Expression groupBy; public Expression Projection { get { return projection; } set { projection = value ?? Expression.Null; if (!projection.IsNull) projection.Parent = this; } } public Expression GroupBy { get { return groupBy; } set { groupBy = value ?? Expression.Null; if (!groupBy.IsNull) groupBy.Parent = this; } } public QueryExpressionGroupClause() { projection = Expression.Null; groupBy = Expression.Null; } public override object AcceptVisitor(IAstVisitor visitor, object data) { return visitor.VisitQueryExpressionGroupClause(this, data); } public override string ToString() { return string.Format("[QueryExpressionGroupClause Projection={0} GroupBy={1}]", Projection, GroupBy); } } public class QueryExpressionIntoClause : QueryExpressionClause { string intoIdentifier; QueryExpression continuedQuery; public string IntoIdentifier { get { return intoIdentifier; } set { intoIdentifier = string.IsNullOrEmpty(value) ? "?" : value; } } public QueryExpression ContinuedQuery { get { return continuedQuery; } set { continuedQuery = value ?? QueryExpression.Null; if (!continuedQuery.IsNull) continuedQuery.Parent = this; } } public QueryExpressionIntoClause() { intoIdentifier = "?"; continuedQuery = QueryExpression.Null; } public new static QueryExpressionIntoClause Null { get { return NullQueryExpressionIntoClause.Instance; } } public override object AcceptVisitor(IAstVisitor visitor, object data) { return visitor.VisitQueryExpressionIntoClause(this, data); } public override string ToString() { return string.Format("[QueryExpressionIntoClause IntoIdentifier={0} ContinuedQuery={1}]", IntoIdentifier, ContinuedQuery); } } internal sealed class NullQueryExpressionIntoClause : QueryExpressionIntoClause { internal static NullQueryExpressionIntoClause Instance = new NullQueryExpressionIntoClause(); public override bool IsNull { get { return true; } } public override object AcceptVisitor(IAstVisitor visitor, object data) { return null; } public override string ToString() { return "[NullQueryExpressionIntoClause]"; } } public class QueryExpressionJoinClause : QueryExpressionFromOrJoinClause { Expression onExpression; Expression equalsExpression; string intoIdentifier; public Expression OnExpression { get { return onExpression; } set { onExpression = value ?? Expression.Null; if (!onExpression.IsNull) onExpression.Parent = this; } } public Expression EqualsExpression { get { return equalsExpression; } set { equalsExpression = value ?? Expression.Null; if (!equalsExpression.IsNull) equalsExpression.Parent = this; } } public string IntoIdentifier { get { return intoIdentifier; } set { intoIdentifier = value ?? ""; } } public QueryExpressionJoinClause() { onExpression = Expression.Null; equalsExpression = Expression.Null; intoIdentifier = ""; } public override object AcceptVisitor(IAstVisitor visitor, object data) { return visitor.VisitQueryExpressionJoinClause(this, data); } public override string ToString() { return string.Format("[QueryExpressionJoinClause OnExpression={0} EqualsExpression={1} IntoIdentifier={" + "2} Type={3} Identifier={4} InExpression={5}]", OnExpression, EqualsExpression, IntoIdentifier, Type, Identifier, InExpression); } } public class QueryExpressionLetClause : QueryExpressionClause { string identifier; Expression expression; public string Identifier { get { return identifier; } set { identifier = string.IsNullOrEmpty(value) ? "?" : value; } } public Expression Expression { get { return expression; } set { expression = value ?? Expression.Null; if (!expression.IsNull) expression.Parent = this; } } public QueryExpressionLetClause() { identifier = "?"; expression = Expression.Null; } public override object AcceptVisitor(IAstVisitor visitor, object data) { return visitor.VisitQueryExpressionLetClause(this, data); } public override string ToString() { return string.Format("[QueryExpressionLetClause Identifier={0} Expression={1}]", Identifier, Expression); } } public class QueryExpressionOrdering : AbstractNode { Expression criteria; QueryExpressionOrderingDirection direction; public Expression Criteria { get { return criteria; } set { criteria = value ?? Expression.Null; if (!criteria.IsNull) criteria.Parent = this; } } public QueryExpressionOrderingDirection Direction { get { return direction; } set { direction = value; } } public QueryExpressionOrdering() { criteria = Expression.Null; } public override object AcceptVisitor(IAstVisitor visitor, object data) { return visitor.VisitQueryExpressionOrdering(this, data); } public override string ToString() { return string.Format("[QueryExpressionOrdering Criteria={0} Direction={1}]", Criteria, Direction); } } public class QueryExpressionSelectClause : QueryExpressionClause { Expression projection; public Expression Projection { get { return projection; } set { projection = value ?? Expression.Null; if (!projection.IsNull) projection.Parent = this; } } public QueryExpressionSelectClause() { projection = Expression.Null; } public override object AcceptVisitor(IAstVisitor visitor, object data) { return visitor.VisitQueryExpressionSelectClause(this, data); } public override string ToString() { return string.Format("[QueryExpressionSelectClause Projection={0}]", Projection); } } public class QueryExpressionWhereClause : QueryExpressionClause { Expression condition; public Expression Condition { get { return condition; } set { condition = value ?? Expression.Null; if (!condition.IsNull) condition.Parent = this; } } public QueryExpressionWhereClause() { condition = Expression.Null; } public override object AcceptVisitor(IAstVisitor visitor, object data) { return visitor.VisitQueryExpressionWhereClause(this, data); } public override string ToString() { return string.Format("[QueryExpressionWhereClause Condition={0}]", Condition); } } public class RaiseEventStatement : Statement { string eventName; List arguments; public string EventName { get { return eventName; } set { eventName = value ?? ""; } } public List Arguments { get { return arguments; } set { arguments = value ?? new List(); } } public RaiseEventStatement(string eventName, List arguments) { EventName = eventName; Arguments = arguments; } public override object AcceptVisitor(IAstVisitor visitor, object data) { return visitor.VisitRaiseEventStatement(this, data); } public override string ToString() { return string.Format("[RaiseEventStatement EventName={0} Arguments={1}]", EventName, GetCollectionString(Arguments)); } } public class ReDimStatement : Statement { List reDimClauses; bool isPreserve; public List ReDimClauses { get { return reDimClauses; } set { reDimClauses = value ?? new List(); } } public bool IsPreserve { get { return isPreserve; } set { isPreserve = value; } } public ReDimStatement(bool isPreserve) { IsPreserve = isPreserve; reDimClauses = new List(); } public override object AcceptVisitor(IAstVisitor visitor, object data) { return visitor.VisitReDimStatement(this, data); } public override string ToString() { return string.Format("[ReDimStatement ReDimClauses={0} IsPreserve={1}]", GetCollectionString(ReDimClauses), IsPreserve); } } public class RemoveHandlerStatement : Statement { Expression eventExpression; Expression handlerExpression; public Expression EventExpression { get { return eventExpression; } set { eventExpression = value ?? Expression.Null; if (!eventExpression.IsNull) eventExpression.Parent = this; } } public Expression HandlerExpression { get { return handlerExpression; } set { handlerExpression = value ?? Expression.Null; if (!handlerExpression.IsNull) handlerExpression.Parent = this; } } public RemoveHandlerStatement(Expression eventExpression, Expression handlerExpression) { EventExpression = eventExpression; HandlerExpression = handlerExpression; } public override object AcceptVisitor(IAstVisitor visitor, object data) { return visitor.VisitRemoveHandlerStatement(this, data); } public override string ToString() { return string.Format("[RemoveHandlerStatement EventExpression={0} HandlerExpression={1}]", EventExpression, HandlerExpression); } } public class ResumeStatement : Statement { string labelName; bool isResumeNext; public string LabelName { get { return labelName; } set { labelName = value ?? ""; } } public bool IsResumeNext { get { return isResumeNext; } set { isResumeNext = value; } } public ResumeStatement(bool isResumeNext) { IsResumeNext = isResumeNext; labelName = ""; } public ResumeStatement(string labelName) { LabelName = labelName; } public override object AcceptVisitor(IAstVisitor visitor, object data) { return visitor.VisitResumeStatement(this, data); } public override string ToString() { return string.Format("[ResumeStatement LabelName={0} IsResumeNext={1}]", LabelName, IsResumeNext); } } public class ReturnStatement : Statement { Expression expression; public Expression Expression { get { return expression; } set { expression = value ?? Expression.Null; if (!expression.IsNull) expression.Parent = this; } } public ReturnStatement(Expression expression) { Expression = expression; } public override object AcceptVisitor(IAstVisitor visitor, object data) { return visitor.VisitReturnStatement(this, data); } public override string ToString() { return string.Format("[ReturnStatement Expression={0}]", Expression); } } public class SizeOfExpression : Expression { TypeReference typeReference; public TypeReference TypeReference { get { return typeReference; } set { typeReference = value ?? TypeReference.Null; } } public SizeOfExpression(TypeReference typeReference) { TypeReference = typeReference; } public override object AcceptVisitor(IAstVisitor visitor, object data) { return visitor.VisitSizeOfExpression(this, data); } public override string ToString() { return string.Format("[SizeOfExpression TypeReference={0}]", TypeReference); } } public class StackAllocExpression : Expression { TypeReference typeReference; Expression expression; public TypeReference TypeReference { get { return typeReference; } set { typeReference = value ?? TypeReference.Null; } } public Expression Expression { get { return expression; } set { expression = value ?? Expression.Null; if (!expression.IsNull) expression.Parent = this; } } public StackAllocExpression(TypeReference typeReference, Expression expression) { TypeReference = typeReference; Expression = expression; } public override object AcceptVisitor(IAstVisitor visitor, object data) { return visitor.VisitStackAllocExpression(this, data); } public override string ToString() { return string.Format("[StackAllocExpression TypeReference={0} Expression={1}]", TypeReference, Expression); } } public class StopStatement : Statement { public StopStatement() { } public override object AcceptVisitor(IAstVisitor visitor, object data) { return visitor.VisitStopStatement(this, data); } public override string ToString() { return "[StopStatement]"; } } public class SwitchSection : BlockStatement { List switchLabels; public List SwitchLabels { get { return switchLabels; } set { switchLabels = value ?? new List(); } } public SwitchSection() { switchLabels = new List(); } public SwitchSection(List switchLabels) { SwitchLabels = switchLabels; } public override object AcceptVisitor(IAstVisitor visitor, object data) { return visitor.VisitSwitchSection(this, data); } public override string ToString() { return string.Format("[SwitchSection SwitchLabels={0}]", GetCollectionString(SwitchLabels)); } } public class SwitchStatement : Statement { Expression switchExpression; List switchSections; public Expression SwitchExpression { get { return switchExpression; } set { switchExpression = value ?? Expression.Null; if (!switchExpression.IsNull) switchExpression.Parent = this; } } public List SwitchSections { get { return switchSections; } set { switchSections = value ?? new List(); } } public SwitchStatement(Expression switchExpression, List switchSections) { SwitchExpression = switchExpression; SwitchSections = switchSections; } public override object AcceptVisitor(IAstVisitor visitor, object data) { return visitor.VisitSwitchStatement(this, data); } public override string ToString() { return string.Format("[SwitchStatement SwitchExpression={0} SwitchSections={1}]", SwitchExpression, GetCollectionString(SwitchSections)); } } public class TemplateDefinition : AttributedNode { string name; List bases; public string Name { get { return name; } set { name = string.IsNullOrEmpty(value) ? "?" : value; } } public List Bases { get { return bases; } set { bases = value ?? new List(); } } public TemplateDefinition(string name, List attributes) { Name = name; Attributes = attributes; bases = new List(); } public override object AcceptVisitor(IAstVisitor visitor, object data) { return visitor.VisitTemplateDefinition(this, data); } public override string ToString() { return string.Format("[TemplateDefinition Name={0} Bases={1} Attributes={2} Modifier={3}]", Name, GetCollectionString(Bases), GetCollectionString(Attributes), Modifier); } } public class ThisReferenceExpression : Expression { public ThisReferenceExpression() { } public override object AcceptVisitor(IAstVisitor visitor, object data) { return visitor.VisitThisReferenceExpression(this, data); } public override string ToString() { return "[ThisReferenceExpression]"; } } public class ThrowStatement : Statement { Expression expression; public Expression Expression { get { return expression; } set { expression = value ?? Expression.Null; if (!expression.IsNull) expression.Parent = this; } } public ThrowStatement(Expression expression) { Expression = expression; } public override object AcceptVisitor(IAstVisitor visitor, object data) { return visitor.VisitThrowStatement(this, data); } public override string ToString() { return string.Format("[ThrowStatement Expression={0}]", Expression); } } public class TryCatchStatement : Statement { Statement statementBlock; List catchClauses; Statement finallyBlock; public Statement StatementBlock { get { return statementBlock; } set { statementBlock = value ?? Statement.Null; if (!statementBlock.IsNull) statementBlock.Parent = this; } } public List CatchClauses { get { return catchClauses; } set { catchClauses = value ?? new List(); } } public Statement FinallyBlock { get { return finallyBlock; } set { finallyBlock = value ?? Statement.Null; if (!finallyBlock.IsNull) finallyBlock.Parent = this; } } public TryCatchStatement(Statement statementBlock, List catchClauses, Statement finallyBlock) { StatementBlock = statementBlock; CatchClauses = catchClauses; FinallyBlock = finallyBlock; } public override object AcceptVisitor(IAstVisitor visitor, object data) { return visitor.VisitTryCatchStatement(this, data); } public override string ToString() { return string.Format("[TryCatchStatement StatementBlock={0} CatchClauses={1} FinallyBlock={2}]", StatementBlock, GetCollectionString(CatchClauses), FinallyBlock); } } public class TypeDeclaration : AttributedNode { string name; ClassType type; List baseTypes; List templates; Location bodyStartLocation; public string Name { get { return name; } set { name = value ?? ""; } } public ClassType Type { get { return type; } set { type = value; } } public List BaseTypes { get { return baseTypes; } set { baseTypes = value ?? new List(); } } public List Templates { get { return templates; } set { templates = value ?? new List(); } } public Location BodyStartLocation { get { return bodyStartLocation; } set { bodyStartLocation = value; } } public TypeDeclaration(Modifiers modifier, List attributes) { Modifier = modifier; Attributes = attributes; name = ""; baseTypes = new List(); templates = new List(); bodyStartLocation = Location.Empty; } public override object AcceptVisitor(IAstVisitor visitor, object data) { return visitor.VisitTypeDeclaration(this, data); } public override string ToString() { return string.Format("[TypeDeclaration Name={0} Type={1} BaseTypes={2} Templates={3} BodyStartLocation=" + "{4} Attributes={5} Modifier={6}]", Name, Type, GetCollectionString(BaseTypes), GetCollectionString(Templates), BodyStartLocation, GetCollectionString(Attributes), Modifier); } } public class TypeOfExpression : Expression { TypeReference typeReference; public TypeReference TypeReference { get { return typeReference; } set { typeReference = value ?? TypeReference.Null; } } public TypeOfExpression(TypeReference typeReference) { TypeReference = typeReference; } public override object AcceptVisitor(IAstVisitor visitor, object data) { return visitor.VisitTypeOfExpression(this, data); } public override string ToString() { return string.Format("[TypeOfExpression TypeReference={0}]", TypeReference); } } public class TypeOfIsExpression : Expression { Expression expression; TypeReference typeReference; public Expression Expression { get { return expression; } set { expression = value ?? Expression.Null; if (!expression.IsNull) expression.Parent = this; } } public TypeReference TypeReference { get { return typeReference; } set { typeReference = value ?? TypeReference.Null; } } public TypeOfIsExpression(Expression expression, TypeReference typeReference) { Expression = expression; TypeReference = typeReference; } public override object AcceptVisitor(IAstVisitor visitor, object data) { return visitor.VisitTypeOfIsExpression(this, data); } public override string ToString() { return string.Format("[TypeOfIsExpression Expression={0} TypeReference={1}]", Expression, TypeReference); } } public class TypeReferenceExpression : Expression { TypeReference typeReference; public TypeReference TypeReference { get { return typeReference; } set { typeReference = value ?? TypeReference.Null; } } public TypeReferenceExpression(TypeReference typeReference) { TypeReference = typeReference; } public TypeReferenceExpression(string typeName) : this(new TypeReference(typeName)) {} public override object AcceptVisitor(IAstVisitor visitor, object data) { return visitor.VisitTypeReferenceExpression(this, data); } public override string ToString() { return string.Format("[TypeReferenceExpression TypeReference={0}]", TypeReference); } } public class UnaryOperatorExpression : Expression { UnaryOperatorType op; Expression expression; public UnaryOperatorType Op { get { return op; } set { op = value; } } public Expression Expression { get { return expression; } set { expression = value ?? Expression.Null; if (!expression.IsNull) expression.Parent = this; } } public UnaryOperatorExpression(UnaryOperatorType op) { Op = op; expression = Expression.Null; } public UnaryOperatorExpression(Expression expression, UnaryOperatorType op) { Expression = expression; Op = op; } public override object AcceptVisitor(IAstVisitor visitor, object data) { return visitor.VisitUnaryOperatorExpression(this, data); } public override string ToString() { return string.Format("[UnaryOperatorExpression Op={0} Expression={1}]", Op, Expression); } } public class UncheckedExpression : Expression { Expression expression; public Expression Expression { get { return expression; } set { expression = value ?? Expression.Null; if (!expression.IsNull) expression.Parent = this; } } public UncheckedExpression(Expression expression) { Expression = expression; } public override object AcceptVisitor(IAstVisitor visitor, object data) { return visitor.VisitUncheckedExpression(this, data); } public override string ToString() { return string.Format("[UncheckedExpression Expression={0}]", Expression); } } public class UncheckedStatement : Statement { Statement block; public Statement Block { get { return block; } set { block = value ?? Statement.Null; if (!block.IsNull) block.Parent = this; } } public UncheckedStatement(Statement block) { Block = block; } public override object AcceptVisitor(IAstVisitor visitor, object data) { return visitor.VisitUncheckedStatement(this, data); } public override string ToString() { return string.Format("[UncheckedStatement Block={0}]", Block); } } public class UnsafeStatement : Statement { Statement block; public Statement Block { get { return block; } set { block = value ?? Statement.Null; if (!block.IsNull) block.Parent = this; } } public UnsafeStatement(Statement block) { Block = block; } public override object AcceptVisitor(IAstVisitor visitor, object data) { return visitor.VisitUnsafeStatement(this, data); } public override string ToString() { return string.Format("[UnsafeStatement Block={0}]", Block); } } public class Using : AbstractNode { string name; TypeReference alias; public string Name { get { return name; } set { name = string.IsNullOrEmpty(value) ? "?" : value; } } public TypeReference Alias { get { return alias; } set { alias = value ?? TypeReference.Null; } } public Using(string name) { Name = name; alias = TypeReference.Null; } public Using(string name, TypeReference alias) { Name = name; Alias = alias; } public bool IsAlias { get { return !alias.IsNull; } } public override object AcceptVisitor(IAstVisitor visitor, object data) { return visitor.VisitUsing(this, data); } public override string ToString() { return string.Format("[Using Name={0} Alias={1}]", Name, Alias); } } public class UsingDeclaration : AbstractNode { List usings; public List Usings { get { return usings; } set { usings = value ?? new List(); } } public UsingDeclaration(List usings) { Usings = usings; } public UsingDeclaration(string @namespace, TypeReference alias) { usings = new List(1); usings.Add(new Using(@namespace, alias)); } public UsingDeclaration(string @namespace) : this(@namespace, null) {} public override object AcceptVisitor(IAstVisitor visitor, object data) { return visitor.VisitUsingDeclaration(this, data); } public override string ToString() { return string.Format("[UsingDeclaration Usings={0}]", GetCollectionString(Usings)); } } public class UsingStatement : StatementWithEmbeddedStatement { Statement resourceAcquisition; public Statement ResourceAcquisition { get { return resourceAcquisition; } set { resourceAcquisition = value ?? Statement.Null; if (!resourceAcquisition.IsNull) resourceAcquisition.Parent = this; } } public UsingStatement(Statement resourceAcquisition, Statement embeddedStatement) { ResourceAcquisition = resourceAcquisition; EmbeddedStatement = embeddedStatement; } public override object AcceptVisitor(IAstVisitor visitor, object data) { return visitor.VisitUsingStatement(this, data); } public override string ToString() { return string.Format("[UsingStatement ResourceAcquisition={0} EmbeddedStatement={1}]", ResourceAcquisition, EmbeddedStatement); } } public class VariableDeclaration : AbstractNode { string name; Expression initializer; TypeReference typeReference; Expression fixedArrayInitialization; public string Name { get { return name; } set { name = value ?? ""; } } public Expression Initializer { get { return initializer; } set { initializer = value ?? Expression.Null; if (!initializer.IsNull) initializer.Parent = this; } } public TypeReference TypeReference { get { return typeReference; } set { typeReference = value ?? TypeReference.Null; } } public Expression FixedArrayInitialization { get { return fixedArrayInitialization; } set { fixedArrayInitialization = value ?? Expression.Null; if (!fixedArrayInitialization.IsNull) fixedArrayInitialization.Parent = this; } } public VariableDeclaration(string name) { Name = name; initializer = Expression.Null; typeReference = TypeReference.Null; fixedArrayInitialization = Expression.Null; } public VariableDeclaration(string name, Expression initializer) { Name = name; Initializer = initializer; typeReference = TypeReference.Null; fixedArrayInitialization = Expression.Null; } public VariableDeclaration(string name, Expression initializer, TypeReference typeReference) { Name = name; Initializer = initializer; TypeReference = typeReference; fixedArrayInitialization = Expression.Null; } public override object AcceptVisitor(IAstVisitor visitor, object data) { return visitor.VisitVariableDeclaration(this, data); } public override string ToString() { return string.Format("[VariableDeclaration Name={0} Initializer={1} TypeReference={2} FixedArrayInitial" + "ization={3}]", Name, Initializer, TypeReference, FixedArrayInitialization); } } public class WithStatement : Statement { Expression expression; BlockStatement body; public Expression Expression { get { return expression; } set { expression = value ?? Expression.Null; if (!expression.IsNull) expression.Parent = this; } } public BlockStatement Body { get { return body; } set { body = value ?? BlockStatement.Null; if (!body.IsNull) body.Parent = this; } } public WithStatement(Expression expression) { Expression = expression; body = BlockStatement.Null; } public override object AcceptVisitor(IAstVisitor visitor, object data) { return visitor.VisitWithStatement(this, data); } public override string ToString() { return string.Format("[WithStatement Expression={0} Body={1}]", Expression, Body); } } public class YieldStatement : Statement { Statement statement; public Statement Statement { get { return statement; } set { statement = value ?? Statement.Null; if (!statement.IsNull) statement.Parent = this; } } public YieldStatement(Statement statement) { Statement = statement; } public bool IsYieldBreak { get { return statement is BreakStatement; } } public bool IsYieldReturn { get { return statement is ReturnStatement; } } public override object AcceptVisitor(IAstVisitor visitor, object data) { return visitor.VisitYieldStatement(this, data); } public override string ToString() { return string.Format("[YieldStatement Statement={0}]", Statement); } } }