UglifyJS-old icon indicating copy to clipboard operation
UglifyJS-old copied to clipboard

More embedded tokens

Open thejh opened this issue 14 years ago • 2 comments

See #241 - this at least sticks tokens on every single AST node in https://github.com/thejh/node-astjourney/blob/c8b5c7eb6d498100a5eaeba452ce245b2b5fa7fb/index.js (test at https://github.com/thejh/node-astjourney/blob/c8b5c7eb6d498100a5eaeba452ce245b2b5fa7fb/test/token-locations.js#L23-35 ).

Note that I didn't verify whether all the tokens are the right ones.

thejh avatar Dec 20 '11 19:12 thejh

Hmm, actually, looks like some of the token data is messed up. :(

> ast.statements[1].stat.rvalue
{ parent: null,
  type: 'num',
  scope: null,
  children: [Getter],
  rawNode: 
   [ { name: 'num',
       start: [Object],
       end: [Object] },
     4 ],
  position: 
   { startToken: 
      { type: 'num',
        value: 4,
        line: 1,
        col: 2,
        pos: 6,
        endpos: 7,
        nlb: false,
        comments_before: [] },
     endToken: 
      { type: 'operator',
        value: '+',
        line: 1,
        col: 1,
        pos: 5,
        endpos: 6,
        nlb: false,
        comments_before: [] } },
  value: 4 }

thejh avatar Dec 20 '11 21:12 thejh

It works now. Example (it was highlighted by itself): http://thejh.github.com/boxednodes.html @mishoo Are you going to merge this?

thejh avatar Jan 22 '12 15:01 thejh