Skip to content

Question: Compiler API reject my node (Token end is child end; Node must have a real position for this operation) #24751

@Jack-Works

Description

@Jack-Works

I make some changes to the AST and I'm getting textChange back, but I get this.

Error: Debug Failure. False expression: Token end is child end
      at processChildNode (built\local\run.js:98799:34)
      ...... ignore some irrelavant details.
      at ChangeTracker.getChanges (built\local\run.js:100405:45)
      at transformComponentToSFC (https://github.com/Microsoft/TypeScript/pull/24518/files#diff-195c9482ed99d46952200f9fed3bffb4R273)

And If I ignore this assert, I get this

     Error: Debug Failure. False expression: Node must have a real position for this operation
      at NodeObject.assertHasRealPosition (built\local\run.js:107509:22)
      at NodeObject.getStart (built\local\run.js:107515:18)
      at processChildNode (built\local\run.js:98759:47)
      ......
      at Object.getTextChangesFromChanges (built\local\run.js:100428:86)
      at ChangeTracker.getChanges (built\local\run.js:100405:45)
      at transformComponentToSFC (https://github.com/Microsoft/TypeScript/pull/24518/files#diff-195c9482ed99d46952200f9fed3bffb4R273)

The code fails at changeTracker.getChanges(), ( https://github.com/Microsoft/TypeScript/pull/24518/files#diff-195c9482ed99d46952200f9fed3bffb4R344 ), and by the second Error, it seemed I've got some node wrong. But I can't figure out which node is corrupted.

Metadata

Metadata

Assignees

No one assigned

    Labels

    QuestionAn issue which isn't directly actionable in code

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions