Exemplo n.º 1
0
 public void visit(AbsVarDecl acceptor) {
   // Lokalna spremenljivka.
   // Parametre obdelamo pri AbsFunDecl.
   // Komponente obdelamo pri AbsRecType.
   Frame frame = frms.peek();
   SemType type = TypeResolver.getType(acceptor.name);
   int offset = frame.addVariable(type.size());
   Access access = new Access(frame.level, offset);
   setAccess(acceptor, access);
   acceptor.type.accept(this);
 }
Exemplo n.º 2
0
 public void visit(AbsRecType acceptor) {
   int offset = 0;
   for (AbsDecl decl : acceptor.comps.decls) {
     AbsVarDecl varDecl = (AbsVarDecl) decl;
     Access varAccess = new Access(-1, offset);
     setAccess(varDecl, varAccess);
     SemType type = TypeResolver.getType(varDecl.name);
     offset += type.size();
     varDecl.type.accept(this);
   }
 }