本文整理汇总了C#中JsExpression.Compact方法的典型用法代码示例。如果您正苦于以下问题:C# JsExpression.Compact方法的具体用法?C# JsExpression.Compact怎么用?C# JsExpression.Compact使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类JsExpression
的用法示例。
在下文中一共展示了JsExpression.Compact方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: TryUnwrapJsniExpression
//.........这里部分代码省略.........
{
case "function":
lambdaStatement = ((JsExpression)lambdaNode).Return();
break;
default:
lambdaStatement = ((JsExpression)lambdaNode).Express();
break;
}
}
else
{
lambdaStatement = (JsStatement)lambdaNode;
}
result = Js.Function(jsParameters).Body(lambdaStatement);
transformer.PopOutput();
return true;
case "arguments":
result = Js.Reference("arguments");
return true;
case "this":
case "@this":
result = Js.This();
return true;
case "delete":
var deleteTarget = arguments[0];
result = deleteTarget.Delete();
return true;
case "_typeof":
var typeofTarget = arguments[0];
result = Js.TypeOf(typeofTarget);
return true;
case "reference":
result = Js.Reference(GetConstantString(originalArguments[0]));
return true;
case "parseInt":
result = Js.Reference("parseInt").Invoke(arguments);
return true;
case "parseFloat":
result = Js.Reference("parseFloat").Invoke(arguments);
return true;
case "encodeURIComponent":
result = Js.Reference("encodeURIComponent").Invoke(arguments);
return true;
case "decodeURIComponent":
result = Js.Reference("decodeURIComponent").Invoke(arguments);
return true;
case "getComputedStyle":
result = Js.Reference("getComputedStyle").Invoke(arguments);
return true;
case "isNaN":
result = Js.Reference("isNaN").Invoke(arguments);
return true;
case "instanceof":
result = Js.InstanceOf(arguments[0], arguments[1]).Parenthetical();
return true;
case "object":
// Deconstruct the object passed in into a JS object
var obj = (AnonymousObjectCreationExpressionSyntax)originalArguments[0];
result = Js.Object(
obj.Initializers.Select(x => Js.Item(
x.NameEquals.Name.ToString(),
(JsExpression)x.Expression.Accept(transformer)
)).ToArray()
);
if (arguments.Length > 1 && originalArguments[1].IsTrue())
{
result = result.Compact();
}
return true;
case "regex":
result = new JsRegexExpression(GetConstantString(originalArguments[0]));
if (originalArguments.Length > 1)
((JsRegexExpression)result).Suffix = GetConstantString(originalArguments[1]);
return true;
case "in":
result = arguments[0].In(arguments[1]);
return true;
case "setTimeout":
result = Js.Reference("setTimeout").Invoke(arguments[0], arguments[1]);
return true;
case "setInterval":
result = Js.Reference("setInterval").Invoke(arguments[0], arguments[1]);
return true;
case "clearTimeout":
result = Js.Reference("clearTimeout").Invoke(arguments[0]);
return true;
case "clearInterval":
result = Js.Reference("clearInterval").Invoke(arguments[0]);
return true;
case "code":
result = new JsNativeExpression(GetConstantString(originalArguments[0]));
return true;
}
}
result = null;
return false;
}