Example #1
0
        /// <summary>
        /// Clone this value store, but only if the store has a valid value.
        /// </summary>
        /// <returns>The clone.</returns>
        public ValueStore Clone()
        {
            var store = new ValueStore(this.Type);

            store.Value = this.Value;
            return(store);
        }
Example #2
0
        public override StorageContext CreateStack()
        {
            int offset = (this.Type.ReturnType is VoidType ? 0 : 1);
            var stack  = new StorageContext(
                offset +
                this.Type.Parameters.Count +
                this.temporaryTypes.Length);

            if (offset > 0)
            {
                stack[0] = new ValueStore(this.Type.ReturnType);
            }

            for (int i = 0; i < this.Type.Parameters.Count; i++)
            {
                stack[offset + i] = new ValueStore(this.Type.Parameters[i].Type);
            }
            offset += this.Type.Parameters.Count;

            for (int i = 0; i < this.temporaryTypes.Length; i++)
            {
                stack[offset + i] = new ValueStore(this.temporaryTypes[i]);
            }

            return(stack);
        }