UsingNamespace() public method

public UsingNamespace ( string usingNamespace ) : void
usingNamespace string
return void
示例#1
0
文件: class.cs 项目: ArildF/masters
 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();
     }
   }
 }
示例#2
0
 public void UsingNamespace(string namespaceName)
 {
     Generator.UsingNamespace(namespaceName);
 }
 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();
     }
 }
示例#4
0
 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();
   }
 }