Skip to content

Commit

Permalink
rename more features
Browse files Browse the repository at this point in the history
  • Loading branch information
evanw committed Jun 18, 2022
1 parent 78c7fe4 commit 8ff05e1
Show file tree
Hide file tree
Showing 4 changed files with 54 additions and 54 deletions.
12 changes: 6 additions & 6 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -59,12 +59,12 @@
* `object-rest-spread`
* `optional-catch-binding`
* `optional-chain`
* `reg-exp-dot-all-flag`
* `reg-exp-lookbehind-assertions`
* `reg-exp-match-indices`
* `reg-exp-named-capture-groups`
* `reg-exp-sticky-and-unicode-flags`
* `reg-exp-unicode-property-escapes`
* `regexp-dot-all-flag`
* `regexp-lookbehind-assertions`
* `regexp-match-indices`
* `regexp-named-capture-groups`
* `regexp-sticky-and-unicode-flags`
* `regexp-unicode-property-escapes`
* `rest-argument`
* `template-literal`
* `top-level-await`
Expand Down
48 changes: 24 additions & 24 deletions internal/compat/js_table.go
Original file line number Diff line number Diff line change
Expand Up @@ -83,12 +83,12 @@ const (
ObjectRestSpread
OptionalCatchBinding
OptionalChain
RegExpDotAllFlag
RegExpLookbehindAssertions
RegExpMatchIndices
RegExpNamedCaptureGroups
RegExpStickyAndUnicodeFlags
RegExpUnicodePropertyEscapes
RegexpDotAllFlag
RegexpLookbehindAssertions
RegexpMatchIndices
RegexpNamedCaptureGroups
RegexpStickyAndUnicodeFlags
RegexpUnicodePropertyEscapes
RestArgument
TemplateLiteral
TopLevelAwait
Expand Down Expand Up @@ -137,12 +137,12 @@ var StringToJSFeature = map[string]JSFeature{
"object-rest-spread": ObjectRestSpread,
"optional-catch-binding": OptionalCatchBinding,
"optional-chain": OptionalChain,
"reg-exp-dot-all-flag": RegExpDotAllFlag,
"reg-exp-lookbehind-assertions": RegExpLookbehindAssertions,
"reg-exp-match-indices": RegExpMatchIndices,
"reg-exp-named-capture-groups": RegExpNamedCaptureGroups,
"reg-exp-sticky-and-unicode-flags": RegExpStickyAndUnicodeFlags,
"reg-exp-unicode-property-escapes": RegExpUnicodePropertyEscapes,
"regexp-dot-all-flag": RegexpDotAllFlag,
"regexp-lookbehind-assertions": RegexpLookbehindAssertions,
"regexp-match-indices": RegexpMatchIndices,
"regexp-named-capture-groups": RegexpNamedCaptureGroups,
"regexp-sticky-and-unicode-flags": RegexpStickyAndUnicodeFlags,
"regexp-unicode-property-escapes": RegexpUnicodePropertyEscapes,
"rest-argument": RestArgument,
"template-literal": TemplateLiteral,
"top-level-await": TopLevelAwait,
Expand Down Expand Up @@ -191,12 +191,12 @@ var JSFeatureToString = map[JSFeature]string{
ObjectRestSpread: "object-rest-spread",
OptionalCatchBinding: "optional-catch-binding",
OptionalChain: "optional-chain",
RegExpDotAllFlag: "reg-exp-dot-all-flag",
RegExpLookbehindAssertions: "reg-exp-lookbehind-assertions",
RegExpMatchIndices: "reg-exp-match-indices",
RegExpNamedCaptureGroups: "reg-exp-named-capture-groups",
RegExpStickyAndUnicodeFlags: "reg-exp-sticky-and-unicode-flags",
RegExpUnicodePropertyEscapes: "reg-exp-unicode-property-escapes",
RegexpDotAllFlag: "regexp-dot-all-flag",
RegexpLookbehindAssertions: "regexp-lookbehind-assertions",
RegexpMatchIndices: "regexp-match-indices",
RegexpNamedCaptureGroups: "regexp-named-capture-groups",
RegexpStickyAndUnicodeFlags: "regexp-sticky-and-unicode-flags",
RegexpUnicodePropertyEscapes: "regexp-unicode-property-escapes",
RestArgument: "rest-argument",
TemplateLiteral: "template-literal",
TopLevelAwait: "top-level-await",
Expand Down Expand Up @@ -583,7 +583,7 @@ var jsTable = map[JSFeature]map[Engine][]versionRange{
Opera: {{start: v{77, 0, 0}}},
Safari: {{start: v{13, 1, 0}}},
},
RegExpDotAllFlag: {
RegexpDotAllFlag: {
Chrome: {{start: v{62, 0, 0}}},
Edge: {{start: v{79, 0, 0}}},
ES: {{start: v{2018, 0, 0}}},
Expand All @@ -593,15 +593,15 @@ var jsTable = map[JSFeature]map[Engine][]versionRange{
Opera: {{start: v{49, 0, 0}}},
Safari: {{start: v{11, 1, 0}}},
},
RegExpLookbehindAssertions: {
RegexpLookbehindAssertions: {
Chrome: {{start: v{62, 0, 0}}},
Edge: {{start: v{79, 0, 0}}},
ES: {{start: v{2018, 0, 0}}},
Firefox: {{start: v{78, 0, 0}}},
Node: {{start: v{8, 10, 0}}},
Opera: {{start: v{49, 0, 0}}},
},
RegExpMatchIndices: {
RegexpMatchIndices: {
Chrome: {{start: v{90, 0, 0}}},
Edge: {{start: v{90, 0, 0}}},
ES: {{start: v{2022, 0, 0}}},
Expand All @@ -610,7 +610,7 @@ var jsTable = map[JSFeature]map[Engine][]versionRange{
Opera: {{start: v{76, 0, 0}}},
Safari: {{start: v{15, 0, 0}}},
},
RegExpNamedCaptureGroups: {
RegexpNamedCaptureGroups: {
Chrome: {{start: v{64, 0, 0}}},
Edge: {{start: v{79, 0, 0}}},
ES: {{start: v{2018, 0, 0}}},
Expand All @@ -620,7 +620,7 @@ var jsTable = map[JSFeature]map[Engine][]versionRange{
Opera: {{start: v{51, 0, 0}}},
Safari: {{start: v{11, 1, 0}}},
},
RegExpStickyAndUnicodeFlags: {
RegexpStickyAndUnicodeFlags: {
Chrome: {{start: v{50, 0, 0}}},
Edge: {{start: v{13, 0, 0}}},
ES: {{start: v{2015, 0, 0}}},
Expand All @@ -630,7 +630,7 @@ var jsTable = map[JSFeature]map[Engine][]versionRange{
Opera: {{start: v{37, 0, 0}}},
Safari: {{start: v{12, 0, 0}}},
},
RegExpUnicodePropertyEscapes: {
RegexpUnicodePropertyEscapes: {
Chrome: {{start: v{64, 0, 0}}},
Edge: {{start: v{79, 0, 0}}},
ES: {{start: v{2018, 0, 0}}},
Expand Down
24 changes: 12 additions & 12 deletions internal/js_parser/js_parser.go
Original file line number Diff line number Diff line change
Expand Up @@ -11633,17 +11633,17 @@ pattern:
tail := pattern[i:]

if strings.HasPrefix(tail, "?<=") || strings.HasPrefix(tail, "?<!") {
if p.options.unsupportedJSFeatures.Has(compat.RegExpLookbehindAssertions) {
feature = compat.RegExpLookbehindAssertions
if p.options.unsupportedJSFeatures.Has(compat.RegexpLookbehindAssertions) {
feature = compat.RegexpLookbehindAssertions
what = "Lookbehind assertions in regular expressions are not available"
r = logger.Range{Loc: logger.Loc{Start: loc.Start + int32(i) + 1}, Len: 3}
isUnsupported = true
break pattern
}
} else if strings.HasPrefix(tail, "?<") {
if p.options.unsupportedJSFeatures.Has(compat.RegExpNamedCaptureGroups) {
if p.options.unsupportedJSFeatures.Has(compat.RegexpNamedCaptureGroups) {
if end := strings.IndexByte(tail, '>'); end >= 0 {
feature = compat.RegExpNamedCaptureGroups
feature = compat.RegexpNamedCaptureGroups
what = "Named capture groups in regular expressions are not available"
r = logger.Range{Loc: logger.Loc{Start: loc.Start + int32(i) + 1}, Len: int32(end) + 1}
isUnsupported = true
Expand All @@ -11667,9 +11667,9 @@ pattern:
tail := pattern[i:]

if isUnicode && (strings.HasPrefix(tail, "p{") || strings.HasPrefix(tail, "P{")) {
if p.options.unsupportedJSFeatures.Has(compat.RegExpUnicodePropertyEscapes) {
if p.options.unsupportedJSFeatures.Has(compat.RegexpUnicodePropertyEscapes) {
if end := strings.IndexByte(tail, '}'); end >= 0 {
feature = compat.RegExpUnicodePropertyEscapes
feature = compat.RegexpUnicodePropertyEscapes
what = "Unicode property escapes in regular expressions are not available"
r = logger.Range{Loc: logger.Loc{Start: loc.Start + int32(i)}, Len: int32(end) + 2}
isUnsupported = true
Expand All @@ -11689,22 +11689,22 @@ pattern:
continue // These are part of ES5 and are always supported

case 's':
if !p.options.unsupportedJSFeatures.Has(compat.RegExpDotAllFlag) {
if !p.options.unsupportedJSFeatures.Has(compat.RegexpDotAllFlag) {
continue // This is part of ES2018
}
feature = compat.RegExpDotAllFlag
feature = compat.RegexpDotAllFlag

case 'y', 'u':
if !p.options.unsupportedJSFeatures.Has(compat.RegExpStickyAndUnicodeFlags) {
if !p.options.unsupportedJSFeatures.Has(compat.RegexpStickyAndUnicodeFlags) {
continue // These are part of ES2018
}
feature = compat.RegExpStickyAndUnicodeFlags
feature = compat.RegexpStickyAndUnicodeFlags

case 'd':
if !p.options.unsupportedJSFeatures.Has(compat.RegExpMatchIndices) {
if !p.options.unsupportedJSFeatures.Has(compat.RegexpMatchIndices) {
continue // This is part of ES2022
}
feature = compat.RegExpMatchIndices
feature = compat.RegexpMatchIndices

default:
// Unknown flags are never supported
Expand Down
24 changes: 12 additions & 12 deletions scripts/compat-table.js
Original file line number Diff line number Diff line change
Expand Up @@ -37,18 +37,18 @@ const features = {
'class': { target: 'Class' },
'generators': { target: 'Generator' },
'Unicode code point escapes': { target: 'UnicodeEscapes' },
'RegExp "y" and "u" flags': { target: 'RegExpStickyAndUnicodeFlags' },
'RegExp "y" and "u" flags': { target: 'RegexpStickyAndUnicodeFlags' },

// >ES6 features
'exponentiation (**) operator': { target: 'ExponentOperator' },
'nested rest destructuring, declarations': { target: 'NestedRestBinding' },
'nested rest destructuring, parameters': { target: 'NestedRestBinding' },
'async functions': { target: 'AsyncAwait' },
'object rest/spread properties': { target: 'ObjectRestSpread' },
'RegExp Lookbehind Assertions': { target: 'RegExpLookbehindAssertions' },
'RegExp named capture groups': { target: 'RegExpNamedCaptureGroups' },
'RegExp Unicode Property Escapes': { target: 'RegExpUnicodePropertyEscapes' },
's (dotAll) flag for regular expressions': { target: 'RegExpDotAllFlag' },
'RegExp Lookbehind Assertions': { target: 'RegexpLookbehindAssertions' },
'RegExp named capture groups': { target: 'RegexpNamedCaptureGroups' },
'RegExp Unicode Property Escapes': { target: 'RegexpUnicodePropertyEscapes' },
's (dotAll) flag for regular expressions': { target: 'RegexpDotAllFlag' },
'Asynchronous Iterators: async generators': { target: 'AsyncGenerator' },
'Asynchronous Iterators: for-await-of loops': { target: 'ForAwait' },
'optional catch binding': { target: 'OptionalCatchBinding' },
Expand Down Expand Up @@ -143,7 +143,7 @@ mergeVersions('ForOf', { es2015: true })
mergeVersions('Generator', { es2015: true })
mergeVersions('NewTarget', { es2015: true })
mergeVersions('ObjectExtensions', { es2015: true })
mergeVersions('RegExpStickyAndUnicodeFlags', { es2015: true })
mergeVersions('RegexpStickyAndUnicodeFlags', { es2015: true })
mergeVersions('RestArgument', { es2015: true })
mergeVersions('TemplateLiteral', { es2015: true })
mergeVersions('UnicodeEscapes', { es2015: true })
Expand All @@ -155,10 +155,10 @@ mergeVersions('AsyncAwait', { es2017: true })
mergeVersions('AsyncGenerator', { es2018: true })
mergeVersions('ForAwait', { es2018: true })
mergeVersions('ObjectRestSpread', { es2018: true })
mergeVersions('RegExpDotAllFlag', { es2018: true })
mergeVersions('RegExpLookbehindAssertions', { es2018: true })
mergeVersions('RegExpNamedCaptureGroups', { es2018: true })
mergeVersions('RegExpUnicodePropertyEscapes', { es2018: true })
mergeVersions('RegexpDotAllFlag', { es2018: true })
mergeVersions('RegexpLookbehindAssertions', { es2018: true })
mergeVersions('RegexpNamedCaptureGroups', { es2018: true })
mergeVersions('RegexpUnicodePropertyEscapes', { es2018: true })
mergeVersions('OptionalCatchBinding', { es2019: true })
mergeVersions('Bigint', { es2020: true })
mergeVersions('ImportMeta', { es2020: true })
Expand All @@ -178,7 +178,7 @@ mergeVersions('ClassStaticBlocks', { es2022: true })
mergeVersions('ClassStaticField', { es2022: true })
mergeVersions('TopLevelAwait', { es2022: true })
mergeVersions('ArbitraryModuleNamespaceNames', { es2022: true })
mergeVersions('RegExpMatchIndices', { es2022: true })
mergeVersions('RegexpMatchIndices', { es2022: true })
mergeVersions('ImportAssertions', {})

// Manually copied from https://caniuse.com/?search=export%20*%20as
Expand Down Expand Up @@ -295,7 +295,7 @@ mergeVersions('ClassStaticBlocks', {
})

// Manually copied from https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/RegExp/hasIndices
mergeVersions('RegExpMatchIndices', {
mergeVersions('RegexpMatchIndices', {
chrome90: true,
edge90: true,
firefox88: true,
Expand Down

0 comments on commit 8ff05e1

Please sign in to comment.