public override void VisitAsExpression (AsExpression asExpression) { base.VisitAsExpression (asExpression); CheckTypeCast (asExpression, asExpression.Expression, asExpression.Expression.EndLocation, asExpression.EndLocation); }
public override void VisitAsExpression (AsExpression asExpression) { base.VisitAsExpression (asExpression); VisitTypeCastExpression (asExpression, ctx.Resolve (asExpression.Expression).Type, ctx.ResolveType (asExpression.Type)); }
public override void VisitAsExpression(AsExpression asExpression) { if (InsertParenthesesForReadability) { // few people know the precedence of 'as', so always put parentheses in nice-looking mode. ParenthesizeIfRequired(asExpression.Expression, Primary); } else { ParenthesizeIfRequired(asExpression.Expression, RelationalAndTypeTesting); } base.VisitAsExpression(asExpression); }
public override void VisitAsExpression(AsExpression asExpression) { HandleExpressionNode(asExpression); }
public override object Visit (As asExpression) { var result = new AsExpression (); result.AddChild ((INode)asExpression.Expr.Accept (this), AsExpression.Roles.Expression); result.AddChild (new CSharpTokenNode (Convert (asExpression.Location), "as".Length), AsExpression.Roles.Keyword); result.AddChild ((INode)asExpression.ProbeType.Accept (this), AsExpression.Roles.ReturnType); return result; }
public override object Visit(As asExpression) { var result = new AsExpression(); if (asExpression.Expr != null) result.AddChild((Expression)asExpression.Expr.Accept(this), Roles.Expression); result.AddChild(new CSharpTokenNode(Convert(asExpression.Location), AsExpression.AsKeywordRole), AsExpression.AsKeywordRole); if (asExpression.ProbeType != null) result.AddChild(ConvertToType(asExpression.ProbeType), Roles.Type); return result; }
/// <summary> /// Reads an as expression. /// </summary> /// <param name="leftHandSide">The expression on the left hand side of the operator.</param> /// <param name="previousPrecedence">The precedence of the expression just before this one.</param> /// <param name="unsafeCode">Indicates whether the code being parsed resides in an unsafe code block.</param> /// <returns>Returns the expression.</returns> private AsExpression GetAsExpression( Expression leftHandSide, ExpressionPrecedence previousPrecedence, bool unsafeCode) { Param.AssertNotNull(leftHandSide, "leftHandSide"); Param.Ignore(previousPrecedence); Param.Ignore(unsafeCode); AsExpression expression = null; // Check the previous precedence to see if we are allowed to gather up the as expression. if (this.CheckPrecedence(previousPrecedence, ExpressionPrecedence.Relational)) { // Make sure the left hand side has at least one token. Debug.Assert(leftHandSide.Tokens.First != null, "The left hand side should not be empty"); // Get the as symbol. this.tokens.Add(this.GetToken(CsTokenType.As, SymbolType.As)); // The next token must be the type. this.GetNextSymbol(SymbolType.Other); // Get the expression representing the type. LiteralExpression rightHandSide = this.GetTypeTokenExpression(unsafeCode, true, true); if (rightHandSide == null || rightHandSide.Tokens.First == null) { throw this.CreateSyntaxException(); } // Create the partial token list for the expression. CsTokenList partialTokens = new CsTokenList(this.tokens, leftHandSide.Tokens.First, this.tokens.Last); // Create and return the expression. expression = new AsExpression(partialTokens, leftHandSide, rightHandSide); } return expression; }
public CastBlock(IEmitter emitter, AsExpression asExpression) : base(emitter, asExpression) { this.Emitter = emitter; this.AsExpression = asExpression; }
public override object VisitAsExpression(AsExpression asExpression, object data) { UnlockWith(asExpression); return base.VisitAsExpression(asExpression, data); }
public RedILNode VisitAsExpression(AsExpression asExpression, State data) { // We only support casting into primitives for now return(asExpression.Expression.AcceptVisitor(this, data.NewState(asExpression, null))); }
protected internal override bool DoMatch(AstNode other, PatternMatching.Match match) { AsExpression o = other as AsExpression; return(o != null && this.Expression.DoMatch(o.Expression, match) && this.Type.DoMatch(o.Type, match)); }
public override void VisitAsExpression(AsExpression asExpression) { new CastBlock(this, asExpression).Emit(); }
public virtual Node VisitAsExpression(AsExpression asExpression) { throw new System.NotImplementedException(); }
public override void VisitAsExpression(AsExpression asExpression) { asExpression.Expression.AcceptVisitor(this); }
internal AstNode EmitAsExpression(AsExpression asExpression, ILGenerator ilGenerator) { return(new AsExpressionEmitter(asExpression, ilGenerator, _instructionIndexer, _visitor).Emit()); }
public override object VisitAsExpression(AsExpression asExpression, object data) { UnlockWith(asExpression); return(base.VisitAsExpression(asExpression, data)); }
public StringBuilder VisitAsExpression(AsExpression asExpression, int data) { throw new ASLException("ASL does not have reflection-supported casts."); }
public void VisitAsExpression(AsExpression asExpression) { StartNode(asExpression); LPar (); LPar (); asExpression.Expression.AcceptVisitor(this); Space(); WriteKeyword("instanceof", AsExpression.AsKeywordRole); Space(); asExpression.Type.AcceptVisitor(this); EndNode(asExpression); RPar (); WriteToken ("?<", Roles.Expression); asExpression.Type.AcceptVisitor(this); WriteToken (">", Roles.Expression); asExpression.Expression.AcceptVisitor(this); WriteToken (":null", Roles.Expression); RPar (); }
public StringBuilder VisitAsExpression(AsExpression asExpression, int data) { throw new SLSharpException("SL# does not have reflection-supported casts."); }
public void VisitAsExpression(AsExpression asExpression) { throw new NotImplementedException(); }
public virtual void VisitAsExpression(AsExpression asExpression) { if (this.ThrowException) { throw (Exception)this.CreateException(asExpression); } }
public void VisitAsExpression(AsExpression node) { NotSupported(node); }
public virtual void VisitAsExpression (AsExpression asExpression) { VisitChildren (asExpression); }
public void VisitAsExpression(AsExpression asExpression) { JsonObject expression = CreateJsonExpression(asExpression); AddKeyword(expression, AsExpression.AsKeywordRole); expression.AddJsonValue("type-info", GenTypeInfo(asExpression.Type)); Push(expression); }
public void VisitAsExpression(AsExpression asExpression) { StartNode(asExpression); asExpression.Expression.AcceptVisitor(this); Space(); WriteKeyword(AsExpression.AsKeywordRole); Space(); asExpression.Type.AcceptVisitor(this); EndNode(asExpression); }
public JsNode VisitAsExpression(AsExpression node) { return(Visit(node.Resolve())); }