public void TestEnv() { AST.Env env = new AST.Env(); env = env.PushEntry(AST.Env.EntryLoc.GLOBAL, "global_var", new AST.TLong()); env = env.InScope(); List<Tuple<String, AST.ExprType>> args = new List<Tuple<String, AST.ExprType>>(); args.Add(new Tuple<String, AST.ExprType>("some_char", new AST.TChar())); args.Add(new Tuple<String, AST.ExprType>("another_char", new AST.TChar())); args.Add(new Tuple<String, AST.ExprType>("some_double", new AST.TDouble())); args.Add(new Tuple<String, AST.ExprType>("another_double", new AST.TDouble())); args.Add(new Tuple<String, AST.ExprType>("some_int", new AST.TLong())); AST.TFunction func = AST.TFunction.Create(new AST.TVoid(), args, false); AST.Env env2 = env.SetCurrentFunction(func); String log = env.Dump(); System.Diagnostics.Debug.WriteLine(log); }
public void TestShadow() { AST.Env env = new AST.Env(); env = env.PushEntry(AST.Env.EntryLoc.GLOBAL, "c", new AST.TChar()); env = env.InScope(); env = env.PushEntry(AST.Env.EntryLoc.STACK, "c", new AST.TLong()); String log = env.Dump(); System.Diagnostics.Debug.WriteLine(log); AST.Env.Entry entry = env.Find("c"); System.Diagnostics.Debug.WriteLine("c : " + entry.entry_loc + " " + entry.entry_type); }