2017-02-16 11:21:07 +00:00
|
|
|
var UglifyJS = require('../../');
|
|
|
|
|
var assert = require("assert");
|
|
|
|
|
|
|
|
|
|
describe("Accessor tokens", function() {
|
|
|
|
|
it("Should fill the token information for accessors (issue #1492)", function() {
|
2017-02-16 12:55:24 +00:00
|
|
|
// location 0 1 2 3 4
|
|
|
|
|
// 01234567890123456789012345678901234567890123456789
|
2017-02-16 11:21:07 +00:00
|
|
|
var ast = UglifyJS.parse("var obj = { get latest() { return undefined; } }");
|
|
|
|
|
|
|
|
|
|
// test there are no nodes without tokens
|
|
|
|
|
var checkWalker = new UglifyJS.TreeWalker(function(node, descend) {
|
2017-02-16 11:51:53 +00:00
|
|
|
if (node instanceof UglifyJS.AST_Accessor) {
|
2017-02-16 12:55:24 +00:00
|
|
|
assert.equal(node.start.pos, 22);
|
2017-02-16 11:51:53 +00:00
|
|
|
assert.equal(node.end.endpos, 46);
|
|
|
|
|
}
|
2017-02-16 11:21:07 +00:00
|
|
|
});
|
|
|
|
|
ast.walk(checkWalker);
|
|
|
|
|
});
|
|
|
|
|
});
|