import { IS_IDENTIFIER_CHAR , IS_IDENTIFIER_START } from "../parser/util/identifier" ; const RESERVED_WORDS = new Set < string > ( ) ; const init = [ "break" , "case" , "catch" , "class" , "const" , "continue" , "debugger" , "default" , "delete" , "do" , "else" , "export" , "extends" , "finally" , "for" , "function" , "if" , "import" , "in" , "instanceof" , "new" , "return" , "super" , "switch" , "this" , "throw" , "try" , "typeof" , "var" , "void" , "while" , "with" , "yield" , "enum" , "implements" , "interface" , "let" , "package" , "private" , "protected" , "public" , "static" , "await" , ] ; for ( let i = 0 ; i < init . length ; i ++ ) { RESERVED_WORDS . add ( init [ i ] ) ; } export default function isIdentifier ( name ) { if ( name . length === 0 ) { return false ; } if ( ! IS_IDENTIFIER_START [ name . charCodeAt ( 0 ) ] ) { return false ; } for ( let i = 1 ; i < name . length ; i ++ ) { if ( ! IS_IDENTIFIER_CHAR [ name . charCodeAt ( i ) ] ) { return false ; } } return ! RESERVED_WORDS . has ( name ) ; }