/// <summary> /// Fetches variables of given name from global to local function scope when global keyword is used /// </summary> /// <param name="variables">Variables that are fetched from global scope</param> public virtual void GlobalStatement(IEnumerable <VariableIdentifier> variables) { foreach (var variable in variables) { OutSet.FetchFromGlobal(variable.PossibleNames); } }
public override void ConstantDeclaration(ConstantDecl x, MemoryEntry constantValue) { var constantName = ".constant_" + x.Name; var constantVar = new VariableIdentifier(constantName); OutSet.FetchFromGlobal(constantVar.DirectName); OutSet.GetVariable(constantVar).WriteMemory(OutSnapshot, constantValue); }
public override MemoryEntry Constant(GlobalConstUse x) { Value result; switch (x.Name.Name.Value) { case "true": result = OutSet.CreateBool(true); break; case "false": result = OutSet.CreateBool(false); break; default: var constantName = ".constant_" + x.Name; var constantVar = new VariableIdentifier(constantName); OutSet.FetchFromGlobal(constantVar.DirectName); return(OutSet.ReadVariable(constantVar).ReadMemory(OutSnapshot)); } return(new MemoryEntry(result)); }