Esempio n. 1
0
        /// <summary>
        /// Creates a <see cref="StackValue"/> instance with a unique name, to be used for a compiler generated variable.
        /// </summary>
        /// <param name="unsafe">Whether the value is unsafe.</param>
        /// <param name="stackSpace">The number of items the value should take up on the stack.</param>
        /// <returns>The created <see cref="StackValue"/>.</returns>
        public StackValue CreateStackValue(bool @unsafe = false, int stackSpace = 1)
        {
            StackValue value = new StackValue("@" + _nextStackID++, DataType.Object, @unsafe, stackSpace);

            StackValues.Add(value);
            return(value);
        }
Esempio n. 2
0
 /// <summary>
 /// Creates the code to clean up the stack at the end of a scope.
 /// </summary>
 /// <returns>The code to clean up the stack at the end of a scope.</returns>
 public IEnumerable <Block> CreateCleanUp()
 {
     return(StackValues.SelectMany(stackValue => stackValue.CreateDestruction()));
 }