UglifyJS-old
UglifyJS-old copied to clipboard
More embedded tokens
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.
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 }
It works now. Example (it was highlighted by itself): http://thejh.github.com/boxednodes.html @mishoo Are you going to merge this?