Skip to content

Commit

Permalink
Better error message for top-level private names
Browse files Browse the repository at this point in the history
  • Loading branch information
nicolo-ribaudo committed Sep 18, 2019
1 parent 1973ba3 commit 8e836dd
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 9 deletions.
10 changes: 2 additions & 8 deletions packages/babel-parser/src/tokenizer/index.js
Expand Up @@ -381,14 +381,8 @@ export default class Tokenizer extends LocationParser {
}

if (
(this.hasPlugin("classPrivateProperties") ||
this.hasPlugin("classPrivateMethods")) &&
this.state.classLevel > 0
) {
++this.state.pos;
this.finishToken(tt.hash);
return;
} else if (
this.hasPlugin("classPrivateProperties") ||
this.hasPlugin("classPrivateMethods") ||
this.getPluginOption("pipelineOperator", "proposal") === "smart"
) {
this.finishOp(tt.hash, 1);
Expand Down
@@ -1,4 +1,4 @@
{
"plugins": ["classPrivateProperties"],
"throws": "Unexpected character '#' (1:15)"
"throws": "Private name #priv is not defined (1:15)"
}

0 comments on commit 8e836dd

Please sign in to comment.