@Test void testDeclareLocalVariable() { var scope = new Scope(null); scope.declareLocalVariable("first", PrimitiveType.INT); scope.declareLocalVariable("second", PrimitiveType.INT); assertNotNull(scope.getLocalVariable("first")); assertNotNull(scope.getLocalVariable("second")); }
public Local declareLocalVariable(String name, Type type) { var info = new Local(name, type); variables.put(name, info); return info; }
Scope { public Local declareLocalVariable(String name, Type type) { var info = new Local(name, type); variables.put(name, info); return info; } }
Scope { public Local declareLocalVariable(String name, Type type) { var info = new Local(name, type); variables.put(name, info); return info; } Scope(Scope parent); }
Scope { public Local declareLocalVariable(String name, Type type) { var info = new Local(name, type); variables.put(name, info); return info; } Scope(Scope parent); Local declareLocalVariable(String name, Type type); Local getLocalVariable(String name); ArrayInfo declareArray(String name, PrimitiveType type); ArrayInfo declareArray(int index, String name, PrimitiveType type); ArrayInfo getArray(String name); Scope createChild(); }
Scope { public Local declareLocalVariable(String name, Type type) { var info = new Local(name, type); variables.put(name, info); return info; } Scope(Scope parent); Local declareLocalVariable(String name, Type type); Local getLocalVariable(String name); ArrayInfo declareArray(String name, PrimitiveType type); ArrayInfo declareArray(int index, String name, PrimitiveType type); ArrayInfo getArray(String name); Scope createChild();  }