public IndexerExpression(Expression objectReference, IndexerSymbol indexer) : base(ExpressionType.Indexer, indexer.AssociatedType, SymbolFilter.Public | SymbolFilter.InstanceMembers) { _indexer = indexer; _objectReference = objectReference; _indices = new Collection<Expression>(); }
public ConditionalExpression(Expression condition, Expression trueValue, Expression falseValue) : base(ExpressionType.Conditional, trueValue.EvaluatedType, trueValue.MemberMask) { _condition = condition; _trueValue = trueValue; _falseValue = falseValue; }
public MemberExpression(Expression objectReference, MemberSymbol member) : base(ExpressionType.Member, (member.AssociatedType.Type == SymbolType.GenericParameter ? objectReference.EvaluatedType : member.AssociatedType), SymbolFilter.Public | SymbolFilter.InstanceMembers) { _member = member; _objectReference = objectReference; }
public NewDelegateExpression(Expression typeExpression, TypeSymbol associatedType) : base(ExpressionType.NewDelegate, associatedType, SymbolFilter.Public | SymbolFilter.InstanceMembers) { Debug.Assert(associatedType.Type == SymbolType.Delegate); _typeExpression = typeExpression; _associatedType = associatedType; }
public BinaryExpression(Operator operatorType, Expression leftOperand, Expression rightOperand, TypeSymbol evaluatedType) : base(ExpressionType.Binary, evaluatedType, SymbolFilter.Public | SymbolFilter.InstanceMembers) { _operator = operatorType; _leftOperand = leftOperand; _rightOperand = rightOperand; }
protected MethodExpression(ExpressionType type, Expression objectReference, MethodSymbol method, Collection<Expression> parameters) : base(type, (method.AssociatedType.Type == SymbolType.GenericParameter ? objectReference.EvaluatedType : method.AssociatedType), SymbolFilter.Public | SymbolFilter.InstanceMembers) { _method = method; _objectReference = objectReference; _parameters = (parameters == null) ? new Collection<Expression>() : parameters; }
public void SetHandler(Expression handler) { Debug.Assert(handler != null); Debug.Assert(_handler == null); _handler = handler; }
public void AddCase(Expression caseValue) { if (_cases == null) { _cases = new List<Expression>(); } _cases.Add(caseValue); }
public void AddParameterValue(Expression expression) { if (_parameters == null) { _parameters = new Collection<Expression>(); } _parameters.Add(expression); }
public WhileStatement(Expression condition, Statement body, bool preCondition) : base(StatementType.While) { _condition = condition; _body = body; _preCondition = preCondition; }
public IfElseStatement(Expression condition, Statement ifStatement, Statement elseStatement) : base(StatementType.IfElse) { _condition = condition; _ifStatement = ifStatement; _elseStatement = elseStatement; }
public LateBoundExpression(Expression objectReference, Expression nameExpression, LateBoundOperation operation, TypeSymbol evaluatedType) : base(ExpressionType.LateBound, evaluatedType, SymbolFilter.Public | SymbolFilter.InstanceMembers) { _objectReference = objectReference; _nameExpression = nameExpression; _operation = operation; _parameters = new Collection<Expression>(); }
public ThrowStatement(Expression value) : base(StatementType.Throw) { _value = value; }
public PropertyExpression(Expression objectReference, PropertySymbol property, bool getter) : base((getter ? ExpressionType.PropertyGet : ExpressionType.PropertySet), property.AssociatedType, SymbolFilter.Public | SymbolFilter.InstanceMembers) { _property = property; _objectReference = objectReference; }
public NewExpression(Expression typeExpression, TypeSymbol associatedType) : base(ExpressionType.New, associatedType, SymbolFilter.Public | SymbolFilter.InstanceMembers) { _typeExpression = typeExpression; _associatedType = associatedType; }
public ExpressionStatement(Expression expression, bool isFragment) : base(StatementType.Expression) { _expression = expression; _fragment = isFragment; }
public UnaryExpression(Operator operatorType, Expression operand) : this(operatorType, operand, operand.EvaluatedType, operand.MemberMask) { }
public MethodExpression(Expression objectReference, MethodSymbol method) : this(ExpressionType.MethodInvoke, objectReference, method, null) { }
public void AddParameterValue(Expression expression) { _parameters.Add(expression); }
public SwitchStatement(Expression condition) : base(StatementType.Switch) { _condition = condition; _groups = new List<SwitchGroup>(); }
public EnumerationFieldExpression(Expression objectReference, EnumerationFieldSymbol field) : base(ExpressionType.EnumerationField, objectReference, field) { }
public UnaryExpression(Operator operatorType, Expression operand, TypeSymbol evaluatedType, SymbolFilter memberMask) : base(ExpressionType.Unary, evaluatedType, memberMask) { _operator = operatorType; _operand = operand; }
public void SetValue(Expression value) { _value = value; }
public ExpressionStatement(Expression expression) : this(expression, false) { }
public void AddCondition(Expression expression) { Debug.Assert(_condition == null); _condition = expression; }
private Expression ProcessArrayNewNode(ArrayNewNode node) { TypeSymbol itemTypeSymbol = _symbolSet.ResolveType(node.TypeReference, _symbolTable, _symbolContext); Debug.Assert(itemTypeSymbol != null); TypeSymbol arrayTypeSymbol = _symbolSet.CreateArrayTypeSymbol(itemTypeSymbol); if (node.InitializerExpression == null) { if (node.ExpressionList == null) { return new LiteralExpression(arrayTypeSymbol, new Expression[0]); } else { Debug.Assert(node.ExpressionList.NodeType == ParseNodeType.ExpressionList); ExpressionListNode argsList = (ExpressionListNode)node.ExpressionList; Debug.Assert(argsList.Expressions.Count == 1); Expression sizeExpression = BuildExpression(argsList.Expressions[0]); if (sizeExpression is MemberExpression) { sizeExpression = TransformMemberExpression((MemberExpression)sizeExpression); } NewExpression newExpr = new NewExpression(arrayTypeSymbol); newExpr.AddParameterValue(sizeExpression); return newExpr; } } else { ArrayInitializerNode initializerNode = (ArrayInitializerNode)node.InitializerExpression; Expression[] values = new Expression[initializerNode.Values.Count]; int i = 0; foreach (ParseNode valueNode in initializerNode.Values) { values[i] = BuildExpression(valueNode); if (values[i] is MemberExpression) { values[i] = TransformMemberExpression((MemberExpression)values[i]); } i++; } return new LiteralExpression(arrayTypeSymbol, values); } }
public static void GenerateExpression(ScriptGenerator generator, MemberSymbol symbol, Expression expression) { ScriptTextWriter writer = generator.Writer; if (expression.Parenthesized) { writer.Write("("); } switch (expression.Type) { case ExpressionType.Literal: GenerateLiteralExpression(generator, symbol, (LiteralExpression)expression); break; case ExpressionType.Local: GenerateLocalExpression(generator, symbol, (LocalExpression)expression); break; case ExpressionType.Member: Debug.Fail("MemberExpression missed from conversion to higher level expression."); break; case ExpressionType.Field: GenerateFieldExpression(generator, symbol, (FieldExpression)expression); break; case ExpressionType.EnumerationField: GenerateEnumerationFieldExpression(generator, symbol, (EnumerationFieldExpression)expression); break; case ExpressionType.PropertyGet: GeneratePropertyExpression(generator, symbol, (PropertyExpression)expression); break; case ExpressionType.PropertySet: Debug.Fail("PropertyExpression(set) should be covered as part of BinaryExpression logic."); break; case ExpressionType.MethodInvoke: case ExpressionType.DelegateInvoke: GenerateMethodExpression(generator, symbol, (MethodExpression)expression); break; case ExpressionType.BaseInitializer: GenerateBaseInitializerExpression(generator, symbol, (BaseInitializerExpression)expression); break; case ExpressionType.EventAdd: case ExpressionType.EventRemove: GenerateEventExpression(generator, symbol, (EventExpression)expression); break; case ExpressionType.Indexer: GenerateIndexerExpression(generator, symbol, (IndexerExpression)expression); break; case ExpressionType.This: GenerateThisExpression(generator, symbol, (ThisExpression)expression); break; case ExpressionType.Base: Debug.Fail("BaseExpression not handled by container expression."); break; case ExpressionType.New: GenerateNewExpression(generator, symbol, (NewExpression)expression); break; case ExpressionType.Unary: GenerateUnaryExpression(generator, symbol, (UnaryExpression)expression); break; case ExpressionType.Binary: GenerateBinaryExpression(generator, symbol, (BinaryExpression)expression); break; case ExpressionType.Conditional: GenerateConditionalExpression(generator, symbol, (ConditionalExpression)expression); break; case ExpressionType.Type: GenerateTypeExpression(generator, symbol, (TypeExpression)expression); break; case ExpressionType.Delegate: GenerateDelegateExpression(generator, symbol, (DelegateExpression)expression); break; case ExpressionType.LateBound: GenerateLateBoundExpression(generator, symbol, (LateBoundExpression)expression); break; case ExpressionType.InlineScript: GenerateInlineScriptExpression(generator, symbol, (InlineScriptExpression)expression); break; default: Debug.Fail("Unexpected expression type: " + expression.Type); break; } if (expression.Parenthesized) { writer.Write(")"); } }
public void AddIncrement(Expression expression) { if (_increments == null) { _increments = new List<Expression>(); } _increments.Add(expression); }
public DelegateExpression(Expression objectReference, MethodSymbol method) : base(ExpressionType.Delegate, method.AssociatedType, SymbolFilter.Public | SymbolFilter.InstanceMembers) { _method = method; _objectReference = objectReference; }
public void AddInitializer(Expression expression) { Debug.Assert(_variables == null); if (_initializers == null) { _initializers = new List<Expression>(); } _initializers.Add(expression); }