mirror of
https://github.com/microsoft/TypeScript.git
synced 2026-05-17 01:49:57 -05:00
allow to use keywords as jsx identifiers
This commit is contained in:
@@ -12,6 +12,10 @@ namespace ts {
|
||||
export function createNode(kind: SyntaxKind): Node {
|
||||
return new (getNodeConstructor(kind))();
|
||||
}
|
||||
|
||||
export function tokenIsIdentifierOrKeyword(token: SyntaxKind): boolean {
|
||||
return token >= SyntaxKind.Identifier;
|
||||
}
|
||||
|
||||
function visitNode<T>(cbNode: (node: Node) => T, node: Node): T {
|
||||
if (node) {
|
||||
@@ -4102,7 +4106,7 @@ namespace ts {
|
||||
}
|
||||
|
||||
function isIdentifierOrKeyword() {
|
||||
return token >= SyntaxKind.Identifier;
|
||||
return tokenIsIdentifierOrKeyword(token);
|
||||
}
|
||||
|
||||
function nextTokenIsIdentifierOrKeywordOnSameLine() {
|
||||
|
||||
@@ -1590,7 +1590,7 @@ namespace ts {
|
||||
// Scans a JSX identifier; these differ from normal identifiers in that
|
||||
// they allow dashes
|
||||
function scanJsxIdentifier(): SyntaxKind {
|
||||
if (token === SyntaxKind.Identifier) {
|
||||
if (tokenIsIdentifierOrKeyword(token)) {
|
||||
let firstCharPosition = pos;
|
||||
while (pos < end) {
|
||||
let ch = text.charCodeAt(pos);
|
||||
|
||||
Reference in New Issue
Block a user