What's the motivation for this change? Did some code actually trip this up, or was this more a result of the new way constructor functions do work, whereas in the past, the majority of JsNew operations didn't do anything interesting?
-Ray On Tue, Apr 13, 2010 at 7:59 AM, <sp...@google.com> wrote: > Reviewers: scottb, > > Description: > Have JsInliner refuse to interpose a new expression > before a substituted argument. > > > Please review this at http://gwt-code-reviews.appspot.com/344801/show > > Affected files: > M dev/core/src/com/google/gwt/dev/js/JsInliner.java > M dev/core/test/com/google/gwt/dev/js/JsInlinerTest.java > > > Index: dev/core/src/com/google/gwt/dev/js/JsInliner.java > =================================================================== > --- dev/core/src/com/google/gwt/dev/js/JsInliner.java (revision 7879) > +++ dev/core/src/com/google/gwt/dev/js/JsInliner.java (working copy) > @@ -673,6 +673,12 @@ > maintainsOrder = false; > } > } > + > + public void endVisit(JsNew x, JsContext<JsExpression> ctx) { > + if (unevaluated.size() > 0) { > + maintainsOrder = false; > + } > + } > > @Override > public void endVisit(JsNameRef x, JsContext<JsExpression> ctx) { > Index: dev/core/test/com/google/gwt/dev/js/JsInlinerTest.java > =================================================================== > --- dev/core/test/com/google/gwt/dev/js/JsInlinerTest.java (revision > 7879) > +++ dev/core/test/com/google/gwt/dev/js/JsInlinerTest.java (working > copy) > @@ -80,6 +80,29 @@ > compare(expected, input); > } > > + /** > + * Test that a new expression breaks argument ordering. > + */ > + public void testOrderingNew() throws Exception { > + StringBuffer code = new StringBuffer(); > + // A static variable x > + code.append("var x;"); > + > + // foo() uses x > + code.append("function foo() { alert('x = ' + x); }"); > + > + // callee does "new foo" before evaluating its argument > + code.append("function callee(arg) { new foo(); return arg; }"); > + > + // caller invokes callee with a multi that initializes x > + code.append("function caller() { callee((x=1,2)); }"); > + > + // bootstrap the program > + code.append("caller();"); > + > + compare(code.toString(), code.toString()); > + } > + > public void testSelfRecursion() throws Exception { > String input = "function a1() { return blah && b1() }" > + "function b1() { return bar && a1()}" + "function c() { a1() } > c()"; > > > -- > http://groups.google.com/group/Google-Web-Toolkit-Contributors > > To unsubscribe, reply using "remove me" as the subject. > -- http://groups.google.com/group/Google-Web-Toolkit-Contributors