Skip to content

Commit

Permalink
fix code with code point
Browse files Browse the repository at this point in the history
  • Loading branch information
mysticatea authored and marijnh committed Apr 24, 2021
1 parent 7ff960a commit 206ec4c
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 1 deletion.
2 changes: 1 addition & 1 deletion acorn/src/tokenize.js
Original file line number Diff line number Diff line change
Expand Up @@ -316,7 +316,7 @@ pp.readToken_question = function() { // '?'

pp.readToken_numberSign = function() { // '#'
const ecmaVersion = this.options.ecmaVersion
let code = "#"
let code = 35 // '#'
if (ecmaVersion >= 13) {
++this.pos
code = this.fullCharCodeAtPos()
Expand Down
3 changes: 3 additions & 0 deletions test/tests-class-features-2022.js
Original file line number Diff line number Diff line change
Expand Up @@ -1755,6 +1755,9 @@ test("class C { #𩸽 }", {
"sourceType": "script"
}, {ecmaVersion: 13})

// old ecma version
testFail("class C { #aaa }", "Unexpected character '#' (1:10)", {ecmaVersion: 12})

// Unexpected character
testFail("class C { # aaa }", "Unexpected character ' ' (1:11)", {ecmaVersion: 13})
testFail("class C { #+aaa }", "Unexpected character '+' (1:11)", {ecmaVersion: 13})
Expand Down

0 comments on commit 206ec4c

Please sign in to comment.