本文整理汇总了C#中Mono.CSharp.StatementExpression.Resolve方法的典型用法代码示例。如果您正苦于以下问题:C# StatementExpression.Resolve方法的具体用法?C# StatementExpression.Resolve怎么用?C# StatementExpression.Resolve使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Mono.CSharp.StatementExpression
的用法示例。
在下文中一共展示了StatementExpression.Resolve方法的5个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: EmitCall
protected void EmitCall(EmitContext ec, Expression binder, Arguments arguments, bool isStatement)
{
int dyn_args_count = arguments == null ? 0 : arguments.Count;
TypeExpr site_type = CreateSiteType (RootContext.ToplevelTypes.Compiler, arguments, dyn_args_count, isStatement);
FieldExpr site_field_expr = new FieldExpr (CreateSiteField (site_type), loc);
SymbolWriter.OpenCompilerGeneratedBlock (ec);
Arguments args = new Arguments (1);
args.Add (new Argument (binder));
StatementExpression s = new StatementExpression (new SimpleAssign (site_field_expr, new Invocation (new MemberAccess (site_type, "Create"), args)));
BlockContext bc = new BlockContext (ec.MemberContext, null, TypeManager.void_type);
if (s.Resolve (bc)) {
Statement init = new If (new Binary (Binary.Operator.Equality, site_field_expr, new NullLiteral (loc), loc), s, loc);
init.Emit (ec);
}
args = new Arguments (1 + dyn_args_count);
args.Add (new Argument (site_field_expr));
if (arguments != null) {
foreach (Argument a in arguments) {
if (a is NamedArgument) {
// Name is not valid in this context
args.Add (new Argument (a.Expr, a.ArgType));
continue;
}
args.Add (a);
}
}
Expression target = new DelegateInvocation (new MemberAccess (site_field_expr, "Target", loc).Resolve (bc), args, loc).Resolve (bc);
if (target != null)
target.Emit (ec);
SymbolWriter.CloseCompilerGeneratedBlock (ec);
}
示例2: CreateExpressionTree
public Expression CreateExpressionTree (BlockContext ec, Location loc)
{
var initializers = new ArrayInitializer (Count, loc);
foreach (Parameter p in FixedParameters) {
//
// Each parameter expression is stored to local variable
// to save some memory when referenced later.
//
StatementExpression se = new StatementExpression (p.CreateExpressionTreeVariable (ec), Location.Null);
if (se.Resolve (ec)) {
ec.CurrentBlock.AddScopeStatement (new TemporaryVariableReference.Declarator (p.ExpressionTreeVariableReference ()));
ec.CurrentBlock.AddScopeStatement (se);
}
initializers.Add (p.ExpressionTreeVariableReference ());
}
return new ArrayCreation (
Parameter.ResolveParameterExpressionType (ec, loc),
initializers, loc);
}
示例3: ResolveIncrement
public void ResolveIncrement (BlockContext ec)
{
increment = new StatementExpression (new UnaryMutator (UnaryMutator.Mode.PostIncrement, this, loc));
increment.Resolve (ec);
}
示例4: EmitCall
//.........这里部分代码省略.........
site.AddTypeContainer (d);
//
// Add new container to inflated site container when the
// member cache already exists
//
if (site.CurrentType is InflatedTypeSpec && index > 0)
site.CurrentType.MemberCache.AddMember (d.CurrentType);
del_type = new TypeExpression (d.CurrentType, loc);
if (targs_for_instance != null) {
del_type_instance_access = null;
} else {
del_type_instance_access = del_type;
}
} else {
d = null;
}
var site_type_decl = new GenericTypeExpr (module.PredefinedTypes.CallSiteGeneric.TypeSpec, new TypeArguments (del_type), loc);
var field = site_container.CreateCallSiteField (site_type_decl, loc);
if (field == null)
return;
if (del_type_instance_access == null) {
var dt = d.CurrentType.DeclaringType.MakeGenericType (module, context_mvars.Types);
del_type_instance_access = new TypeExpression (MemberCache.GetMember (dt, d.CurrentType), loc);
}
var instanceAccessExprType = new GenericTypeExpr (module.PredefinedTypes.CallSiteGeneric.TypeSpec,
new TypeArguments (del_type_instance_access), loc);
if (instanceAccessExprType.ResolveAsType (ec.MemberContext) == null)
return;
bool inflate_using_mvar = context_mvars != null && ec.IsAnonymousStoreyMutateRequired;
TypeSpec gt;
if (inflate_using_mvar || context_mvars == null) {
gt = site_container.CurrentType;
} else {
gt = site_container.CurrentType.MakeGenericType (module, context_mvars.Types);
}
// When site container already exists the inflated version has to be
// updated manually to contain newly created field
if (gt is InflatedTypeSpec && site_container.AnonymousMethodsCounter > 1) {
var tparams = gt.MemberDefinition.TypeParametersCount > 0 ? gt.MemberDefinition.TypeParameters : TypeParameterSpec.EmptyTypes;
var inflator = new TypeParameterInflator (module, gt, tparams, gt.TypeArguments);
gt.MemberCache.AddMember (field.InflateMember (inflator));
}
FieldExpr site_field_expr = new FieldExpr (MemberCache.GetMember (gt, field), loc);
BlockContext bc = new BlockContext (ec.MemberContext, null, ec.BuiltinTypes.Void);
Arguments args = new Arguments (1);
args.Add (new Argument (binder));
StatementExpression s = new StatementExpression (new SimpleAssign (site_field_expr, new Invocation (new MemberAccess (instanceAccessExprType, "Create"), args)));
using (ec.With (BuilderContext.Options.OmitDebugInfo, true)) {
var conditionalAccessReceiver = IsConditionalAccessReceiver;
var ca = ec.ConditionalAccess;
示例5: CreateExpressionTree
public Expression CreateExpressionTree (EmitContext ec, Location loc)
{
ArrayList initializers = new ArrayList (Count);
foreach (Parameter p in FixedParameters) {
//
// Each parameter expression is stored to local variable
// to save some memory when referenced later.
//
StatementExpression se = new StatementExpression (p.CreateExpressionTreeVariable (ec));
if (se.Resolve (ec))
ec.CurrentBlock.AddScopeStatement (se);
initializers.Add (p.ExpressionTreeVariableReference ());
}
return new ArrayCreation (
Parameter.ResolveParameterExpressionType (ec, loc),
"[]", initializers, loc);
}