public override MSAst.Expression Reduce() {
var codeObj = GetOrMakeFunctionCode();
var funcCode = GlobalParent.Constant(codeObj);
FuncCodeExpr = funcCode;
MSAst.Expression lambda;
if (EmitDebugSymbols) {
lambda = GetLambda();
} else {
lambda = NullLambda;
ThreadPool.QueueUserWorkItem((x) => {
// class defs are almost always run, so start
// compiling the code now so it might be ready
// when we actually go and execute it
codeObj.UpdateDelegate(PyContext, true);
});
}
MSAst.Expression classDef = Ast.Call(
AstMethods.MakeClass,
funcCode,
lambda,
Parent.LocalContext,
AstUtils.Constant(_name),
Ast.NewArrayInit(
typeof(object),
ToObjectArray(_bases)
),
AstUtils.Constant(FindSelfNames())
);
classDef = AddDecorators(classDef, _decorators);
return GlobalParent.AddDebugInfoAndVoid(
AssignValue(Parent.GetVariableExpression(_variable), classDef),
new SourceSpan(
GlobalParent.IndexToLocation(StartIndex),
GlobalParent.IndexToLocation(HeaderIndex)
)
);
}