예제 #1
0
        /// <summary>
        /// Generates the code required by this <see cref="Frame"/>, delegating the responsibility to the
        /// abstract method <see cref="Generate" />.
        /// </summary>
        /// <remarks>
        /// This method will store the parameters and the current <see cref="ISourceWriter.IndentationLevel" /> inside
        /// of this <see cref="Frame" /> for later referencing.
        /// </remarks>
        /// <param name="variables">A source of variable for a method, from which to grab any <see cref="Variable"/>s that this
        ///     frame needs but does not create.</param>
        /// <param name="method">The method this <see cref="Frame"/> belongs to.</param>
        /// <param name="writer">Where to write the code to.</param>
        public void GenerateCode(IMethodVariables variables, GeneratedMethod method, IMethodSourceWriter writer)
        {
            this.BlockLevel = writer.IndentationLevel;

            this._variables = variables;
            this._method    = method;
            this._writer    = writer;

            method.RegisterFrame(this);

            this.Generate(new MethodVariableUsageRecorder(variables, this._uses), method, writer, this.Next);
        }