当前位置: 首页>>代码示例>>C#>>正文


C# ILGenerator.UsingNamespace方法代码示例

本文整理汇总了C#中System.Reflection.Emit.ILGenerator.UsingNamespace方法的典型用法代码示例。如果您正苦于以下问题:C# ILGenerator.UsingNamespace方法的具体用法?C# ILGenerator.UsingNamespace怎么用?C# ILGenerator.UsingNamespace使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在System.Reflection.Emit.ILGenerator的用法示例。


在下文中一共展示了ILGenerator.UsingNamespace方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。

示例1: TranslateBodyToIL

 internal void TranslateBodyToIL(ILGenerator il, CompilerGlobals compilerGlobals)
 {
     this.returnLabel = il.DefineLabel();
     if (this.body.Engine.GenerateDebugInfo)
     {
         for (ScriptObject obj2 = this.enclosing_scope.GetParent(); obj2 != null; obj2 = obj2.GetParent())
         {
             if (obj2 is PackageScope)
             {
                 il.UsingNamespace(((PackageScope) obj2).name);
             }
             else if ((obj2 is WrappedNamespace) && !((WrappedNamespace) obj2).name.Equals(""))
             {
                 il.UsingNamespace(((WrappedNamespace) obj2).name);
             }
         }
     }
     int startLine = this.body.context.StartLine;
     int startColumn = this.body.context.StartColumn;
     this.body.context.document.EmitLineInfo(il, startLine, startColumn, startLine, startColumn + 1);
     if (this.body.context.document.debugOn)
     {
         il.Emit(OpCodes.Nop);
     }
     int length = this.fields.Length;
     for (int i = 0; i < length; i++)
     {
         if (!this.fields[i].IsLiteral || (this.fields[i].value is FunctionObject))
         {
             Type fieldType = this.fields[i].FieldType;
             LocalBuilder builder = il.DeclareLocal(fieldType);
             if (this.fields[i].debugOn)
             {
                 builder.SetLocalSymInfo(this.fields[i].debuggerName);
             }
             this.fields[i].metaData = builder;
         }
     }
     this.globals.ScopeStack.Push(this.own_scope);
     try
     {
         if (this.must_save_stack_locals)
         {
             this.TranslateToMethodWithStackFrame(il, compilerGlobals, true);
         }
         else
         {
             this.body.TranslateToILInitializer(il);
             this.body.TranslateToIL(il, Typeob.Void);
             il.MarkLabel(this.returnLabel);
         }
     }
     finally
     {
         this.globals.ScopeStack.Pop();
     }
 }
开发者ID:pritesh-mandowara-sp,项目名称:DecompliedDotNetLibraries,代码行数:57,代码来源:FunctionObject.cs

示例2: EmitUsingNamespaces

 private void EmitUsingNamespaces(ILGenerator il){
   if (this.body.Engine.GenerateDebugInfo){
     ScriptObject ns = this.enclosingScope;
     while (ns != null){
       if (ns is PackageScope)
         il.UsingNamespace(((PackageScope)ns).name);
       else if (ns is WrappedNamespace && !((WrappedNamespace)ns).name.Equals(""))
         il.UsingNamespace(((WrappedNamespace)ns).name);
       ns = ns.GetParent();
     }
   }
 }
开发者ID:ArildF,项目名称:masters,代码行数:12,代码来源:class.cs

示例3: TranslateBodyToIL

 internal void TranslateBodyToIL(ILGenerator il, CompilerGlobals compilerGlobals){
   this.returnLabel = il.DefineLabel();
   // Emit all the namespaces used by this function
   if (this.body.Engine.GenerateDebugInfo){
     ScriptObject ns = this.enclosing_scope.GetParent();
     while (ns != null){
       if (ns is PackageScope)
         il.UsingNamespace(((PackageScope)ns).name);
       else if (ns is WrappedNamespace && !((WrappedNamespace)ns).name.Equals(""))
         il.UsingNamespace(((WrappedNamespace)ns).name);
       ns = ns.GetParent();
     }
   }
   int startLine = this.body.context.StartLine;
   int startCol = this.body.context.StartColumn;
   this.body.context.document.EmitLineInfo(il, startLine, startCol, startLine, startCol + 1);
   if (this.body.context.document.debugOn)
     il.Emit(OpCodes.Nop);
   //set up the compiler to emit direct accesses to the locals and pars.
   int n = this.fields.Length;
   for (int i = 0; i < n; i++){
     if (!this.fields[i].IsLiteral || this.fields[i].value is FunctionObject){
       Type t = this.fields[i].FieldType;
       LocalBuilder tok = il.DeclareLocal(t);
       if (this.fields[i].debugOn)
         tok.SetLocalSymInfo(this.fields[i].debuggerName);
       this.fields[i].metaData = tok;
     }
   }
   globals.ScopeStack.Push(this.own_scope);
   try{
     if (this.must_save_stack_locals){
       this.TranslateToMethodWithStackFrame(il, compilerGlobals, true);
       return;
     }
     this.body.TranslateToILInitializer(il);
     this.body.TranslateToIL(il, Typeob.Void);
     il.MarkLabel(this.returnLabel);
   }finally{
     globals.ScopeStack.Pop();
   }
 }
开发者ID:ArildF,项目名称:masters,代码行数:42,代码来源:functionobject.cs


注:本文中的System.Reflection.Emit.ILGenerator.UsingNamespace方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。