Microsoft.JScript.Context.EmitFirstLineInfo C# (CSharp) Метод

EmitFirstLineInfo() приватный Метод

private EmitFirstLineInfo ( ILGenerator ilgen ) : void
ilgen System.Reflection.Emit.ILGenerator
Результат void
    internal void EmitFirstLineInfo(ILGenerator ilgen){
      this.document.EmitFirstLineInfo(ilgen, this.StartLine, this.StartColumn, this.EndLine, this.EndColumn);
    }
    

Usage Example

Пример #1
0
        internal TypeBuilder TranslateToILClass(CompilerGlobals compilerGlobals)
        {
            TypeBuilder classwriter = compilerGlobals.classwriter =
                compilerGlobals.module.DefineType("JScript " + (this.Engine.classCounter++).ToString(), TypeAttributes.Public, typeof(GlobalScope), null);

            compilerGlobals.classwriter.SetCustomAttribute(new CustomAttributeBuilder(CompilerGlobals.compilerGlobalScopeAttributeCtor, new Object[0]));

            //Define a constructor that calls the appropriate constructor on GlobalScope
            ConstructorBuilder cons = compilerGlobals.classwriter.DefineConstructor(MethodAttributes.Public, CallingConventions.Standard, new Type[] { typeof(GlobalScope) });
            ILGenerator        il   = cons.GetILGenerator();

            il.Emit(OpCodes.Ldarg_0);
            il.Emit(OpCodes.Ldarg_1);
            il.Emit(OpCodes.Dup);
            il.Emit(OpCodes.Ldfld, CompilerGlobals.engineField);
            il.Emit(OpCodes.Call, CompilerGlobals.GlobalScopeConstructor);
            il.Emit(OpCodes.Ret);

            //Define a method to contain the global code
            MethodBuilder mw = classwriter.DefineMethod("Global Code", MethodAttributes.Public, Typeob.Object, null);

            il = mw.GetILGenerator();

            if (this.Engine.GenerateDebugInfo)
            {
                ScriptObject ns = this.own_scope.GetParent();
                while (ns != null)
                {
                    if (ns is WrappedNamespace && !((WrappedNamespace)ns).name.Equals(""))
                    {
                        il.UsingNamespace(((WrappedNamespace)ns).name);
                    }
                    ns = ns.GetParent();
                }
            }

            int startLine = this.context.StartLine;
            int startCol  = this.context.StartColumn;
            //this.context.document.EmitLineInfo(il, startLine, startCol, startLine, startCol + 1); // NOTE: make the debugger stop at line 1 in the jscript source instead of in prolog code
            Context firstContext = this.GetFirstExecutableContext();

            if (firstContext != null)
            {
                firstContext.EmitFirstLineInfo(il);
            }

            //Emit code to push the scope onto the stack for use by eval
            this.EmitILToLoadEngine(il);
            il.Emit(OpCodes.Ldarg_0);
            il.Emit(OpCodes.Call, CompilerGlobals.pushScriptObjectMethod);
            this.TranslateToILInitializer(il);
            this.TranslateToIL(il, Typeob.Object);
            this.EmitILToLoadEngine(il);
            il.Emit(OpCodes.Call, CompilerGlobals.popScriptObjectMethod);
            il.Emit(OpCodes.Pop);
            il.Emit(OpCodes.Ret);

            return(classwriter);
        }
All Usage Examples Of Microsoft.JScript.Context::EmitFirstLineInfo