コード例 #1
0
        /// <summary>
        /// Initializes a new instance of the <see cref="CallContext" /> class.
        /// </summary>
        /// <param name="context">Current analyzing context.</param>
        /// <param name="name">The name.</param>
        /// <param name="transformProvider">The transform provider.</param>
        /// <param name="generator">The generator of call's instructions.</param>
        /// <param name="argumentValues">The argument values.</param>
        internal CallContext(AnalyzingContext context, MethodID name, CallTransformProvider transformProvider, GeneratorBase generator, Instance[] argumentValues)
        {
            _context = context;

            Caller            = context.CurrentCall;
            ArgumentValues    = argumentValues;
            Name              = name;
            TransformProvider = transformProvider;

            if (Caller != null)
            {
                CallingBlock = Caller.CurrentBlock;
            }

            var emitter = new CallEmitter(context);

            generator.Generate(emitter);

            Program             = emitter.GetEmittedInstructions();
            _instructionPointer = 0;

            if (Program.Instructions.Length <= _instructionPointer)
            {
                //cannot run empty program
                return;
            }

            EntryBlock   = new ExecutedBlock(Program.Instructions[0].Info, this);
            CurrentBlock = EntryBlock;
        }