本文整理汇总了C#中Boo.Lang.Compiler.Ast.MethodInvocationExpression类的典型用法代码示例。如果您正苦于以下问题:C# MethodInvocationExpression类的具体用法?C# MethodInvocationExpression怎么用?C# MethodInvocationExpression使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
MethodInvocationExpression类属于Boo.Lang.Compiler.Ast命名空间,在下文中一共展示了MethodInvocationExpression类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: PropagateChanges
public override void PropagateChanges(MethodInvocationExpression eval, List chain)
{
ExpressionCollection expressions = new ExpressionCollection();
foreach (object local1 in chain.Reversed)
{
if (!(local1 is ProcessAssignmentsToSpecialMembers.ChainItem))
{
}
ProcessAssignmentsToSpecialMembers.ChainItem item = (ProcessAssignmentsToSpecialMembers.ChainItem) RuntimeServices.Coerce(local1, typeof(ProcessAssignmentsToSpecialMembers.ChainItem));
if (item.Container is MethodInvocationExpression)
{
break;
}
if (item.Container is SlicingExpression)
{
SlicingExpression expression = item.Container;
Expression[] expressionArray1 = new Expression[] { expression.get_Target().CloneNode(), expression.get_Indices().get_Item(0).get_Begin().CloneNode(), this.get_CodeBuilder().CreateReference(item.Local) };
expressions.Add(this.CreateConstructorInvocation(this._sliceValueTypeChangeConstructor, expressionArray1));
break;
}
MemberReferenceExpression container = item.Container;
Expression[] args = new Expression[] { container.get_Target().CloneNode(), this.get_CodeBuilder().CreateStringLiteral(container.get_Name()), this.get_CodeBuilder().CreateReference(item.Local) };
expressions.Add(this.CreateConstructorInvocation(this._valueTypeChangeConstructor, args));
}
MethodInvocationExpression expression3 = this.get_CodeBuilder().CreateMethodInvocation(this._propagateChanges);
IArrayType type = this._valueTypeChangeType.MakeArrayType(1);
expression3.get_Arguments().Add(this.get_CodeBuilder().CreateArray(type, expressions));
eval.get_Arguments().Add(expression3);
}
示例2: OnMethodInvocationExpression
/// <summary>
/// This turn a call to TryGetParemeter('item') where item is a local variable
/// into a WrapIfNull(item) method call.
/// </summary>
/// <param name="node">The node.</param>
public override void OnMethodInvocationExpression(MethodInvocationExpression node)
{
var expression = node.Target as ReferenceExpression;
if (expression == null || expression.Name != "TryGetParameter")
{
base.OnMethodInvocationExpression(node);
return;
}
var name = ((StringLiteralExpression)node.Arguments[0]).Value;
var entity = NameResolutionService.Resolve(name);
if (entity == null)
{
base.OnMethodInvocationExpression(node);
return;
}
var parentNode = node.ParentNode;
var mie = CodeBuilder.CreateMethodInvocation(
CodeBuilder.CreateSelfReference(_currentMethod.DeclaringType),
wrapNullValue);
var item = new ReferenceExpression(node.LexicalInfo, name);
TypeSystemServices.Bind(item, entity);
mie.Arguments.Add(item);
parentNode.Replace(node, mie);
}
示例3: ProcessBuiltinInvocation
override protected void ProcessBuiltinInvocation(MethodInvocationExpression node, BuiltinFunction function)
{
if (TypeSystemServices.IsQuackBuiltin(function))
BindDuck(node);
else
base.ProcessBuiltinInvocation(node, function);
}
示例4: LeaveMethodInvocationExpression
public override void LeaveMethodInvocationExpression(MethodInvocationExpression node)
{
if (LookingFor(node))
{
Found(node);
}
}
示例5: VisitCompilationUnit
public object VisitCompilationUnit(CompilationUnit compilationUnit, object data)
{
module = new B.Module();
module.LexicalInfo = new B.LexicalInfo(fileName, 1, 1);
compilationUnit.AcceptChildren(this, data);
if (entryPointMethod != null) {
bool allMembersAreStatic = true;
foreach (B.TypeMember member in entryPointMethod.DeclaringType.Members) {
allMembersAreStatic &= member.IsStatic;
}
if (allMembersAreStatic) {
entryPointMethod.DeclaringType.Attributes.Add(MakeAttribute(("module")));
} else {
lastLexicalInfo = entryPointMethod.LexicalInfo;
B.Expression expr = MakeReferenceExpression(entryPointMethod.DeclaringType.Name + ".Main");
B.MethodInvocationExpression mie = new B.MethodInvocationExpression(lastLexicalInfo, expr);
if (entryPointMethod.Parameters.Count > 0) {
mie.Arguments.Add(MakeReferenceExpression("argv"));
}
B.SimpleTypeReference ret = entryPointMethod.ReturnType as B.SimpleTypeReference;
if (ret.Name == "void" || ret.Name == "System.Void")
module.Globals.Add(new B.ExpressionStatement(mie));
else
module.Globals.Add(new B.ReturnStatement(lastLexicalInfo, mie, null));
}
}
B.Module tmp = module;
module = null;
return tmp;
}
示例6: ExpandImpl
protected override Statement ExpandImpl(MacroStatement macro){
if (macro.Arguments.Count == 0){
Context.Errors.Add(new CompilerError(macro.LexicalInfo,
"sub macro requires at least one reference or string attribute for subview name"));
}
var call = new MethodInvocationExpression(AstUtil.CreateReferenceExpression("OutputSubView"));
int i = 0;
foreach (Expression argument in macro.Arguments){
i++;
Expression exp = argument;
if (i == 1){
//action and contrller parameters
if (argument is ReferenceExpression && !(argument is MemberReferenceExpression)){
if (argument.ToCodeString().StartsWith("@") || argument.ToCodeString().Contains(".")){
exp = AstUtil.CreateReferenceExpression(argument.ToCodeString().Substring(1));
}
else{
exp = new StringLiteralExpression(argument.ToCodeString());
}
}
}
call.Arguments.Add(exp);
}
return new ExpressionStatement(call);
}
示例7: CreateMethodInvocationExpression
public static MethodInvocationExpression CreateMethodInvocationExpression(LexicalInfo li, Expression target, Expression arg)
{
MethodInvocationExpression mie = new MethodInvocationExpression(li);
mie.Target = (Expression)target.Clone();
mie.Arguments.Add((Expression)arg.Clone());
mie.IsSynthetic = true;
return mie;
}
示例8: NormalizeMethodInvocationTarget
void NormalizeMethodInvocationTarget(MethodInvocationExpression node)
{
if (node.Target.NodeType != NodeType.ReferenceExpression) return;
node.Target = MemberReferenceFromReference(
(ReferenceExpression)node.Target,
CallableResolutionService.ValidCandidates[0].Method);
}
示例9: ReturnValueVisitor
public ReturnValueVisitor()
{
normalizer = new NormalizeStatementModifiers();
mie = new MethodInvocationExpression
{
Target = AstUtil.CreateReferenceExpression("transform")
};
}
示例10: OnMethodInvocationExpression
public override void OnMethodInvocationExpression(MethodInvocationExpression node)
{
if (node is MethodInvocationExpression && node.Target is GenericReferenceExpression)
{
var genericReferenceExpression = (GenericReferenceExpression)node.Target;
if (genericReferenceExpression.Target is MemberReferenceExpression)
{
var memberReferenceExpression = (MemberReferenceExpression)genericReferenceExpression.Target;
if (memberReferenceExpression.Target is MemberReferenceExpression)
{
var memberReferenceExpression2 = (MemberReferenceExpression)memberReferenceExpression.Target;
if (memberReferenceExpression2.Target is MemberReferenceExpression)
{
var memberReferenceExpression3 = (MemberReferenceExpression)memberReferenceExpression2.Target;
if (memberReferenceExpression3.Target is ReferenceExpression)
{
var referenceExpression = (ReferenceExpression)memberReferenceExpression3.Target;
if (referenceExpression.Name == "Boo" && memberReferenceExpression3.Name == "Lang" && memberReferenceExpression2.Name == "Builtins" && memberReferenceExpression.Name == "array" && 1 == ((ICollection)genericReferenceExpression.GenericArguments).Count)
{
TypeReference node2 = genericReferenceExpression.GenericArguments[0];
if (1 == ((ICollection)node.Arguments).Count && node.Arguments[0] is CastExpression)
{
var castExpression = (CastExpression)node.Arguments[0];
Expression target = castExpression.Target;
if (castExpression.Type is SimpleTypeReference)
{
var simpleTypeReference = (SimpleTypeReference)castExpression.Type;
if (simpleTypeReference.Name == "int")
{
var methodInvocationExpression = new MethodInvocationExpression(LexicalInfo.Empty);
var arg_255_0 = methodInvocationExpression;
var genericReferenceExpression2 = new GenericReferenceExpression(LexicalInfo.Empty);
GenericReferenceExpression arg_226_0 = genericReferenceExpression2;
var referenceExpression2 = new ReferenceExpression(LexicalInfo.Empty);
string text = referenceExpression2.Name = "array";
Expression expression = arg_226_0.Target = referenceExpression2;
TypeReferenceCollection typeReferenceCollection = genericReferenceExpression2.GenericArguments = TypeReferenceCollection.FromArray(new TypeReference[]
{
TypeReference.Lift(node2)
});
Expression expression2 = arg_255_0.Target = genericReferenceExpression2;
ExpressionCollection expressionCollection = methodInvocationExpression.Arguments = ExpressionCollection.FromArray(new Expression[]
{
Expression.Lift(target)
});
ReplaceCurrentNode(methodInvocationExpression);
}
}
}
}
}
}
}
}
}
}
示例11: OnMethodInvocationExpression
public override void OnMethodInvocationExpression(MethodInvocationExpression node)
{
base.OnMethodInvocationExpression(node);
if (this.IsConstructorInvocation(node))
{
base.EnsureDocumentInitialized(node);
node.set_LexicalInfo(BooExtensions.AsLexicalInfo(base.doc.FindPrevious(node.get_LexicalInfo(), 'n'), node.get_LexicalInfo().get_FileName()));
}
}
示例12: GetInvokedMethodName_SafeForPropertyEvals
private static string GetInvokedMethodName_SafeForPropertyEvals(MethodInvocationExpression mie)
{
if (mie.Target.ToString() == "__eval__")
{
BinaryExpression binaryExpression = (BinaryExpression)mie.Arguments[0];
MethodInvocationExpression right = (MethodInvocationExpression)binaryExpression.Right;
return right.Target.ToString();
}
return mie.Target.ToString();
}
示例13: ExpandImpl
protected override Statement ExpandImpl(MacroStatement macro){
var call = new MethodInvocationExpression(
new ReferenceExpression("__Export")
);
call.Arguments.Add(new StringLiteralExpression(macro.Arguments[0].ToCodeString()));
if(macro.Arguments.Count==2){
call.Arguments.Add(macro.Arguments[1]);
}
return new ExpressionStatement(call);
}
示例14: build_with
public static Expression build_with(ReferenceExpression builder, MethodInvocationExpression build, ReferenceExpression frameWorkVersion)
{
var targetName = builder.Name;
return new MethodInvocationExpression(
new ReferenceExpression(targetName),
build.Arguments[0],
new StringLiteralExpression(frameWorkVersion.Name)
);
}
示例15: MethodInvocationForEventSubscription
private MethodInvocationExpression MethodInvocationForEventSubscription(BinaryExpression node, IMethod method)
{
var methodTarget = CodeBuilder.CreateMemberReference(node.Left.LexicalInfo,
((MemberReferenceExpression)node.Left).Target, method);
var mie = new MethodInvocationExpression(methodTarget);
mie.Arguments.Add(node.Right);
BindExpressionType(mie, method.ReturnType);
return mie;
}