本文整理汇总了C#中Microsoft.JScript.AST.GetType方法的典型用法代码示例。如果您正苦于以下问题:C# AST.GetType方法的具体用法?C# AST.GetType怎么用?C# AST.GetType使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Microsoft.JScript.AST
的用法示例。
在下文中一共展示了AST.GetType方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: IsLoop
bool IsLoop (AST ast)
{
Type t = ast.GetType ();
return t == typeof (For) || t == typeof (While) || t == typeof (DoWhile) || t == typeof (ForIn);
}
示例2: fall_true
internal static void fall_true(EmitContext ec, AST ast, Label lbl)
{
Type type = ast.GetType ();
if (type == typeof (Expression)) {
Expression exp = ast as Expression;
AST last_exp = (AST) exp.exprs [exp.exprs.Count - 1];
if (exp.exprs.Count >= 2)
exp.Emit (ec);
fall_true (ec, last_exp, lbl);
} else if (type == typeof (Binary))
ft_binary_recursion (ec, ast, lbl);
else if (type == typeof (Equality) || type == typeof (StrictEquality))
ft_emit_equality (ec, ast, lbl);
else if (type == typeof (Relational))
ft_emit_relational (ec, (Relational) ast, lbl);
else
emit_default_case (ec, ast, OpCodes.Brfalse, lbl);
}
示例3: IsLiteral
internal static Type IsLiteral (AST ast)
{
if (ast != null) {
Type type = ast.GetType ();
// FIXME: Add test for other literals (exclude StringLiteral)
if (type == typeof (ArrayLiteral))
return type;
}
return null;
}
示例4: fall_false
internal static void fall_false(EmitContext ec, AST ast, Label lbl)
{
Type type = ast.GetType ();
if (type == typeof (Expression)) {
Expression exp = ast as Expression;
if (exp.Size > 1)
exp.Emit (ec);
AST last_exp = (AST) exp.exprs [exp.exprs.Count - 1];
if (last_exp is Relational)
ff_emit_relational (ec, last_exp, lbl);
else if (last_exp is Binary)
ff_binary_recursion (ec, last_exp, lbl);
else if (last_exp is Identifier || last_exp is BooleanConstant)
emit_default_case (ec, last_exp, OpCodes.Brtrue, lbl);
else if (last_exp is Equality)
ff_emit_equality_cond (ec, last_exp, lbl);
else {
Console.WriteLine ("WARNING: fall_false, last_exp.GetType () == {0}, {1}", last_exp, ast.Location.LineNumber);
}
} else if (type == typeof (Binary))
ff_binary_recursion (ec, ast, lbl);
else if (type == typeof (Relational))
ff_emit_relational (ec, ast, lbl);
else
emit_default_case (ec, ast, OpCodes.Brtrue, lbl);
}