demo/typescript.js
function createIdentifier(isIdentifier, diagnosticMessage) {
            identifierCount++;
            if (isIdentifier) {
                var node = createNode(69 /* Identifier */);
                // Store original token kind if it is not just an Identifier so we can report appropriate error later in type checker
                if (token !== 69 /* Identifier */) {
                    node.originalKeywordKind = token;
                }
                node.text = internIdentifier(scanner.getTokenValue());
                nextToken();
                return finishNode(node);
            }
            return createMissingNode(69 /* Identifier */, /*reportAtCurrentPosition*/ false, diagnosticMessage || ts.Diagnostics.Identifier_expected);
        }
function createIdentifier(isIdentifier, diagnosticMessage) {
            identifierCount++;
            if (isIdentifier) {
                var node = createNode(69 /* Identifier */);
                // Store original token kind if it is not just an Identifier so we can report appropriate error later in type checker
                if (token !== 69 /* Identifier */) {
                    node.originalKeywordKind = token;
                }
                node.text = internIdentifier(scanner.getTokenValue());
                nextToken();
                return finishNode(node);
            }
            return createMissingNode(69 /* Identifier */, /*reportAtCurrentPosition*/ false, diagnosticMessage || ts.Diagnostics.Identifier_expected);
        }
function createIdentifier ( isIdentifier , diagnosticMessage ) { identifierCount ++ ; if ( isIdentifier ) { var node = createNode ( 69 /* Identifier */ ) ; // Store original token kind if it is not just an Identifier so we can report appropriate error later in type checker if ( token !== 69 /* Identifier */ ) { node . originalKeywordKind = token ; } node . text = internIdentifier ( scanner . getTokenValue ( ) ) ; nextToken ( ) ; return finishNode ( node ) ; } return createMissingNode ( 69 /* Identifier */ , /*reportAtCurrentPosition*/ false , diagnosticMessage || ts . Diagnostics . Identifier_expected ) ; }
An identifier that starts with two underscores has an extra underscore character prepended to it to avoid issues with magic property names like '__proto__'. The 'identifiers' object is used to share a single string instance for each identifier in order to reduce memory consumption.
An identifier that starts with two underscores has an extra underscore character prepended to it to avoid issues with magic property names like __proto__ . The identifiers object is used to share a single string instance for each identifier in order to reduce memory consumption .