Advertisement
Guest User

Untitled

a guest
Mar 30th, 2020
101
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Java 5 0.60 KB | None | 0 0
  1.     protected String isExist(String name, Integer scope) {
  2.         System.out.print(name + scope);
  3.         String variableName = name + scope.toString();
  4.         if(scope == 1) {
  5.             if(!globals.hasSymbol(variableName)) {
  6.                 throw new RuntimeException("Variable " + variableName + " is not existing in global scope.");
  7.             }
  8.         } else {
  9.                 for(Integer i = scope; i >= locals.getMemorySize(); i--) {
  10.                     String tempName = name + i.toString();
  11.                     if(!locals.hasSymbol(tempName)) {
  12.                         throw new RuntimeException("Variable " + name + " is not existing in local scope.");
  13.                     }
  14.                 }
  15.             }
  16.         return variableName;
  17.     }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement