コード例 #1
0
 public void Copyfrom(LexicalInfo other)
 {
     this.StartLine = other.StartLine;
     this.StartColumn = other.StartColumn;
     this.EndLine = other.EndLine;
     this.EndColumn = other.EndColumn;
 }
コード例 #2
0
 public Warning(LexicalInfo lex, string msg)
 {
     this.LexicalInfo = lex;
     this.Message = msg;
 }
コード例 #3
0
 public void MarkSequencePoint(LexicalInfo lexinfo)
 {
     if (this.Options.Debug && lexinfo.StartLine != 0) {
         this.ILGenerator.MarkSequencePoint(DebugWriter, lexinfo.StartLine, lexinfo.StartColumn, lexinfo.EndLine, lexinfo.EndColumn);
         this.ILGenerator.Emit(OpCodes.Nop);
     }
 }
コード例 #4
0
        protected void EmitRunProcess(CompileContext context, TypeInfo procType, bool setGuidOnProc, LexicalInfo lexInfo, bool loadVariables)
        {
            if (context.Type == null || context.ILGenerator == null) {
                return; //Are at top level and so can't run the process
            }
            ILGenerator il = context.ILGenerator;

            if (loadVariables) {
                foreach (string paramName in procType.ConstructorParameters) {
                    il.Emit(OpCodes.Ldloc, context.Type.GetLocal(paramName));
                }
            }
            LocalBuilder loc = il.DeclareLocal(typeof(ProcessBase));
            il.Emit(OpCodes.Newobj, procType.Constructor);
            il.Emit(OpCodes.Stloc, loc);
            il.Emit(OpCodes.Ldloc, loc);
            il.Emit(OpCodes.Ldarg_0); //load the "this" pointer

            //The current process doesn't have a restrict or relabel method, no reason for it
            //to continue living, set the parent process of the new proc as our own parent process
            if (!context.Type.IsPreProcessed && !context.Type.IsRestricted && !context.Type.MustLiveOn) {
                il.Emit(OpCodes.Call, MethodResolver.GetMethod(typeof(ProcessBase), "get_Parent"));
            }
            il.Emit(OpCodes.Call, MethodResolver.GetMethod(typeof(ProcessBase), "set_Parent"));

            if (setGuidOnProc) {
                il.Emit(OpCodes.Ldloc, loc);
                il.Emit(OpCodes.Ldarg_0);
                il.Emit(OpCodes.Call, typeof(ProcessBase).GetMethod("get_SetID"));
                il.Emit(OpCodes.Call, typeof(ProcessBase).GetMethod("set_SetID"));
            }

            il.Emit(OpCodes.Ldloc, loc);
            if (context.Options.Debug && lexInfo != null) {
                //context.MarkSequencePoint(lexInfo);
            }
            il.Emit(OpCodes.Call, MethodResolver.GetMethod(typeof(ProcessBase), "Run"));
        }