本文整理汇总了C#中AsExpression类的典型用法代码示例。如果您正苦于以下问题:C# AsExpression类的具体用法?C# AsExpression怎么用?C# AsExpression使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
AsExpression类属于命名空间,在下文中一共展示了AsExpression类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: VisitAsExpression
public override void VisitAsExpression (AsExpression asExpression)
{
base.VisitAsExpression (asExpression);
VisitTypeCastExpression (asExpression, ctx.Resolve (asExpression.Expression).Type,
ctx.ResolveType (asExpression.Type));
}
示例2: VisitAsExpression
public override void VisitAsExpression (AsExpression asExpression)
{
base.VisitAsExpression (asExpression);
CheckTypeCast (asExpression, asExpression.Expression, asExpression.Expression.EndLocation,
asExpression.EndLocation);
}
示例3: VisitAsExpression
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);
}
示例4: VisitAsExpression
public void VisitAsExpression(AsExpression asExpression)
{
StartNode(asExpression);
asExpression.Expression.AcceptVisitor(this);
Space();
WriteKeyword(AsExpression.AsKeywordRole);
Space();
asExpression.Type.AcceptVisitor(this);
EndNode(asExpression);
}
示例5: Visit
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;
}
示例6: VisitAsExpression
public virtual void VisitAsExpression (AsExpression asExpression)
{
VisitChildren (asExpression);
}
示例7: Visit
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;
}
示例8: VisitAsExpression
public virtual void VisitAsExpression(AsExpression asExpression)
{
if (this.ThrowException)
{
throw (Exception)this.CreateException(asExpression);
}
}
示例9: GetAsExpression
/// <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;
}
示例10: VisitAsExpression
public StringBuilder VisitAsExpression(AsExpression asExpression, int data)
{
throw new SLSharpException("SL# does not have reflection-supported casts.");
}
示例11: CastBlock
public CastBlock(IEmitter emitter, AsExpression asExpression)
: base(emitter, asExpression)
{
this.Emitter = emitter;
this.AsExpression = asExpression;
}
示例12: VisitAsExpression
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 ();
}
示例13: VisitAsExpression
public override void VisitAsExpression(AsExpression asExpression)
{
new CastBlock(this, asExpression).Emit();
}
示例14: VisitAsExpression
public void VisitAsExpression(AsExpression asExpression)
{
JsonObject expression = CreateJsonExpression(asExpression);
AddKeyword(expression, AsExpression.AsKeywordRole);
expression.AddJsonValue("type-info", GenTypeInfo(asExpression.Type));
Push(expression);
}
示例15: VisitAsExpression
public void VisitAsExpression(AsExpression node)
{
NotSupported(node);
}