Make SpreadProperty and RestProperty a deprecatedAlias (#6853)
instead of hardcoding backwards compatiblity. This way we get deprecation warnings and also builders will work.
This commit is contained in:
@@ -661,6 +661,7 @@ defineType("RestElement", {
|
||||
visitor: ["argument", "typeAnnotation"],
|
||||
builder: ["argument"],
|
||||
aliases: ["LVal", "PatternLike"],
|
||||
deprecatedAlias: "RestProperty",
|
||||
fields: {
|
||||
...patternLikeCommon,
|
||||
argument: {
|
||||
|
||||
@@ -466,6 +466,7 @@ defineType("ObjectPattern", {
|
||||
defineType("SpreadElement", {
|
||||
visitor: ["argument"],
|
||||
aliases: ["UnaryLike"],
|
||||
deprecatedAlias: "SpreadProperty",
|
||||
fields: {
|
||||
argument: {
|
||||
validate: assertNodeType("Expression"),
|
||||
|
||||
@@ -77,14 +77,6 @@ for (const type in t.VISITOR_KEYS) {
|
||||
registerType(type);
|
||||
}
|
||||
|
||||
// Compat helpers so code for Babel 6.x is more likely to work on Babel 7.x.
|
||||
export function isRestProperty(...args) {
|
||||
return t.isRestElement(...args);
|
||||
}
|
||||
export function isSpreadProperty(...args) {
|
||||
return t.isSpreadElement(...args);
|
||||
}
|
||||
|
||||
/**
|
||||
* Flip `ALIAS_KEYS` for faster access in the reverse direction.
|
||||
*/
|
||||
|
||||
Reference in New Issue
Block a user