Only introduce property name contexts for constant keys.
This commit is contained in:
parent
9367ad57db
commit
0f334e59e3
|
@ -32,8 +32,8 @@ public abstract class TestAjaxsltCallGraphShape extends TestJSCallGraphShape {
|
|||
|
||||
@Test public void testAjaxslt() throws IOException, IllegalArgumentException, CancelException, WalaException {
|
||||
URL url = getClass().getClassLoader().getResource("ajaxslt/test/xslt.html");
|
||||
// need 1-CFA for this; alternatively need to turn off correlation tracking
|
||||
CallGraph CG = JSCallGraphBuilderUtil.makeHTMLCG(url, CGBuilderType.ONE_CFA_PRECISE_LEXICAL);
|
||||
// need to turn off call/apply handling for this to scale; alternatively use 1-CFA
|
||||
CallGraph CG = JSCallGraphBuilderUtil.makeHTMLCG(url, CGBuilderType.ZERO_ONE_CFA_NO_CALL_APPLY);
|
||||
|
||||
verifyGraphAssertions(CG, assertionsForAjaxslt);
|
||||
}
|
||||
|
|
|
@ -30,6 +30,7 @@ import com.ibm.wala.ipa.callgraph.ContextKey;
|
|||
import com.ibm.wala.ipa.callgraph.ContextSelector;
|
||||
import com.ibm.wala.ipa.callgraph.impl.Everywhere;
|
||||
import com.ibm.wala.ipa.callgraph.propagation.ConcreteTypeKey;
|
||||
import com.ibm.wala.ipa.callgraph.propagation.ConstantKey;
|
||||
import com.ibm.wala.ipa.callgraph.propagation.FilteredPointerKey.SingleInstanceFilter;
|
||||
import com.ibm.wala.ipa.callgraph.propagation.InstanceKey;
|
||||
import com.ibm.wala.ssa.DefUse;
|
||||
|
@ -213,16 +214,10 @@ public class PropertyNameContextSelector implements ContextSelector {
|
|||
public Context getCalleeTarget(CGNode caller, CallSiteReference site, IMethod callee, final InstanceKey[] receiver) {
|
||||
Context baseContext = base.getCalleeTarget(caller, site, callee, receiver);
|
||||
|
||||
if(receiver.length > index) {
|
||||
if(receiver.length > index && receiver[index] instanceof ConstantKey) {
|
||||
Frequency f = usesFirstArgAsPropertyName(callee);
|
||||
if(f == Frequency.ALWAYS|| f == Frequency.SOMETIMES) {
|
||||
if(receiver[index] == null) {
|
||||
IClass undef = caller.getClassHierarchy().lookupClass(JavaScriptTypes.Undefined);
|
||||
return new PropNameContext(baseContext, new ConcreteTypeKey(undef));
|
||||
} else {
|
||||
return new PropNameContext(baseContext, receiver[index]);
|
||||
}
|
||||
}
|
||||
if(f == Frequency.ALWAYS|| f == Frequency.SOMETIMES)
|
||||
return new PropNameContext(baseContext, receiver[index]);
|
||||
}
|
||||
|
||||
if (PROPNAME_MARKER.equals(caller.getContext().get(PROPNAME_KEY))) {
|
||||
|
|
Loading…
Reference in New Issue