Skip to content

Commit 7339eca

Browse files
Maxwell Heibermheiber
authored andcommitted
can parse private names (#1)
do a really rough, quick-and-dirty unblock-people job of letting #foo be parse-able. steps to test: npm run lint && npm test See https://bbgithub.dev.bloomberg.com/javascript-guild/typescript-private-fields/ quick start guide for seeing the AST CI testing coming soon
1 parent ccf7cd7 commit 7339eca

File tree

1 file changed

+5
-4
lines changed

1 file changed

+5
-4
lines changed

src/compiler/scanner.ts

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1725,10 +1725,7 @@ namespace ts {
17251725
return token = SyntaxKind.Unknown;
17261726
case CharacterCodes.hash:
17271727
pos++;
1728-
if (
1729-
languageVersion === ScriptTarget.ESNext
1730-
&& isIdentifierStart(ch = text.charCodeAt(pos), languageVersion)
1731-
) {
1728+
if (isIdentifierStart(ch = text.charCodeAt(pos), languageVersion)) {
17321729
tokenFlags |= TokenFlags.PrivateName;
17331730
pos++;
17341731
while (pos < end && isIdentifierPart(ch = text.charCodeAt(pos), languageVersion)) pos++;
@@ -1739,7 +1736,11 @@ namespace ts {
17391736
return token = SyntaxKind.Identifier;
17401737
}
17411738
error(Diagnostics.Invalid_character);
1739+
<<<<<<< HEAD
17421740
// no `pos++` because already advanced at beginning of this `case` statement
1741+
=======
1742+
pos++;
1743+
>>>>>>> can parse private names (#1)
17431744
return token = SyntaxKind.Unknown;
17441745
default:
17451746
if (isIdentifierStart(ch, languageVersion)) {

0 commit comments

Comments
 (0)