public ValueAssignEx(Position position, Operations operation, VariableUse/*!*/ lvalue, Expression/*!*/ rvalue) : base(position) { this.lvalue = lvalue; this.rvalue = rvalue; this.operation = operation; }
internal override Evaluation Analyze(Analyzer/*!*/ analyzer, ExInfoFromParent info) { access = info.Access; Evaluation cond_eval = condExpr.Analyze(analyzer, ExInfoFromParent.DefaultExInfo); if (cond_eval.HasValue) { if (Convert.ObjectToBoolean(cond_eval.Value)) { if (trueExpr != null) return trueExpr.Analyze(analyzer, ExInfoFromParent.DefaultExInfo); else return cond_eval; // condExpr ?: falseExpr // ternary shortcut } else return falseExpr.Analyze(analyzer, ExInfoFromParent.DefaultExInfo); } else { if (trueExpr != null) { analyzer.EnterConditionalCode(); trueExpr = trueExpr.Analyze(analyzer, ExInfoFromParent.DefaultExInfo).Literalize(); analyzer.LeaveConditionalCode(); } analyzer.EnterConditionalCode(); falseExpr = falseExpr.Analyze(analyzer, ExInfoFromParent.DefaultExInfo).Literalize(); analyzer.LeaveConditionalCode(); return new Evaluation(this); } }
public RefAssignEx(Text.Span span, VariableUse/*!*/ lvalue, Expression/*!*/ rvalue) : base(span) { Debug.Assert(rvalue is VarLikeConstructUse || rvalue is NewEx); this.lvalue = lvalue; this.rvalue = rvalue; }
public UnaryEx(Position position, Operations operation, Expression/*!*/ expr) : base(position) { Debug.Assert(expr != null); this.operation = operation; this.expr = expr; }
public ActualParam(Position p, Expression param, bool ampersand) : base(p) { Debug.Assert(param != null); this.expression = param; this.ampersand = ampersand; }
public ActualParam(Text.Span p, Expression param, Flags flags) : base(p) { Debug.Assert(param != null); _expression = param; _flags = flags; }
public ValueAssignEx(Text.Span span, Operations operation, VariableUse/*!*/ lvalue, Expression/*!*/ rvalue) : base(span) { this.lvalue = lvalue; this.rvalue = rvalue; this.operation = operation; }
public InstanceOfEx(Text.Span span, Expression/*!*/ expression, TypeRef/*!*/ classNameRef) : base(span) { Debug.Assert(expression != null && classNameRef != null); this.expression = expression; this.classNameRef = classNameRef; }
public SwitchStmt(Text.Span span, Expression/*!*/ switchValue, List<SwitchItem>/*!*/ switchItems) : base(span) { Debug.Assert(switchValue != null && switchItems != null); this.switchValue = switchValue; this.switchItems = switchItems; }
public BinaryEx(Position position, Operations operation, Expression/*!*/ leftExpr, Expression/*!*/ rightExpr) : base(position) { Debug.Assert(leftExpr != null && rightExpr != null); this.operation = operation; this.leftExpr = leftExpr; this.rightExpr = rightExpr; }
public InstanceOfEx(Position position, Expression/*!*/ expression, TypeRef/*!*/ classNameRef) : base(position) { Debug.Assert(expression != null && classNameRef != null); this.expression = expression; this.classNameRef = classNameRef; }
/// <summary> /// Initializes new instance of <see cref="YieldEx"/>. /// </summary> public YieldEx(Position position, Expression keyEx, Expression valueEx) : base(position) { if (keyEx != null && valueEx == null) throw new ArgumentException(); _keyEx = keyEx; _valueEx = valueEx; }
public ItemUse(Position p, VariableUse/*!*/ array, Expression index) : base(p) { Debug.Assert(array != null); this.array = array; this.index = index; }
public SwitchStmt(Position position, Expression/*!*/ switchValue, List<SwitchItem>/*!*/ switchItems) : base(position) { Debug.Assert(switchValue != null && switchItems != null); this.switchValue = switchValue; this.switchItems = switchItems; }
/// <summary> /// Initializes new instance of <see cref="YieldEx"/>. /// </summary> public YieldEx(Text.Span span, Expression keyEx, Expression valueEx) : base(span) { if (keyEx != null && valueEx == null) throw new ArgumentException(); _keyEx = keyEx; _valueEx = valueEx; }
public ItemUse(Position p, VarLikeConstructUse/*!*/ array, Expression index, bool functionArrayDereferencing = false) : base(p) { Debug.Assert(array != null); this.array = array; this.index = index; this.functionArrayDereferencing = functionArrayDereferencing; }
public ShellEx(Position position, Expression/*!*/ command) : base(position) { #if SILVERLIGHT // SILVERLIGHT: Handle this in the parser! throw new NotSupportedException("ShellEx not supported on Silverlight!"); #endif Debug.Assert(command is StringLiteral || command is ConcatEx || command is BinaryStringLiteral); this.command = command; }
public ConditionalEx(Text.Span span, Expression/*!*/ condExpr, Expression trueExpr, Expression/*!*/ falseExpr) : base(span) { Debug.Assert(condExpr != null); // Debug.Assert(trueExpr != null); // allowed to enable ternary shortcut Debug.Assert(falseExpr != null); this.condExpr = condExpr; this.trueExpr = trueExpr; this.falseExpr = falseExpr; }
public IncludingEx(SourceUnit/*!*/ sourceUnit, Scope scope, bool isConditional, Text.Span span, InclusionTypes inclusionType, Expression/*!*/ fileName) : base(span) { Debug.Assert(fileName != null); this.inclusionType = inclusionType; this.fileNameEx = fileName; this.scope = scope; this.isConditional = isConditional; this.sourceUnit = sourceUnit; }
public FormalParam(Position position, string/*!*/ name, object typeHint, bool passedByRef, Expression initValue, List<CustomAttribute> attributes) : base(position) { this.name = new VariableName(name); this.typeHint = typeHint; this.passedByRef = passedByRef; this.initValue = initValue; this.attributes = new CustomAttributes(attributes); this.resolvedTypeHint = null; }
public ListEx(Position p, List<Expression>/*!*/ lvalues, Expression rvalue) : base(p) { Debug.Assert(lvalues != null /*&& rvalue != null*/); // rvalue can be determined during runtime in case of list in list. Debug.Assert(lvalues.TrueForAll(delegate(Expression lvalue) { return lvalue == null || lvalue is VarLikeConstructUse || lvalue is ListEx; })); this.LValues = lvalues; this.RValue = rvalue; }
public IndirectVarUse(Text.Span span, int levelOfIndirection, Expression varNameEx) : base(span) { Debug.Assert(levelOfIndirection > 0 && varNameEx != null); if (levelOfIndirection == 1) { this.varNameEx = varNameEx; } else { Text.Span varspan = new Text.Span(span.Start + 1, span.Length - 1); this.varNameEx = new IndirectVarUse(varspan, --levelOfIndirection, varNameEx); } }
public FormalParam(Text.Span span, string/*!*/ name, object typeHint, bool passedByRef, Expression initValue, List<CustomAttribute> attributes) : base(span) { Debug.Assert(typeHint == null || typeHint is PrimitiveTypeName || typeHint is GenericQualifiedName); this.name = new VariableName(name); this.typeHint = typeHint; this.passedByRef = passedByRef; this.initValue = initValue; if (attributes != null && attributes.Count != 0) this.Attributes = new CustomAttributes(attributes); this.TypeHintPosition = Text.Span.Invalid; }
public IndirectVarUse(Position position, int levelOfIndirection, Expression varNameEx) : base(position) { Debug.Assert(levelOfIndirection > 0 && varNameEx != null); if (levelOfIndirection == 1) { this.varNameEx = varNameEx; } else { Position pos = position; pos.FirstColumn++; this.varNameEx = new IndirectVarUse(pos, --levelOfIndirection, varNameEx); } }
/// <include file='Doc/Nodes.xml' path='doc/method[@name="Expression.Analyze"]/*'/> internal override Evaluation Analyze(Analyzer/*!*/ analyzer, ExInfoFromParent info) { access = info.Access; switch (operation) { case Operations.Print: case Operations.Clone: case Operations.ObjectCast: case Operations.ArrayCast: expr = expr.Analyze(analyzer, ExInfoFromParent.DefaultExInfo).Literalize(); return new Evaluation(this); default: return expr.Analyze(analyzer, ExInfoFromParent.DefaultExInfo).Evaluate(this, out expr); } }
/// <include file='Doc/Nodes.xml' path='doc/method[@name="Statement.Analyze"]/*'/> internal override Statement Analyze(Analyzer/*!*/ analyzer) { if (analyzer.IsThisCodeUnreachable()) { analyzer.ReportUnreachableCode(position); return EmptyStmt.Unreachable; } switchValue = switchValue.Analyze(analyzer, ExInfoFromParent.DefaultExInfo).Literalize(); analyzer.EnterSwitchBody(); foreach (SwitchItem item in switchItems) item.Analyze(analyzer); analyzer.LeaveSwitchBody(); return this; }
internal override Evaluation Analyze(Analyzer/*!*/ analyzer, ExInfoFromParent info) { access = info.Access; ExInfoFromParent sinfo = new ExInfoFromParent(this); // r-value if (RValue != null) RValue = RValue.Analyze(analyzer, sinfo).Literalize(); // l-values sinfo.Access = AccessType.Write; for (int i = 0; i < LValues.Count; i++) { if (LValues[i] != null) LValues[i] = LValues[i].Analyze(analyzer, sinfo).Expression; } return new Evaluation(this); }
/// <include file='Doc/Nodes.xml' path='doc/method[@name="Expression.Analyze"]/*'/> internal override Evaluation Analyze(Analyzer/*!*/ analyzer, ExInfoFromParent info) { access = info.Access; base.Analyze(analyzer, info); if (isMemberOf == null) { if (!(access == AccessType.Read || access == AccessType.Write || access == AccessType.ReadAndWrite || access == AccessType.None)) { analyzer.CurrentVarTable.SetAllRef(); } analyzer.AddCurrentRoutineProperty(RoutineProperties.IndirectLocalAccess); } varNameEx = varNameEx.Analyze(analyzer, ExInfoFromParent.DefaultExInfo).Literalize(); return new Evaluation(this); }
/// <include file='Doc/Nodes.xml' path='doc/method[@name="Statement.Analyze"]/*'/> internal override Statement/*!*/ Analyze(Analyzer/*!*/ analyzer) { if (analyzer.IsThisCodeUnreachable()) { analyzer.ReportUnreachableCode(position); return EmptyStmt.Unreachable; } if (expr != null) { ExInfoFromParent sinfo = ExInfoFromParent.DefaultExInfo; if (type == Types.Return && analyzer.CurrentRoutine != null && analyzer.CurrentRoutine.Signature.AliasReturn && expr is VarLikeConstructUse) { sinfo.Access = AccessType.ReadRef; } expr = expr.Analyze(analyzer, sinfo).Literalize(); if (type != Types.Return && expr.HasValue) { int level = Convert.ObjectToInteger(expr.Value); if (level > analyzer.LoopNestingLevel || level < 0) { analyzer.ErrorSink.Add(Errors.InvalidBreakLevelCount, analyzer.SourceUnit, position, level); } } } else if (type != Types.Return && analyzer.LoopNestingLevel == 0) { analyzer.ErrorSink.Add(Errors.InvalidBreakLevelCount, analyzer.SourceUnit, position, 1); } // code in the same block after return, break, continue is unreachable analyzer.EnterUnreachableCode(); return this; }
internal virtual void Analyze(Analyzer/*!*/ analyzer) { if (!this.analyzed && Constant != null) // J: Constant can be null, if there was an error { Evaluation eval = initializer.Analyze(analyzer, ExInfoFromParent.DefaultExInfo); if (eval.HasValue) { Constant.SetValue(eval.Value); } else { this.initializer = eval.Expression; Constant.SetNode(this); } this.analyzed = true; } }