Skip to content
This repository was archived by the owner on May 19, 2018. It is now read-only.

NumberLiteralSeparator: Stage 1 feature plugin. Closes gh-538 #541

Merged
merged 4 commits into from
May 26, 2017
Merged
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
fix-up to change includes -> indexOf
Signed-off-by: Rick Waldron <[email protected]>
  • Loading branch information
rwaldron committed May 26, 2017
commit 465d80b5e66e83869bb1f1481f64bc327958317e
4 changes: 2 additions & 2 deletions src/tokenizer/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -577,8 +577,8 @@ export default class Tokenizer extends LocationParser {
const prev = this.input.charCodeAt(this.state.pos - 1);
const next = this.input.charCodeAt(this.state.pos + 1);
if (code === 95) {
if (forbiddenNumericLiteralSeparatorSiblings.includes(prev) ||
forbiddenNumericLiteralSeparatorSiblings.includes(next) ||
if ((forbiddenNumericLiteralSeparatorSiblings.indexOf(prev) > -1) ||
(forbiddenNumericLiteralSeparatorSiblings.indexOf(next) > -1) ||
Number.isNaN(next)) {
this.raise(this.state.pos, "Invalid NumericLiteralSeparator");
Copy link
Member

@hzoo hzoo May 26, 2017

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I might actually create a different error message for multi _, if it's at the end or the beginning, or around invalid chars but we can totally do that later too.

Could be a good 2nd PR

}
Expand Down