1 package polyglot.ext.coffer.extension; 2 3 import polyglot.ast.*; 4 import polyglot.types.*; 5 import polyglot.util.*; 6 import polyglot.ext.jl.ast.*; 7 import polyglot.ext.coffer.ast.*; 8 import polyglot.ext.coffer.types.*; 9 10 import java.util.*; 11 12 public class SpecialExt_c extends CofferExt_c { 13 public void checkHeldKeys(KeySet held, KeySet stored) throws SemanticException { 14 Special e = (Special) node(); 15 16 if (e.kind() == Special.THIS) { 17 if (e.type() instanceof CofferClassType) { 18 Key key = ((CofferClassType) e.type()).key(); 19 20 if (key != null) { 21 if (! stored.contains(key)) { 22 throw new SemanticException( 23 "Can evaluate expression of type \"" + 24 e.type() + "\" only if key \"" + key + 25 "\" is held by \"this\".", e.position()); 26 27 } 28 } 29 } 30 } 31 } 32 } 33 | Popular Tags |