本文整理汇总了C#中Mono.CSharp.EmitContext类的典型用法代码示例。如果您正苦于以下问题:C# EmitContext类的具体用法?C# EmitContext怎么用?C# EmitContext使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
EmitContext类属于Mono.CSharp命名空间,在下文中一共展示了EmitContext类的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的C#代码示例。
示例1: Emit
public override void Emit(EmitContext ec)
{
if (Value)
ec.Emit (OpCodes.Ldc_I4_1);
else
ec.Emit (OpCodes.Ldc_I4_0);
}
开发者ID:speier,项目名称:shake,代码行数:7,代码来源:constant.cs
示例2: DoResolve
public override Expression DoResolve (EmitContext ec)
{
//
// We are born fully resolved
//
return this;
}
开发者ID:lewurm,项目名称:benchmarker,代码行数:7,代码来源:expression.cs
示例3: CloseCompilerGeneratedBlock
public static void CloseCompilerGeneratedBlock(EmitContext ec)
{
if (symwriter != null) {
int offset = symwriter.GetILOffset (ec.ig);
symwriter.CloseCompilerGeneratedBlock (offset);
}
}
开发者ID:speier,项目名称:shake,代码行数:7,代码来源:symbolwriter.cs
示例4: Resolve
public override bool Resolve (EmitContext ec)
{
expr = expr.Resolve (ec);
if (expr == null)
return false;
Report.Debug (64, "RESOLVE YIELD #1", this, ec, expr, expr.GetType (),
ec.CurrentAnonymousMethod, ec.CurrentIterator);
if (!CheckContext (ec, loc))
return false;
Iterator iterator = ec.CurrentIterator;
if (expr.Type != iterator.OriginalIteratorType) {
expr = Convert.ImplicitConversionRequired (
ec, expr, iterator.OriginalIteratorType, loc);
if (expr == null)
return false;
}
if (!ec.CurrentBranching.CurrentUsageVector.IsUnreachable)
unwind_protect = ec.CurrentBranching.AddResumePoint (this, loc, out resume_pc);
return true;
}
开发者ID:lewurm,项目名称:benchmarker,代码行数:25,代码来源:iterators.cs
示例5: Emit
public override void Emit (EmitContext ec)
{
//
// Emits null pointer
//
ec.Emit (OpCodes.Ldc_I4_0);
ec.Emit (OpCodes.Conv_U);
}
开发者ID:nickname100,项目名称:monodevelop,代码行数:8,代码来源:literal.cs
示例6: Emit
public override void Emit (EmitContext ec)
{
if (args != null)
Invocation.EmitArguments (ec, mi, args);
ec.ig.Emit (OpCodes.Call, mi);
return;
}
开发者ID:emtees,项目名称:old-code,代码行数:8,代码来源:expression.cs
示例7: Emit
public override void Emit (EmitContext ec)
{
ec.ig.Emit (OpCodes.Ldnull);
#if GMCS_SOURCE
// Only to make verifier happy
if (TypeManager.IsGenericParameter (type))
ec.ig.Emit (OpCodes.Unbox_Any, type);
#endif
}
开发者ID:calumjiao,项目名称:Mono-Class-Libraries,代码行数:10,代码来源:literal.cs
示例8: Emit
public override void Emit(EmitContext ec)
{
if (statement != null) {
statement.EmitStatement (ec);
ec.Emit (OpCodes.Ret);
return;
}
base.Emit (ec);
}
开发者ID:RainsSoft,项目名称:MonoCompilerAsAService,代码行数:10,代码来源:lambda.cs
示例9: Error_ValueCannotBeConverted
public override void Error_ValueCannotBeConverted (EmitContext ec, Location loc, Type target, bool expl)
{
if (!expl && IsLiteral &&
(TypeManager.IsPrimitiveType (target) || type == TypeManager.decimal_type) &&
(TypeManager.IsPrimitiveType (type) || type == TypeManager.decimal_type)) {
Report.Error (31, loc, "Constant value `{0}' cannot be converted to a `{1}'",
AsString (), TypeManager.CSharpName (target));
} else {
base.Error_ValueCannotBeConverted (ec, loc, target, expl);
}
}
开发者ID:lewurm,项目名称:benchmarker,代码行数:11,代码来源:constant.cs
示例10: Error_ValueCannotBeConverted
public override void Error_ValueCannotBeConverted (EmitContext ec, Location loc, Type t, bool expl)
{
if (TypeManager.IsGenericParameter (t)) {
Report.Error(403, loc,
"Cannot convert null to the type parameter `{0}' because it could be a value " +
"type. Consider using `default ({0})' instead", t.Name);
} else {
Report.Error(37, loc, "Cannot convert null to `{0}' because it is a value type",
TypeManager.CSharpName(t));
}
}
开发者ID:lewurm,项目名称:benchmarker,代码行数:11,代码来源:literal.cs
示例11: CreateExpressionTree
public override Expression CreateExpressionTree (EmitContext ec)
{
if (expr_tree != null)
return expr_tree (ec, mg);
ArrayList args = new ArrayList (arguments.Count + 1);
args.Add (new Argument (new NullLiteral (loc)));
args.Add (new Argument (mg.CreateExpressionTree (ec)));
foreach (Argument a in arguments) {
args.Add (new Argument (a.Expr.CreateExpressionTree (ec)));
}
return CreateExpressionFactoryCall ("Call", args);
}
开发者ID:lewurm,项目名称:benchmarker,代码行数:14,代码来源:expression.cs
示例12: DoEmit
protected override void DoEmit(EmitContext ec)
{
if (statement != null) {
statement.EmitStatement (ec);
if (unwind_protect)
ec.Emit (OpCodes.Leave, ec.CreateReturnLabel ());
else {
ec.Emit (OpCodes.Ret);
}
return;
}
base.DoEmit (ec);
}
开发者ID:segaman,项目名称:NRefactory,代码行数:14,代码来源:lambda.cs
示例13: MakeSimpleCall
static public Expression MakeSimpleCall (EmitContext ec, MethodGroupExpr mg,
Expression e, Location loc)
{
ArrayList args;
MethodBase method;
args = new ArrayList (1);
args.Add (new Argument (e, Argument.AType.Expression));
method = Invocation.OverloadResolve (ec, (MethodGroupExpr) mg, args, loc);
if (method == null)
return null;
return new StaticCallExpr ((MethodInfo) method, args, loc);
}
开发者ID:emtees,项目名称:old-code,代码行数:15,代码来源:expression.cs
示例14: ResolveParameters
protected override Parameters ResolveParameters (EmitContext ec, TypeInferenceContext tic, Type delegateType)
{
if (!TypeManager.IsDelegateType (delegateType))
return null;
AParametersCollection d_params = TypeManager.GetDelegateParameters (delegateType);
if (HasExplicitParameters) {
if (!VerifyExplicitParameters (delegateType, d_params, ec.IsInProbingMode))
return null;
return Parameters;
}
//
// If L has an implicitly typed parameter list we make implicit parameters explicit
// Set each parameter of L is given the type of the corresponding parameter in D
//
if (!VerifyParameterCompatibility (delegateType, d_params, ec.IsInProbingMode))
return null;
Type [] ptypes = new Type [Parameters.Count];
for (int i = 0; i < d_params.Count; i++) {
// D has no ref or out parameters
if ((d_params.FixedParameters [i].ModFlags & Parameter.Modifier.ISBYREF) != 0)
return null;
Type d_param = d_params.Types [i];
#if MS_COMPATIBLE
// Blablabla, because reflection does not work with dynamic types
if (d_param.IsGenericParameter)
d_param = delegateType.GetGenericArguments () [d_param.GenericParameterPosition];
#endif
//
// When type inference context exists try to apply inferred type arguments
//
if (tic != null) {
d_param = tic.InflateGenericArgument (d_param);
}
ptypes [i] = d_param;
((ImplicitLambdaParameter) Parameters.FixedParameters [i]).Type = d_param;
}
Parameters.Types = ptypes;
return Parameters;
}
开发者ID:lewurm,项目名称:benchmarker,代码行数:48,代码来源:lambda.cs
示例15: GetAttributableValue
public override bool GetAttributableValue (EmitContext ec, Type value_type, out object value)
{
if (value_type == TypeManager.object_type) {
value = GetTypedValue ();
return true;
}
Constant c = ImplicitConversionRequired (ec, value_type, loc);
if (c == null) {
value = null;
return false;
}
value = c.GetTypedValue ();
return true;
}
开发者ID:lewurm,项目名称:benchmarker,代码行数:16,代码来源:constant.cs
示例16: CreateExpressionTree
protected override Expression CreateExpressionTree (EmitContext ec, Type delegate_type)
{
if (ec.IsInProbingMode)
return this;
Expression args = Parameters.CreateExpressionTree (ec, loc);
Expression expr = Block.CreateExpressionTree (ec);
if (expr == null)
return null;
ArrayList arguments = new ArrayList (2);
arguments.Add (new Argument (expr));
arguments.Add (new Argument (args));
return CreateExpressionFactoryCall ("Lambda",
new TypeArguments (new TypeExpression (delegate_type, loc)),
arguments);
}
开发者ID:lewurm,项目名称:benchmarker,代码行数:17,代码来源:lambda.cs
示例17: ResolveUnreachable
/// <summary>
/// We already know that the statement is unreachable, but we still
/// need to resolve it to catch errors.
/// </summary>
public virtual bool ResolveUnreachable (EmitContext ec, bool warn)
{
//
// This conflicts with csc's way of doing this, but IMHO it's
// the right thing to do.
//
// If something is unreachable, we still check whether it's
// correct. This means that you cannot use unassigned variables
// in unreachable code, for instance.
//
if (warn)
Report.Warning (162, 2, loc, "Unreachable code detected");
ec.StartFlowBranching (FlowBranching.BranchingType.Block, loc);
bool ok = Resolve (ec);
ec.KillFlowBranching ();
return ok;
}
开发者ID:lewurm,项目名称:benchmarker,代码行数:24,代码来源:statement.cs
示例18: CheckContext
public static bool CheckContext (EmitContext ec, Location loc)
{
for (Block block = ec.CurrentBlock; block != null; block = block.Parent) {
if (!block.Unsafe)
continue;
Report.Error (1629, loc, "Unsafe code may not appear in iterators");
return false;
}
//
// We can't use `ec.InUnsafe' here because it's allowed to have an iterator
// inside an unsafe class. See test-martin-29.cs for an example.
//
if (!ec.CurrentAnonymousMethod.IsIterator) {
Report.Error (1621, loc,
"The yield statement cannot be used inside " +
"anonymous method blocks");
return false;
}
return true;
}
开发者ID:lewurm,项目名称:benchmarker,代码行数:23,代码来源:iterators.cs
示例19: EmitHoistingAssignment
public void EmitHoistingAssignment (EmitContext ec)
{
//
// Remove hoisted redirection to emit assignment from original parameter
//
var temp = parameter.Parameter.HoistedVariant;
parameter.Parameter.HoistedVariant = null;
var a = new HoistedFieldAssign (GetFieldExpression (ec), parameter);
a.EmitStatement (ec);
parameter.Parameter.HoistedVariant = temp;
}
开发者ID:rabink,项目名称:mono,代码行数:13,代码来源:anonymous.cs
示例20: EmitAssign
public void EmitAssign (EmitContext ec, Expression source, bool leave_copy, bool isCompound)
{
GetFieldExpression (ec).EmitAssign (ec, source, leave_copy, false);
}
开发者ID:rabink,项目名称:mono,代码行数:4,代码来源:anonymous.cs
注:本文中的Mono.CSharp.EmitContext类示例由纯净天空整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论