Ejemplo n.º 1
0
        /// <summary>Adds a variable at the highest scope.</summary>
        /// <param name="var">The variable name.</param>
        /// <param name="type">The variable value.</param>
        /// <returns>The added variable's location.</returns>
        public int AddVariable(string var, TagType type)
        {
            int  id = CLVarID++;
            Type rawType;

            if (type.Meta.RawInternal)
            {
                rawType = type.RawInternalType;
            }
            else
            {
                rawType = type.RawType;
            }
            FieldInfo         newField = Type.DefineField("_field_locVar_" + id, rawType, FieldAttributes.Public);
            SingleCILVariable variable = new(id, var, new TagReturnType(type, type.Meta.RawInternal), newField);

            CLVariables[LVarIDs.Peek()].Add(variable);
            Variables.Add(variable);
            return(id);
        }
Ejemplo n.º 2
0
 /// <summary>Pops the newest set of variables, to end a scope.</summary>
 public void PopVarSet()
 {
     LVarIDs.Pop();
 }
Ejemplo n.º 3
0
 /// <summary>Pushes a new set of variables, to start a scope.</summary>
 public void PushVarSet()
 {
     LVarIDs.Push(CLVariables.Count);
     CLVariables.Add(new List <SingleCILVariable>());
 }