Closed Bug 782896 Opened 12 years ago Closed 6 years ago

Reflect.parse shows wrong loc for multiline blocks

Categories

(Core :: JavaScript Engine, defect)

defect
Not set
normal

Tracking

()

RESOLVED WORKSFORME

People

(Reporter: espadrine, Unassigned)

Details

(Whiteboard: [js:p3])

The following input, entered in a chrome-enabled scratchpad:

> Components.utils.import("resource://gre/modules/reflect.jsm");
> JSON.stringify(Reflect.parse("{\nlet foo = 3;}"), null, 2);

… will output a parse tree where the BlockStatement node
has the following, invalid, "loc" property:

    {
      "start": {
        "line": 1,
        "column": 0
      },
      "end": {
        "line": 1,
        "column": 1
      },
      "source": null
    }

It should rather be like this:

    {
      "start": {
        "line": 1,
        "column": 0
      },
      "end": {
        "line": 2,
        "column": 13
      },
      "source": null
    }

Currently, only the span of the first line is reflected, for blocks.
Whiteboard: [js:p3]
Assignee: general → nobody
No longer reproducible, therefore closing as WFM.

---
      "loc": {
        "start": {
          "line": 1,
          "column": 0
        },
        "end": {
          "line": 2,
          "column": 13
        },
        "source": null
      },
      "type": "BlockStatement",
---
Status: NEW → RESOLVED
Closed: 6 years ago
Resolution: --- → WORKSFORME
You need to log in before you can comment on or make changes to this bug.