1 package polyglot.types; 2 3 import polyglot.ast.*; 4 import polyglot.util.*; 5 import java.util.*; 6 7 11 public class CompoundResolver implements TopLevelResolver { 12 TopLevelResolver head; 13 TopLevelResolver tail; 14 15 20 public CompoundResolver(TopLevelResolver head, TopLevelResolver tail) { 21 this.head = head; 22 this.tail = tail; 23 } 24 25 public String toString() { 26 return "(compound " + head + " " + tail + ")"; 27 } 28 29 32 public boolean packageExists(String name) { 33 return head.packageExists(name) || tail.packageExists(name); 34 } 35 36 39 public Named find(String name) throws SemanticException { 40 try { 41 return head.find(name); 42 } 43 catch (NoClassException e) { 44 return tail.find(name); 45 } 46 } 47 } 48 | Popular Tags |