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:
Daniel Tschinder
2017-11-18 21:54:24 +01:00
committed by GitHub
parent f3004d0d4d
commit 7064b298d7
3 changed files with 2 additions and 8 deletions

View File

@@ -661,6 +661,7 @@ defineType("RestElement", {
visitor: ["argument", "typeAnnotation"],
builder: ["argument"],
aliases: ["LVal", "PatternLike"],
deprecatedAlias: "RestProperty",
fields: {
...patternLikeCommon,
argument: {

View File

@@ -466,6 +466,7 @@ defineType("ObjectPattern", {
defineType("SpreadElement", {
visitor: ["argument"],
aliases: ["UnaryLike"],
deprecatedAlias: "SpreadProperty",
fields: {
argument: {
validate: assertNodeType("Expression"),

View File

@@ -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.
*/