checkDeclarationInBlockStatementNode(md, nametable, bsn);
}
}
+
+ // check loop body
+ checkDeclarationInBlockNode(md, nametable, ln.getBody());
}
private void checkMethodBody(ClassDescriptor cd, MethodDescriptor md) {
public static boolean isGreaterThan(Location loc1, Location loc2, ClassDescriptor priorityCD) {
- //System.out.println("isGreaterThan=" + loc1 + " ? " + loc2);
+ // System.out.println("isGreaterThan=" + loc1 + " ? " + loc2);
CompositeLocation compLoc1;
CompositeLocation compLoc2;
}
// comparing two composite locations
- // System.out.println("compare base location=" + compLoc1 + " ? " + compLoc2);
+ // System.out.println("compare base location=" + compLoc1 + " ? " +
+ // compLoc2);
int baseCompareResult = compareBaseLocationSet(compLoc1, compLoc2, priorityCD);
if (baseCompareResult == ComparisonResult.EQUAL) {
if (priorityLoc1.getLocIdentifier().equals(priorityLoc2.getLocIdentifier())) {
// have the same level of local hierarchy
- } else if (locationOrder.isGreaterThan(priorityLoc1.getLocIdentifier(), priorityLoc2
- .getLocIdentifier())) {
+ } else if (locationOrder.isGreaterThan(priorityLoc1.getLocIdentifier(),
+ priorityLoc2.getLocIdentifier())) {
// if priority loc of compLoc1 is higher than compLoc2
// then, compLoc 1 is higher than compLoc2
return ComparisonResult.GREATER;
this.excprefetch=new HashSet();
this.classpath=new Vector();
this.cd2locationOrderMap=new Hashtable();
+ this.cd2locationPropertyMap=new Hashtable();
this.lines=0;
}
private int numstaticblocks=0;
private int arraycount=0;
public Hashtable cd2locationOrderMap;
+ public Hashtable cd2locationPropertyMap;
public boolean OPTIMIZE=false;
public boolean LINENUM=false;
return cd2locationOrderMap;
}
+ public void addLocationPropertySet(ClassDescriptor cd, Set<String> set){
+ cd2locationPropertyMap.put(cd,set);
+ }
+
+ public Hashtable getCd2LocationPropertyMap(){
+ return cd2locationOrderMap;
+ }
+
}
private void parseLocationOrder(ClassDescriptor cd, ParseNode pn) {
ParseNodeVector pnv = pn.getChildren();
Lattice<String> locOrder =
- new Lattice<String>("_top_","_bottom_");
+ new Lattice<String>("_top_","_bottom_");
+ Set<String> spinLocSet=new HashSet<String>();
for (int i = 0; i < pnv.size(); i++) {
ParseNode loc = pnv.elementAt(i);
- String lowerLoc=loc.getChildren().elementAt(0).getLabel();
- String higherLoc= loc.getChildren().elementAt(1).getLabel();
- locOrder.put(higherLoc, lowerLoc);
- if (locOrder.isIntroducingCycle(higherLoc)) {
- throw new Error("Error: the order relation " + lowerLoc + " < " + higherLoc
- + " introduces a cycle.");
+ if(isNode(loc,"location_property")){
+ String spinLoc=loc.getChildren().elementAt(0).getLabel();
+ spinLocSet.add(spinLoc);
+ }else{
+ String lowerLoc=loc.getChildren().elementAt(0).getLabel();
+ String higherLoc= loc.getChildren().elementAt(1).getLabel();
+ locOrder.put(higherLoc, lowerLoc);
+ if (locOrder.isIntroducingCycle(higherLoc)) {
+ throw new Error("Error: the order relation " + lowerLoc + " < " + higherLoc
+ + " introduces a cycle.");
+ }
}
}
+ if(spinLocSet.size()>0){
+ state.addLocationPropertySet(cd, spinLocSet);
+ }
state.addLocationOrder(cd, locOrder);
}
pn.addChild(loc2);
RESULT=pn;
:}
+ | IDENTIFIER:loc MULT{:
+ ParseNode pn=new ParseNode("location_property",parser.lexer.line_num);
+ pn.addChild(loc);
+ RESULT=pn;
+ :}
;
// 19.9) Interfaces