Export to GitHub

google-web-toolkit - issue #4512

JsStackEmulator may break up JsInvocation


Posted on Jan 18, 2010 by Massive Lion

Found in GWT Release (e.g. 1.5.3, 1.6 RC):

trunk r7422

Detailed description (please be as specific as possible):

JsStackEmulator.LocationVisitor may separate JsArrayAccess's from invocations. This can cause the "this" value to be incorrect.

Shortest code snippet which demonstrates issue (please indicate where actual result differs from expected result):

Expected: correct=true Actual (with emulated stack & line numbers): correct=false

public void onModuleLoad() { Window.alert("correct=" + nativeTest()); }

private static native boolean nativeTest() /-{ var bar = { foo: function() { return this === bar; } } return bar'foo' }-/;

Workaround if you have one:

Remove JsStackEmulator.LocationVisitor.endVisit(JsArrayAccess x, JsContext<JsExpression> ctx)

Comment #1

Posted on Jan 19, 2010 by Grumpy Wombat

I can look at it.

Comment #2

Posted on Jan 19, 2010 by Grumpy Wombat

The problem should only come up for the receivers of function invocations. It should be enough, then, that JsStackEmulator not replace exp with anything syntactically different from exp.

Comment #3

Posted on Jan 19, 2010 by Grumpy Wombat

Patch for review at http://gwt-code-reviews.appspot.com/132815 .

Comment #4

Posted on Feb 2, 2010 by Grumpy Wombat

Fix committed at r7516 .

Comment #5

Posted on Feb 23, 2010 by Grumpy Wombat

(No comment was entered for this change.)

Comment #6

Posted on Oct 29, 2010 by Grumpy Hippo

(No comment was entered for this change.)

Status: Fixed

Labels:
Milestone-2_1