@@ -632,7 +632,7 @@ func (b *nodeBuilderImpl) createExpressionFromSymbolChain(chain []*ast.Symbol, i
632
632
return b .f .NewStringLiteral (b .getSpecifierForModuleSymbol (symbol , core .ResolutionModeNone ))
633
633
}
634
634
635
- if index == 0 || canUsePropertyAccess (symbolName , b . ch . languageVersion ) {
635
+ if index == 0 || canUsePropertyAccess (symbolName ) {
636
636
identifier := b .f .NewIdentifier (symbolName )
637
637
b .e .AddEmitFlags (identifier , printer .EFNoAsciiEscaping )
638
638
// !!! TODO: smuggle type arguments out
@@ -667,16 +667,16 @@ func (b *nodeBuilderImpl) createExpressionFromSymbolChain(chain []*ast.Symbol, i
667
667
return b .f .NewElementAccessExpression (b .createExpressionFromSymbolChain (chain , index - 1 ), nil , expression , ast .NodeFlagsNone )
668
668
}
669
669
670
- func canUsePropertyAccess (name string , languageVersion core. ScriptTarget ) bool {
670
+ func canUsePropertyAccess (name string ) bool {
671
671
if len (name ) == 0 {
672
672
return false
673
673
}
674
674
// TODO: in strada, this only used `isIdentifierStart` on the first character, while this checks the whole string for validity
675
675
// - possible strada bug?
676
676
if strings .HasPrefix (name , "#" ) {
677
- return len (name ) > 1 && scanner .IsIdentifierText (name [1 :], languageVersion , core .LanguageVariantStandard )
677
+ return len (name ) > 1 && scanner .IsIdentifierText (name [1 :], core .LanguageVariantStandard )
678
678
}
679
- return scanner .IsIdentifierText (name , languageVersion , core .LanguageVariantStandard )
679
+ return scanner .IsIdentifierText (name , core .LanguageVariantStandard )
680
680
}
681
681
682
682
func startsWithSingleOrDoubleQuote (str string ) bool {
@@ -705,7 +705,7 @@ func (b *nodeBuilderImpl) getNameOfSymbolFromNameType(symbol *ast.Symbol) string
705
705
case jsnum.Number :
706
706
name = v .String ()
707
707
}
708
- if ! scanner .IsIdentifierText (name , b . ch . compilerOptions . GetEmitScriptTarget (), core .LanguageVariantStandard ) && ! isNumericLiteralName (name ) {
708
+ if ! scanner .IsIdentifierText (name , core .LanguageVariantStandard ) && ! isNumericLiteralName (name ) {
709
709
return b .ch .valueToString (nameType .AsLiteralType ().value )
710
710
}
711
711
if isNumericLiteralName (name ) && strings .HasPrefix (name , "-" ) {
@@ -1976,9 +1976,9 @@ func (b *nodeBuilderImpl) trackComputedName(accessExpression *ast.Node, enclosin
1976
1976
}
1977
1977
}
1978
1978
1979
- func (b * nodeBuilderImpl ) createPropertyNameNodeForIdentifierOrLiteral (name string , target core. ScriptTarget , _singleQuote bool , stringNamed bool , isMethod bool ) * ast.Node {
1979
+ func (b * nodeBuilderImpl ) createPropertyNameNodeForIdentifierOrLiteral (name string , _singleQuote bool , stringNamed bool , isMethod bool ) * ast.Node {
1980
1980
isMethodNamedNew := isMethod && name == "new"
1981
- if ! isMethodNamedNew && scanner .IsIdentifierText (name , target , core .LanguageVariantStandard ) {
1981
+ if ! isMethodNamedNew && scanner .IsIdentifierText (name , core .LanguageVariantStandard ) {
1982
1982
return b .f .NewIdentifier (name )
1983
1983
}
1984
1984
if ! stringNamed && ! isMethodNamedNew && isNumericLiteralName (name ) && jsnum .FromString (name ) >= 0 {
@@ -2020,7 +2020,7 @@ func (b *nodeBuilderImpl) getPropertyNameNodeForSymbol(symbol *ast.Symbol) *ast.
2020
2020
if fromNameType != nil {
2021
2021
return fromNameType
2022
2022
}
2023
- return b .createPropertyNameNodeForIdentifierOrLiteral (symbol .Name , b . ch . compilerOptions . GetEmitScriptTarget (), singleQuote , stringNamed , isMethod )
2023
+ return b .createPropertyNameNodeForIdentifierOrLiteral (symbol .Name , singleQuote , stringNamed , isMethod )
2024
2024
}
2025
2025
2026
2026
// See getNameForSymbolFromNameType for a stringy equivalent
@@ -2040,14 +2040,14 @@ func (b *nodeBuilderImpl) getPropertyNameNodeForSymbolFromNameType(symbol *ast.S
2040
2040
case string :
2041
2041
name = nameType .AsLiteralType ().value .(string )
2042
2042
}
2043
- if ! scanner .IsIdentifierText (name , b . ch . compilerOptions . GetEmitScriptTarget (), core .LanguageVariantStandard ) && (stringNamed || ! isNumericLiteralName (name )) {
2043
+ if ! scanner .IsIdentifierText (name , core .LanguageVariantStandard ) && (stringNamed || ! isNumericLiteralName (name )) {
2044
2044
// !!! TODO: set singleQuote
2045
2045
return b .f .NewStringLiteral (name )
2046
2046
}
2047
2047
if isNumericLiteralName (name ) && name [0 ] == '-' {
2048
2048
return b .f .NewComputedPropertyName (b .f .NewPrefixUnaryExpression (ast .KindMinusToken , b .f .NewNumericLiteral (name [1 :])))
2049
2049
}
2050
- return b .createPropertyNameNodeForIdentifierOrLiteral (name , b . ch . compilerOptions . GetEmitScriptTarget (), singleQuote , stringNamed , isMethod )
2050
+ return b .createPropertyNameNodeForIdentifierOrLiteral (name , singleQuote , stringNamed , isMethod )
2051
2051
}
2052
2052
if nameType .flags & TypeFlagsUniqueESSymbol != 0 {
2053
2053
return b .f .NewComputedPropertyName (b .symbolToExpression (nameType .AsUniqueESSymbolType ().symbol , ast .SymbolFlagsValue ))
@@ -2737,7 +2737,7 @@ func (b *nodeBuilderImpl) typeToTypeNode(t *Type) *ast.TypeNode {
2737
2737
return parentName
2738
2738
}
2739
2739
memberName := ast .SymbolName (t .symbol )
2740
- if scanner .IsIdentifierText (memberName , core .ScriptTargetES5 , core . LanguageVariantStandard ) {
2740
+ if scanner .IsIdentifierText (memberName , core .LanguageVariantStandard ) {
2741
2741
return b .appendReferenceToType (parentName /* as TypeReferenceNode | ImportTypeNode */ , b .f .NewTypeReferenceNode (b .f .NewIdentifier (memberName ), nil /*typeArguments*/ ))
2742
2742
}
2743
2743
if ast .IsImportTypeNode (parentName ) {
0 commit comments