Cilador.Clone.MultiplexedConstructor.PopulateConstructionItems C# (CSharp) Method

PopulateConstructionItems() private method

Populates construction variables and instructions.
private PopulateConstructionItems ( ) : void
return void
        private void PopulateConstructionItems()
        {
            Contract.Assert(this.InnerBoundaryLastInstructionIndex.HasValue);

            for (var i = this.InnerBoundaryLastInstructionIndex.Value + 1; i < this.Constructor.Body.Instructions.Count; i++)
            {
                var instruction = this.Constructor.Body.Instructions[i];
                this.InnerConstructionInstructions.Add(instruction);

                // if the instruction references a variable, then ensure that the variable exists in the collection of construction variables
                VariableDefinition variable;
                if (!this.TryGetReferencedVariable(instruction, out variable) ||
                    this.InnerConstructionVariables.Contains(variable) ||
                    this.InnerSharedVariables.Contains(variable))
                {
                    continue;
                }

                // variable wasn't in the expected place
                if (this.InnerInitializationVariables.Contains(variable))
                {
                    // looks like a variable was shared
                    this.InnerInitializationVariables.Remove(variable);
                    this.InnerSharedVariables.Add(variable);
                }
                else
                {
                    // a variable wasn't found at all
                    throw new InvalidOperationException(
                        "An instruction in the construction part of a multiplexed constructor references a variable that either cannot be found.");
                }
            }
        }