Skip to content

Commit 9bb958f

Browse files
committed
Update acorn to v7
1 parent 7cd9cba commit 9bb958f

File tree

4 files changed

+20
-10
lines changed

4 files changed

+20
-10
lines changed

lib/bigint/index.js

Lines changed: 9 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,7 @@ module.exports = function(Parser) {
1818

1919
anonymous.prototype.parseLiteral = function parseLiteral (value) {
2020
var node = Parser.prototype.parseLiteral.call(this, value)
21-
if (node.raw.charCodeAt(node.raw.length - 1) == 110) { node.bigint = node.raw }
21+
if (node.raw.charCodeAt(node.raw.length - 1) == 110) { node.bigint = this.getNumberInput(node.start, node.end) }
2222
return node
2323
};
2424

@@ -28,7 +28,7 @@ module.exports = function(Parser) {
2828
var val = this.readInt(radix)
2929
if (val === null) { this.raise(this.start + 2, ("Expected number in radix " + radix)) }
3030
if (this.input.charCodeAt(this.pos) == 110) {
31-
var str = this.input.slice(start, this.pos)
31+
var str = this.getNumberInput(start, this.pos)
3232
val = typeof BigInt !== "undefined" ? BigInt(str) : null
3333
++this.pos
3434
} else if (isIdentifierStart(this.fullCharCodeAtPos())) { this.raise(this.pos, "Identifier directly after number") }
@@ -54,12 +54,18 @@ module.exports = function(Parser) {
5454
return Parser.prototype.readNumber.call(this, startsWithDot)
5555
}
5656

57-
var str = this.input.slice(start, this.pos)
57+
var str = this.getNumberInput(start, this.pos)
5858
var val = typeof BigInt !== "undefined" ? BigInt(str) : null
5959
++this.pos
6060
return this.finishToken(tt.num, val)
6161
};
6262

63+
// This is basically a hook for acorn-numeric-separator
64+
anonymous.prototype.getNumberInput = function getNumberInput (start, end) {
65+
if (Parser.prototype.getNumberInput) { return Parser.prototype.getNumberInput.call(this, start, end) }
66+
return this.input.slice(start, end)
67+
};
68+
6369
return anonymous;
6470
}(Parser))
6571
}

lib/import-meta/index.js

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -37,6 +37,9 @@ module.exports = function(Parser) {
3737
if (node.property.name !== "meta") {
3838
this.raiseRecoverable(node.property.start, "The only valid meta property for import is import.meta")
3939
}
40+
if (this.containsEsc) {
41+
this.raiseRecoverable(node.property.start, "\"meta\" in import.meta must not contain escape sequences")
42+
}
4043
return this.finishNode(node, "MetaProperty")
4144
};
4245

lib/private-class-elements/index.js

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,9 +3,11 @@
33
"use strict"
44

55
var acorn = require("acorn")
6+
/* MANUALLY EDITED DESPITE THE ABOVE WARNING :D
67
if (acorn.version.indexOf("6.") != 0 || acorn.version.indexOf("6.0.") == 0) {
78
throw new Error(("acorn-private-class-elements requires acorn@^6.1.0, not " + (acorn.version)))
89
}
10+
*/
911
var tt = acorn.tokTypes
1012
var TokenType = acorn.TokenType
1113

package.json

Lines changed: 6 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -7,19 +7,18 @@
77
"url": "https://github.com/browserify/acorn-node/issues"
88
},
99
"dependencies": {
10-
"acorn": "^6.1.1",
11-
"acorn-dynamic-import": "^4.0.0",
12-
"acorn-walk": "^6.1.1",
13-
"xtend": "^4.0.1"
10+
"acorn": "^7.0.0",
11+
"acorn-walk": "^7.0.0",
12+
"xtend": "^4.0.2"
1413
},
1514
"devDependencies": {
16-
"acorn-bigint": "^0.3.1",
15+
"acorn-bigint": "^0.4.0",
1716
"acorn-class-fields": "^0.3.1",
1817
"acorn-export-ns-from": "^0.1.0",
19-
"acorn-import-meta": "^0.3.0",
18+
"acorn-import-meta": "^1.0.0",
2019
"acorn-private-class-elements": "^0.1.1",
2120
"acorn-static-class-features": "^0.2.0",
22-
"buble": "^0.19.7",
21+
"buble": "^0.19.8",
2322
"mkdirp": "^0.5.1",
2423
"standard": "^13.1.0",
2524
"tape": "^4.11.0"

0 commit comments

Comments
 (0)