Beispiel #1
0
        public override void Compile(Emitter.Emitter emitter)
        {
            var currType = emitter.CurrentType;
              var currMethod = emitter.CurrentMethod;
              emitter.CurrentType = emitter.FindType(PlannerID);

              // convert the IdentifierGet to IdentifierInvoke with two faux arguments
              AppendActionParameters(emitter);

              // extract closured variables
              var detector = new Utils.ClosureDetector();
              Closures = detector.Process(Action, emitter);
              DeclareClosuredVariables(emitter);

              // generate closured code for emitter
              CompileBody(emitter);

              emitter.CurrentType = currType;
              emitter.CurrentMethod = currMethod;

              CompileInitiation(emitter);
        }
Beispiel #2
0
        public override void Compile(Emitter.Emitter emitter)
        {
            var currType = emitter.CurrentType;
              var currMethod = emitter.CurrentMethod;
              emitter.CurrentType = emitter.FindType(EmitterID);

              // extract closured variables
              var detector = new Utils.ClosureDetector();
              ActionClosures = detector.Process(Action, emitter);
              if (Condition != null)
            ConditionClosures = detector.Process(Condition, emitter);
              MergeClosures();
              DeclareClosuredVariables(emitter);

              // generate closured code for emitter
              CompileBody(emitter);

              emitter.CurrentType = currType;
              emitter.CurrentMethod = currMethod;

              CompileInitiation(emitter);
        }