2013-05-22 22:39:19 +00:00
|
|
|
/*******************************************************************************
|
|
|
|
* Copyright (c) 2013 IBM Corporation.
|
|
|
|
* All rights reserved. This program and the accompanying materials
|
|
|
|
* are made available under the terms of the Eclipse Public License v1.0
|
|
|
|
* which accompanies this distribution, and is available at
|
|
|
|
* http://www.eclipse.org/legal/epl-v10.html
|
|
|
|
*
|
|
|
|
* Contributors:
|
|
|
|
* IBM Corporation - initial API and implementation
|
|
|
|
*******************************************************************************/
|
2012-01-06 21:48:01 +00:00
|
|
|
package com.ibm.wala.cast.js.ipa.callgraph;
|
|
|
|
|
|
|
|
import com.ibm.wala.ipa.callgraph.AnalysisOptions;
|
|
|
|
import com.ibm.wala.ipa.callgraph.AnalysisScope;
|
2012-02-17 20:22:30 +00:00
|
|
|
import com.ibm.wala.ipa.callgraph.CGNode;
|
2012-01-06 21:48:01 +00:00
|
|
|
import com.ibm.wala.ipa.callgraph.Entrypoint;
|
2012-02-17 20:22:30 +00:00
|
|
|
import com.ibm.wala.ipa.callgraph.propagation.cfa.CallerSiteContext;
|
2012-01-06 21:48:01 +00:00
|
|
|
|
|
|
|
/**
|
|
|
|
* call graph construction options specific to JavaScript.
|
|
|
|
*/
|
|
|
|
public class JSAnalysisOptions extends AnalysisOptions {
|
|
|
|
|
|
|
|
/**
|
|
|
|
* should the analysis model the semantics of Function.prototype.call / apply?
|
|
|
|
* Defaults to true.
|
|
|
|
*/
|
|
|
|
private boolean handleCallApply = true;
|
2012-01-06 21:48:28 +00:00
|
|
|
|
|
|
|
private boolean useLoadFileTargetSelector = true;
|
2012-01-06 21:48:01 +00:00
|
|
|
|
2012-02-17 20:22:30 +00:00
|
|
|
/**
|
|
|
|
* should the analysis employ additional context sensitivity for more precise handling of lexical accesses? if true, then:
|
|
|
|
*
|
|
|
|
* <ol>
|
|
|
|
* <li>Employ a {@link CallerSiteContext} for calls to constructors of functions that may perform a lexical access.</li>
|
|
|
|
* <li>Employ a {@link CallerSiteContext} for calls to functions that may perform a lexical access.</li>
|
|
|
|
* </ol>
|
|
|
|
*
|
|
|
|
* The above helps to avoid conflation of lexical variables associated with distinct {@link CGNode}s.
|
|
|
|
*/
|
|
|
|
private boolean usePreciseLexical = false;
|
|
|
|
|
2012-01-06 21:48:01 +00:00
|
|
|
public JSAnalysisOptions(AnalysisScope scope, Iterable<? extends Entrypoint> e) {
|
|
|
|
super(scope, e);
|
|
|
|
}
|
2012-10-01 17:11:10 +00:00
|
|
|
|
2012-01-06 21:48:01 +00:00
|
|
|
/**
|
|
|
|
* should the analysis model the semantics of Function.prototype.call / apply?
|
|
|
|
*/
|
|
|
|
public boolean handleCallApply() {
|
|
|
|
return handleCallApply;
|
|
|
|
}
|
|
|
|
|
|
|
|
public void setHandleCallApply(boolean handleCallApply) {
|
|
|
|
this.handleCallApply = handleCallApply;
|
|
|
|
}
|
|
|
|
|
2012-01-06 21:48:28 +00:00
|
|
|
public boolean useLoadFileTargetSelector() {
|
|
|
|
return useLoadFileTargetSelector;
|
|
|
|
}
|
|
|
|
|
|
|
|
public void setUseLoadFileTargetSelector(boolean useIt) {
|
|
|
|
this.useLoadFileTargetSelector = useIt;
|
|
|
|
}
|
2012-02-17 20:22:30 +00:00
|
|
|
|
|
|
|
public boolean usePreciseLexical() {
|
|
|
|
return usePreciseLexical;
|
|
|
|
}
|
|
|
|
|
|
|
|
public void setUsePreciseLexical(boolean usePreciseLexical) {
|
|
|
|
this.usePreciseLexical = usePreciseLexical;
|
|
|
|
}
|
2012-01-06 21:48:01 +00:00
|
|
|
}
|