本文整理汇总了C#中System.Reflection.Emit.CodeGenerator.EmitDeclareFunction方法的典型用法代码示例。如果您正苦于以下问题:C# CodeGenerator.EmitDeclareFunction方法的具体用法?C# CodeGenerator.EmitDeclareFunction怎么用?C# CodeGenerator.EmitDeclareFunction使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类System.Reflection.Emit.CodeGenerator
的用法示例。
在下文中一共展示了CodeGenerator.EmitDeclareFunction方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: Emit
/// <include file='Doc/Nodes.xml' path='doc/method[@name="Emit"]/*'/>
internal override void Emit(CodeGenerator/*!*/ codeGenerator)
{
Statistics.AST.AddNode("FunctionDecl");
// marks a sequence point if function is declared here (i.e. is m-decl):
//Note: this sequence point goes to the function where this function is declared not to this declared function!
if (!function.IsLambda && function.Declaration.IsConditional)
codeGenerator.MarkSequencePoint(position.FirstLine, position.FirstColumn, position.LastLine, position.LastColumn + 2);
// emits attributes on the function itself, its return value, type parameters and regular parameters:
attributes.Emit(codeGenerator, this);
signature.Emit(codeGenerator);
typeSignature.Emit(codeGenerator);
// prepares code generator for emitting arg-full overload;
// false is returned when the body should not be emitted:
if (!codeGenerator.EnterFunctionDeclaration(function)) return;
// emits the arg-full overload:
codeGenerator.EmitArgfullOverloadBody(function, body, entireDeclarationPosition, declarationBodyPosition);
// restores original code generator settings:
codeGenerator.LeaveFunctionDeclaration();
// emits function declaration (if needed):
// ignore s-decl function declarations except for __autoload;
// __autoload function is declared in order to avoid using callbacks when called:
if (function.Declaration.IsConditional && !function.QualifiedName.IsAutoloadName)
{
Debug.Assert(!function.IsLambda);
codeGenerator.EmitDeclareFunction(function);
}
}