diff --git a/com.ibm.wala.cast.js.test/examples-src/tests/function_apply.js b/com.ibm.wala.cast.js.test/examples-src/tests/function_apply.js new file mode 100644 index 000000000..bc45ab52e --- /dev/null +++ b/com.ibm.wala.cast.js.test/examples-src/tests/function_apply.js @@ -0,0 +1,5 @@ +function bar(y) { return y + 3; } + +var p = bar; +p.apply(null, [7]); + diff --git a/com.ibm.wala.cast.js.test/examples-src/tests/function_call.js b/com.ibm.wala.cast.js.test/examples-src/tests/function_call.js index 8f7ed0738..804090b22 100644 --- a/com.ibm.wala.cast.js.test/examples-src/tests/function_call.js +++ b/com.ibm.wala.cast.js.test/examples-src/tests/function_call.js @@ -1 +1,5 @@ -(function foo(x) { return x; }).call(null, 3); \ No newline at end of file +function foo(x) { return x; } + +var z = foo; +z.call(null, 3); + diff --git a/com.ibm.wala.cast.js.test/harness-src/com/ibm/wala/cast/js/test/TestSimpleCallGraphShape.java b/com.ibm.wala.cast.js.test/harness-src/com/ibm/wala/cast/js/test/TestSimpleCallGraphShape.java index 3f81c5fc6..95c9bb686 100644 --- a/com.ibm.wala.cast.js.test/harness-src/com/ibm/wala/cast/js/test/TestSimpleCallGraphShape.java +++ b/com.ibm.wala.cast.js.test/harness-src/com/ibm/wala/cast/js/test/TestSimpleCallGraphShape.java @@ -292,6 +292,12 @@ public abstract class TestSimpleCallGraphShape extends TestJSCallGraphShape { // TODO assert that foo() is reachable } + @Test public void testFunctionDotApply() throws IOException, IllegalArgumentException, CancelException { + Util.makeScriptCG("tests", "function_apply.js"); + // TODO assert that bar() is reachable + } + + protected IVector>> computeIkIdToVns(PointerAnalysis pa) { // Created by reversing the points to mapping for local pointer keys.