Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- protected String isExist(String name, Integer scope) {
- System.out.print(name + scope);
- String variableName = name + scope.toString();
- if(scope == 1) {
- if(!globals.hasSymbol(variableName)) {
- throw new RuntimeException("Variable " + variableName + " is not existing in global scope.");
- }
- } else {
- for(Integer i = scope; i >= locals.getMemorySize(); i--) {
- String tempName = name + i.toString();
- if(!locals.hasSymbol(tempName)) {
- throw new RuntimeException("Variable " + name + " is not existing in local scope.");
- }
- }
- }
- return variableName;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement