Example #1
0
 public ICode procedureBody(
     String the_name, FunctionType ft, List<String> names, int scope_level) {
   IFunction newbody =
       new Function(
           (IProcedureContainer) findEnclosingDelcarationContainer(),
           the_name,
           ft,
           names,
           scope_level);
   currentProcedure = newbody;
   ((IDeclarationContainer) currentCode).addFunction(newbody);
   newCodeBody(newbody);
   return newbody;
 }
Example #2
0
 public IDecl newLocation(String name, int scopeLevel) {
   Decl newcode = new Decl(name, scopeLevel);
   if (currentCode instanceof IDeclarationContainer) { // following compilation error
     ((IDeclarationContainer) currentCode).addLocation(newcode);
     // TODO check out error here in a for loop
     // loop can't be cast to IDeclarationContainer
   }
   // If this decl is within a function add it to a list recording
   // decls that are in scope and may require garbage collection
   Function f = findEnclosingFunctionContainer();
   if (f != null) {
     f.getLocalDeclsInScope().add(newcode);
   }
   newCodeBody(newcode);
   return newcode;
 }