Skip to content

Commit

Permalink
Improve @babel/types with env.BABEL_TYPES_8_BREAKING
Browse files Browse the repository at this point in the history
  • Loading branch information
nicolo-ribaudo committed Dec 23, 2019
1 parent 83993b0 commit 60d964c
Show file tree
Hide file tree
Showing 14 changed files with 512 additions and 192 deletions.
6 changes: 5 additions & 1 deletion packages/babel-types/scripts/generators/docs.js
Expand Up @@ -101,8 +101,12 @@ Object.keys(types.BUILDER_KEYS)
}
if (defaultValue !== null || types.NODE_FIELDS[key][field].optional) {
fieldDescription.push(
" (default: `" + util.inspect(defaultValue) + "`)"
" (default: `" + util.inspect(defaultValue) + "`"
);
if (types.BUILDER_KEYS[key].indexOf(field) < 0) {
fieldDescription.push(", excluded from builder function");
}
fieldDescription.push(")");
} else {
fieldDescription.push(" (required)");
}
Expand Down
6 changes: 3 additions & 3 deletions packages/babel-types/src/asserts/generated/index.js
Expand Up @@ -224,12 +224,12 @@ export function assertArrowFunctionExpression(
export function assertClassBody(node: Object, opts?: Object = {}): void {
assert("ClassBody", node, opts);
}
export function assertClassDeclaration(node: Object, opts?: Object = {}): void {
assert("ClassDeclaration", node, opts);
}
export function assertClassExpression(node: Object, opts?: Object = {}): void {
assert("ClassExpression", node, opts);
}
export function assertClassDeclaration(node: Object, opts?: Object = {}): void {
assert("ClassDeclaration", node, opts);
}
export function assertExportAllDeclaration(
node: Object,
opts?: Object = {},
Expand Down
8 changes: 4 additions & 4 deletions packages/babel-types/src/builders/generated/index.js
Expand Up @@ -225,14 +225,14 @@ export function ClassBody(...args: Array<any>): Object {
return builder("ClassBody", ...args);
}
export { ClassBody as classBody };
export function ClassDeclaration(...args: Array<any>): Object {
return builder("ClassDeclaration", ...args);
}
export { ClassDeclaration as classDeclaration };
export function ClassExpression(...args: Array<any>): Object {
return builder("ClassExpression", ...args);
}
export { ClassExpression as classExpression };
export function ClassDeclaration(...args: Array<any>): Object {
return builder("ClassDeclaration", ...args);
}
export { ClassDeclaration as classDeclaration };
export function ExportAllDeclaration(...args: Array<any>): Object {
return builder("ExportAllDeclaration", ...args);
}
Expand Down
6 changes: 6 additions & 0 deletions packages/babel-types/src/constants/index.js
Expand Up @@ -41,6 +41,12 @@ export const BINARY_OPERATORS = [
...BOOLEAN_BINARY_OPERATORS,
];

export const ASSIGNMENT_OPERATORS = [
"=",
"+=",
...NUMBER_BINARY_OPERATORS.map(op => op + "="),
];

export const BOOLEAN_UNARY_OPERATORS = ["delete", "!"];
export const NUMBER_UNARY_OPERATORS = ["+", "-", "~"];
export const STRING_UNARY_OPERATORS = ["typeof"];
Expand Down

0 comments on commit 60d964c

Please sign in to comment.