Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- public Variable search(String name) {
- ListIterator<ArrayList<Variable>> blocks = stack.listIterator(stack.size());
- while(blocks.hasPrevious()) {
- ArrayList<Variable> block = blocks.previous();
- for(Variable v : block) {
- if( v.get_name().equals(name) ) {
- return v;
- }
- }
- }
- return null;
- }
- public Variable search_scope(String name, int _scope) {
- int diff;
- if(_scope > scope)
- return null;
- if(_scope == 0)
- diff = 0;
- else
- diff = scope - _scope;
- ArrayList<Variable> block = stack.elementAt(diff);
- for(Variable v : block) {
- if( v.get_name().equals(name) ) {
- return v;
- }
- }
- return null;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement