public Emit ( |
||
fn | ||
tb | ||
Результат | void |
public override void Emit(ObjExpr fn, TypeBuilder tb)
{
MethodBuilder mb = tb.DefineMethod(MethodName, MethodAttributes.ReuseSlot | MethodAttributes.Public | MethodAttributes.Virtual | MethodAttributes.HideBySig, ReturnType, ArgTypes);
SetCustomAttributes(mb);
CljILGen ilg = new CljILGen(mb.GetILGenerator());
Label loopLabel = ilg.DefineLabel();
GenContext.EmitDebugInfo(ilg, SpanMap);
try
{
Var.pushThreadBindings(RT.map(Compiler.LoopLabelVar,loopLabel,Compiler.MethodVar,this));
ilg.MarkLabel(loopLabel);
EmitBody(Objx,ilg,_retType,Body);
if ( Body.HasNormalExit() )
ilg.Emit(OpCodes.Ret);
}
finally
{
Var.popThreadBindings();
}
if (IsExplicit)
tb.DefineMethodOverride(mb, ExplicitMethodInfo);
}
protected override void EmitMethods(TypeBuilder tb) { HashSet <MethodInfo> implemented = new HashSet <MethodInfo>(); for (ISeq s = RT.seq(Methods); s != null; s = s.next()) { NewInstanceMethod method = (NewInstanceMethod)s.first(); method.Emit(this, tb); implemented.UnionWith(method.MethodInfos); } foreach (List <MethodInfo> ms in _methodMap.Values) { foreach (MethodInfo mi in ms) { if (NeedsDummy(mi, implemented)) { EmitDummyMethod(tb, mi, true); } } } EmitHasArityMethod(TypeBuilder, null, false, 0); }