Closed Bug 892583 Opened 11 years ago Closed 8 years ago

Understand why withStatement isn't syntax-parseable

Categories

(Core :: JavaScript Engine, defect)

defect
Not set
normal

Tracking

()

RESOLVED DUPLICATE of bug 1297706

People

(Reporter: jorendorff, Unassigned)

Details

A with-statement rules out syntax parsing for the entire compilation unit.

Brian, why is this?

If I remove the specialization that implements this, we get one test failure:
  test262/ch12/12.10/12.10-0-1.js
shown below. I'd like to understand why this fails. We use the same code to create the binding for 'foo' in both parse modes, so I don't see offhand why it's affected. But it is.


function testcase() {
  var o = {};
  var f = function () {
	/* capture foo binding before executing with */
	return foo;
      }

  with (o) {
    var foo = "12.10-0-1";
  }

  return f()==="12.10-0-1"

 }
runTestCase(testcase);
I think that functions containing 'with' are not marked as having an extensible scope, even though they do, which will break TryConvertFreeName in the inner function.  I tried fixing the hasExtensibleScope thing and some mochitests broke or something and I didn't look into it.

Anyhow, I'd like to see this fixed too.  'with' is an ugly feature of the language but it's used by real web js and we shouldn't deoptimize parsing around it.
Assignee: general → nobody
Status: NEW → RESOLVED
Closed: 8 years ago
Resolution: --- → DUPLICATE
You need to log in before you can comment on or make changes to this bug.