Commit 5b5df7d0 authored by Rosanny Sihombing's avatar Rosanny Sihombing
Browse files

Revert "Merge branch 'cherry-pick-5b932c11' into 'testing'"

This reverts merge request !169
parent 4806fefb
Showing with 3184 additions and 82 deletions
+3184 -82
...@@ -269,7 +269,7 @@ export interface ObjectExpression extends BaseNode { ...@@ -269,7 +269,7 @@ export interface ObjectExpression extends BaseNode {
export interface ObjectMethod extends BaseNode { export interface ObjectMethod extends BaseNode {
type: "ObjectMethod"; type: "ObjectMethod";
kind: "method" | "get" | "set"; kind: "method" | "get" | "set";
key: Expression | Identifier | StringLiteral | NumericLiteral; key: Expression | Identifier | StringLiteral | NumericLiteral | BigIntLiteral;
params: Array<Identifier | Pattern | RestElement>; params: Array<Identifier | Pattern | RestElement>;
body: BlockStatement; body: BlockStatement;
computed: boolean; computed: boolean;
...@@ -510,7 +510,7 @@ export interface MetaProperty extends BaseNode { ...@@ -510,7 +510,7 @@ export interface MetaProperty extends BaseNode {
export interface ClassMethod extends BaseNode { export interface ClassMethod extends BaseNode {
type: "ClassMethod"; type: "ClassMethod";
kind: "get" | "set" | "method" | "constructor"; kind: "get" | "set" | "method" | "constructor";
key: Identifier | StringLiteral | NumericLiteral | Expression; key: Identifier | StringLiteral | NumericLiteral | BigIntLiteral | Expression;
params: Array<Identifier | Pattern | RestElement | TSParameterProperty>; params: Array<Identifier | Pattern | RestElement | TSParameterProperty>;
body: BlockStatement; body: BlockStatement;
computed: boolean; computed: boolean;
...@@ -606,7 +606,7 @@ export interface OptionalCallExpression extends BaseNode { ...@@ -606,7 +606,7 @@ export interface OptionalCallExpression extends BaseNode {
export interface ClassProperty extends BaseNode { export interface ClassProperty extends BaseNode {
type: "ClassProperty"; type: "ClassProperty";
key: Identifier | StringLiteral | NumericLiteral | Expression; key: Identifier | StringLiteral | NumericLiteral | BigIntLiteral | Expression;
value: Expression | null; value: Expression | null;
typeAnnotation: TypeAnnotation | TSTypeAnnotation | Noop | null; typeAnnotation: TypeAnnotation | TSTypeAnnotation | Noop | null;
decorators: Array<Decorator> | null; decorators: Array<Decorator> | null;
...@@ -624,7 +624,7 @@ export interface ClassProperty extends BaseNode { ...@@ -624,7 +624,7 @@ export interface ClassProperty extends BaseNode {
export interface ClassAccessorProperty extends BaseNode { export interface ClassAccessorProperty extends BaseNode {
type: "ClassAccessorProperty"; type: "ClassAccessorProperty";
key: Identifier | StringLiteral | NumericLiteral | Expression | PrivateName; key: Identifier | StringLiteral | NumericLiteral | BigIntLiteral | Expression | PrivateName;
value: Expression | null; value: Expression | null;
typeAnnotation: TypeAnnotation | TSTypeAnnotation | Noop | null; typeAnnotation: TypeAnnotation | TSTypeAnnotation | Noop | null;
decorators: Array<Decorator> | null; decorators: Array<Decorator> | null;
...@@ -645,7 +645,7 @@ export interface ClassPrivateProperty extends BaseNode { ...@@ -645,7 +645,7 @@ export interface ClassPrivateProperty extends BaseNode {
key: PrivateName; key: PrivateName;
value: Expression | null; value: Expression | null;
decorators: Array<Decorator> | null; decorators: Array<Decorator> | null;
static: any; static: boolean;
definite: boolean | null; definite: boolean | null;
readonly: boolean | null; readonly: boolean | null;
typeAnnotation: TypeAnnotation | TSTypeAnnotation | Noop | null; typeAnnotation: TypeAnnotation | TSTypeAnnotation | Noop | null;
...@@ -654,7 +654,7 @@ export interface ClassPrivateProperty extends BaseNode { ...@@ -654,7 +654,7 @@ export interface ClassPrivateProperty extends BaseNode {
export interface ClassPrivateMethod extends BaseNode { export interface ClassPrivateMethod extends BaseNode {
type: "ClassPrivateMethod"; type: "ClassPrivateMethod";
kind: "get" | "set" | "method" | "constructor"; kind: "get" | "set" | "method";
key: PrivateName; key: PrivateName;
params: Array<Identifier | Pattern | RestElement | TSParameterProperty>; params: Array<Identifier | Pattern | RestElement | TSParameterProperty>;
body: BlockStatement; body: BlockStatement;
...@@ -1268,7 +1268,7 @@ export interface TSDeclareFunction extends BaseNode { ...@@ -1268,7 +1268,7 @@ export interface TSDeclareFunction extends BaseNode {
export interface TSDeclareMethod extends BaseNode { export interface TSDeclareMethod extends BaseNode {
type: "TSDeclareMethod"; type: "TSDeclareMethod";
decorators: Array<Decorator> | null; decorators: Array<Decorator> | null;
key: Identifier | StringLiteral | NumericLiteral | Expression; key: Identifier | StringLiteral | NumericLiteral | BigIntLiteral | Expression;
typeParameters: TSTypeParameterDeclaration | Noop | null; typeParameters: TSTypeParameterDeclaration | Noop | null;
params: Array<Identifier | Pattern | RestElement | TSParameterProperty>; params: Array<Identifier | Pattern | RestElement | TSParameterProperty>;
returnType: TSTypeAnnotation | Noop | null; returnType: TSTypeAnnotation | Noop | null;
...@@ -1309,7 +1309,7 @@ export interface TSPropertySignature extends BaseNode { ...@@ -1309,7 +1309,7 @@ export interface TSPropertySignature extends BaseNode {
key: Expression; key: Expression;
typeAnnotation: TSTypeAnnotation | null; typeAnnotation: TSTypeAnnotation | null;
initializer: Expression | null; initializer: Expression | null;
computed: boolean | null; computed: boolean;
kind: "get" | "set"; kind: "get" | "set";
optional: boolean | null; optional: boolean | null;
readonly: boolean | null; readonly: boolean | null;
...@@ -1321,7 +1321,7 @@ export interface TSMethodSignature extends BaseNode { ...@@ -1321,7 +1321,7 @@ export interface TSMethodSignature extends BaseNode {
typeParameters: TSTypeParameterDeclaration | null; typeParameters: TSTypeParameterDeclaration | null;
parameters: Array<Identifier | RestElement>; parameters: Array<Identifier | RestElement>;
typeAnnotation: TSTypeAnnotation | null; typeAnnotation: TSTypeAnnotation | null;
computed: boolean | null; computed: boolean;
kind: "method" | "get" | "set"; kind: "method" | "get" | "set";
optional: boolean | null; optional: boolean | null;
} }
...@@ -1799,7 +1799,7 @@ export function memberExpression(object: Expression, property: Expression | Iden ...@@ -1799,7 +1799,7 @@ export function memberExpression(object: Expression, property: Expression | Iden
export function newExpression(callee: Expression | V8IntrinsicIdentifier, _arguments: Array<Expression | SpreadElement | JSXNamespacedName | ArgumentPlaceholder>): NewExpression; export function newExpression(callee: Expression | V8IntrinsicIdentifier, _arguments: Array<Expression | SpreadElement | JSXNamespacedName | ArgumentPlaceholder>): NewExpression;
export function program(body: Array<Statement>, directives?: Array<Directive>, sourceType?: "script" | "module", interpreter?: InterpreterDirective | null): Program; export function program(body: Array<Statement>, directives?: Array<Directive>, sourceType?: "script" | "module", interpreter?: InterpreterDirective | null): Program;
export function objectExpression(properties: Array<ObjectMethod | ObjectProperty | SpreadElement>): ObjectExpression; export function objectExpression(properties: Array<ObjectMethod | ObjectProperty | SpreadElement>): ObjectExpression;
export function objectMethod(kind: "method" | "get" | "set" | undefined, key: Expression | Identifier | StringLiteral | NumericLiteral, params: Array<Identifier | Pattern | RestElement>, body: BlockStatement, computed?: boolean, generator?: boolean, async?: boolean): ObjectMethod; export function objectMethod(kind: "method" | "get" | "set" | undefined, key: Expression | Identifier | StringLiteral | NumericLiteral | BigIntLiteral, params: Array<Identifier | Pattern | RestElement>, body: BlockStatement, computed?: boolean, generator?: boolean, async?: boolean): ObjectMethod;
export function objectProperty(key: Expression | Identifier | StringLiteral | NumericLiteral | BigIntLiteral | DecimalLiteral | PrivateName, value: Expression | PatternLike, computed?: boolean, shorthand?: boolean, decorators?: Array<Decorator> | null): ObjectProperty; export function objectProperty(key: Expression | Identifier | StringLiteral | NumericLiteral | BigIntLiteral | DecimalLiteral | PrivateName, value: Expression | PatternLike, computed?: boolean, shorthand?: boolean, decorators?: Array<Decorator> | null): ObjectProperty;
export function restElement(argument: LVal): RestElement; export function restElement(argument: LVal): RestElement;
export function returnStatement(argument?: Expression | null): ReturnStatement; export function returnStatement(argument?: Expression | null): ReturnStatement;
...@@ -1832,7 +1832,7 @@ export function importDefaultSpecifier(local: Identifier): ImportDefaultSpecifie ...@@ -1832,7 +1832,7 @@ export function importDefaultSpecifier(local: Identifier): ImportDefaultSpecifie
export function importNamespaceSpecifier(local: Identifier): ImportNamespaceSpecifier; export function importNamespaceSpecifier(local: Identifier): ImportNamespaceSpecifier;
export function importSpecifier(local: Identifier, imported: Identifier | StringLiteral): ImportSpecifier; export function importSpecifier(local: Identifier, imported: Identifier | StringLiteral): ImportSpecifier;
export function metaProperty(meta: Identifier, property: Identifier): MetaProperty; export function metaProperty(meta: Identifier, property: Identifier): MetaProperty;
export function classMethod(kind: "get" | "set" | "method" | "constructor" | undefined, key: Identifier | StringLiteral | NumericLiteral | Expression, params: Array<Identifier | Pattern | RestElement | TSParameterProperty>, body: BlockStatement, computed?: boolean, _static?: boolean, generator?: boolean, async?: boolean): ClassMethod; export function classMethod(kind: "get" | "set" | "method" | "constructor" | undefined, key: Identifier | StringLiteral | NumericLiteral | BigIntLiteral | Expression, params: Array<Identifier | Pattern | RestElement | TSParameterProperty>, body: BlockStatement, computed?: boolean, _static?: boolean, generator?: boolean, async?: boolean): ClassMethod;
export function objectPattern(properties: Array<RestElement | ObjectProperty>): ObjectPattern; export function objectPattern(properties: Array<RestElement | ObjectProperty>): ObjectPattern;
export function spreadElement(argument: Expression): SpreadElement; export function spreadElement(argument: Expression): SpreadElement;
declare function _super(): Super; declare function _super(): Super;
...@@ -1848,10 +1848,10 @@ export function bigIntLiteral(value: string): BigIntLiteral; ...@@ -1848,10 +1848,10 @@ export function bigIntLiteral(value: string): BigIntLiteral;
export function exportNamespaceSpecifier(exported: Identifier): ExportNamespaceSpecifier; export function exportNamespaceSpecifier(exported: Identifier): ExportNamespaceSpecifier;
export function optionalMemberExpression(object: Expression, property: Expression | Identifier, computed: boolean | undefined, optional: boolean): OptionalMemberExpression; export function optionalMemberExpression(object: Expression, property: Expression | Identifier, computed: boolean | undefined, optional: boolean): OptionalMemberExpression;
export function optionalCallExpression(callee: Expression, _arguments: Array<Expression | SpreadElement | JSXNamespacedName | ArgumentPlaceholder>, optional: boolean): OptionalCallExpression; export function optionalCallExpression(callee: Expression, _arguments: Array<Expression | SpreadElement | JSXNamespacedName | ArgumentPlaceholder>, optional: boolean): OptionalCallExpression;
export function classProperty(key: Identifier | StringLiteral | NumericLiteral | Expression, value?: Expression | null, typeAnnotation?: TypeAnnotation | TSTypeAnnotation | Noop | null, decorators?: Array<Decorator> | null, computed?: boolean, _static?: boolean): ClassProperty; export function classProperty(key: Identifier | StringLiteral | NumericLiteral | BigIntLiteral | Expression, value?: Expression | null, typeAnnotation?: TypeAnnotation | TSTypeAnnotation | Noop | null, decorators?: Array<Decorator> | null, computed?: boolean, _static?: boolean): ClassProperty;
export function classAccessorProperty(key: Identifier | StringLiteral | NumericLiteral | Expression | PrivateName, value?: Expression | null, typeAnnotation?: TypeAnnotation | TSTypeAnnotation | Noop | null, decorators?: Array<Decorator> | null, computed?: boolean, _static?: boolean): ClassAccessorProperty; export function classAccessorProperty(key: Identifier | StringLiteral | NumericLiteral | BigIntLiteral | Expression | PrivateName, value?: Expression | null, typeAnnotation?: TypeAnnotation | TSTypeAnnotation | Noop | null, decorators?: Array<Decorator> | null, computed?: boolean, _static?: boolean): ClassAccessorProperty;
export function classPrivateProperty(key: PrivateName, value: Expression | null | undefined, decorators: Array<Decorator> | null | undefined, _static: any): ClassPrivateProperty; export function classPrivateProperty(key: PrivateName, value?: Expression | null, decorators?: Array<Decorator> | null, _static?: boolean): ClassPrivateProperty;
export function classPrivateMethod(kind: "get" | "set" | "method" | "constructor" | undefined, key: PrivateName, params: Array<Identifier | Pattern | RestElement | TSParameterProperty>, body: BlockStatement, _static?: boolean): ClassPrivateMethod; export function classPrivateMethod(kind: "get" | "set" | "method" | undefined, key: PrivateName, params: Array<Identifier | Pattern | RestElement | TSParameterProperty>, body: BlockStatement, _static?: boolean): ClassPrivateMethod;
export function privateName(id: Identifier): PrivateName; export function privateName(id: Identifier): PrivateName;
export function staticBlock(body: Array<Statement>): StaticBlock; export function staticBlock(body: Array<Statement>): StaticBlock;
export function anyTypeAnnotation(): AnyTypeAnnotation; export function anyTypeAnnotation(): AnyTypeAnnotation;
...@@ -1953,7 +1953,7 @@ export function pipelineBareFunction(callee: Expression): PipelineBareFunction; ...@@ -1953,7 +1953,7 @@ export function pipelineBareFunction(callee: Expression): PipelineBareFunction;
export function pipelinePrimaryTopicReference(): PipelinePrimaryTopicReference; export function pipelinePrimaryTopicReference(): PipelinePrimaryTopicReference;
export function tsParameterProperty(parameter: Identifier | AssignmentPattern): TSParameterProperty; export function tsParameterProperty(parameter: Identifier | AssignmentPattern): TSParameterProperty;
export function tsDeclareFunction(id: Identifier | null | undefined, typeParameters: TSTypeParameterDeclaration | Noop | null | undefined, params: Array<Identifier | Pattern | RestElement>, returnType?: TSTypeAnnotation | Noop | null): TSDeclareFunction; export function tsDeclareFunction(id: Identifier | null | undefined, typeParameters: TSTypeParameterDeclaration | Noop | null | undefined, params: Array<Identifier | Pattern | RestElement>, returnType?: TSTypeAnnotation | Noop | null): TSDeclareFunction;
export function tsDeclareMethod(decorators: Array<Decorator> | null | undefined, key: Identifier | StringLiteral | NumericLiteral | Expression, typeParameters: TSTypeParameterDeclaration | Noop | null | undefined, params: Array<Identifier | Pattern | RestElement | TSParameterProperty>, returnType?: TSTypeAnnotation | Noop | null): TSDeclareMethod; export function tsDeclareMethod(decorators: Array<Decorator> | null | undefined, key: Identifier | StringLiteral | NumericLiteral | BigIntLiteral | Expression, typeParameters: TSTypeParameterDeclaration | Noop | null | undefined, params: Array<Identifier | Pattern | RestElement | TSParameterProperty>, returnType?: TSTypeAnnotation | Noop | null): TSDeclareMethod;
export function tsQualifiedName(left: TSEntityName, right: Identifier): TSQualifiedName; export function tsQualifiedName(left: TSEntityName, right: Identifier): TSQualifiedName;
export function tsCallSignatureDeclaration(typeParameters: TSTypeParameterDeclaration | null | undefined, parameters: Array<Identifier | RestElement>, typeAnnotation?: TSTypeAnnotation | null): TSCallSignatureDeclaration; export function tsCallSignatureDeclaration(typeParameters: TSTypeParameterDeclaration | null | undefined, parameters: Array<Identifier | RestElement>, typeAnnotation?: TSTypeAnnotation | null): TSCallSignatureDeclaration;
export function tsConstructSignatureDeclaration(typeParameters: TSTypeParameterDeclaration | null | undefined, parameters: Array<Identifier | RestElement>, typeAnnotation?: TSTypeAnnotation | null): TSConstructSignatureDeclaration; export function tsConstructSignatureDeclaration(typeParameters: TSTypeParameterDeclaration | null | undefined, parameters: Array<Identifier | RestElement>, typeAnnotation?: TSTypeAnnotation | null): TSConstructSignatureDeclaration;
......
This diff is collapsed.
This diff is collapsed.
...@@ -12,8 +12,8 @@ function getQualifiedName(node) { ...@@ -12,8 +12,8 @@ function getQualifiedName(node) {
} }
function removeTypeDuplicates(nodes) { function removeTypeDuplicates(nodes) {
const generics = {}; const generics = new Map();
const bases = {}; const bases = new Map();
const typeGroups = new Set(); const typeGroups = new Set();
const types = []; const types = [];
...@@ -30,7 +30,7 @@ function removeTypeDuplicates(nodes) { ...@@ -30,7 +30,7 @@ function removeTypeDuplicates(nodes) {
} }
if ((0, _generated.isFlowBaseAnnotation)(node)) { if ((0, _generated.isFlowBaseAnnotation)(node)) {
bases[node.type] = node; bases.set(node.type, node);
continue; continue;
} }
...@@ -46,8 +46,8 @@ function removeTypeDuplicates(nodes) { ...@@ -46,8 +46,8 @@ function removeTypeDuplicates(nodes) {
if ((0, _generated.isGenericTypeAnnotation)(node)) { if ((0, _generated.isGenericTypeAnnotation)(node)) {
const name = getQualifiedName(node.id); const name = getQualifiedName(node.id);
if (generics[name]) { if (generics.has(name)) {
let existing = generics[name]; let existing = generics.get(name);
if (existing.typeParameters) { if (existing.typeParameters) {
if (node.typeParameters) { if (node.typeParameters) {
...@@ -57,7 +57,7 @@ function removeTypeDuplicates(nodes) { ...@@ -57,7 +57,7 @@ function removeTypeDuplicates(nodes) {
existing = node.typeParameters; existing = node.typeParameters;
} }
} else { } else {
generics[name] = node; generics.set(name, node);
} }
continue; continue;
...@@ -66,12 +66,12 @@ function removeTypeDuplicates(nodes) { ...@@ -66,12 +66,12 @@ function removeTypeDuplicates(nodes) {
types.push(node); types.push(node);
} }
for (const type of Object.keys(bases)) { for (const [, baseType] of bases) {
types.push(bases[type]); types.push(baseType);
} }
for (const name of Object.keys(generics)) { for (const [, genericName] of generics) {
types.push(generics[name]); types.push(genericName);
} }
return types; return types;
......
{ {
"name": "@babel/types", "name": "@babel/types",
"version": "7.18.7", "version": "7.18.8",
"description": "Babel Types is a Lodash-esque utility library for AST nodes", "description": "Babel Types is a Lodash-esque utility library for AST nodes",
"author": "The Babel Team (https://babel.dev/team)", "author": "The Babel Team (https://babel.dev/team)",
"homepage": "https://babel.dev/docs/en/next/babel-types", "homepage": "https://babel.dev/docs/en/next/babel-types",
...@@ -29,7 +29,7 @@ ...@@ -29,7 +29,7 @@
}, },
"devDependencies": { "devDependencies": {
"@babel/generator": "^7.18.7", "@babel/generator": "^7.18.7",
"@babel/parser": "^7.18.6", "@babel/parser": "^7.18.8",
"chalk": "^4.1.0", "chalk": "^4.1.0",
"glob": "^7.1.7" "glob": "^7.1.7"
}, },
......
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment