From 420fbcb45dac88c1606f860ff8bb955d1cded159 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Hu=C3=A1ng=20J=C3=B9nli=C3=A0ng?= Date: Mon, 27 Apr 2020 14:40:26 -0400 Subject: [PATCH 1/3] docs: update AST spec --- packages/babel-parser/ast/spec.md | 27 +++++++++++++++++++-------- 1 file changed, 19 insertions(+), 8 deletions(-) diff --git a/packages/babel-parser/ast/spec.md b/packages/babel-parser/ast/spec.md index 6805e3121baa..7a86bdd58812 100644 --- a/packages/babel-parser/ast/spec.md +++ b/packages/babel-parser/ast/spec.md @@ -10,6 +10,7 @@ These are the core @babel/parser (babylon) AST node types. - [StringLiteral](#stringliteral) - [BooleanLiteral](#booleanliteral) - [NumericLiteral](#numericliteral) + - [BigIntLiteral](#bigintliteral) - [Programs](#programs) - [Functions](#functions) - [Statements](#statements) @@ -240,6 +241,17 @@ interface NumericLiteral <: Literal { } ``` +## BigIntLiteral + +```js +interface BigIntLiteral <: Literal { + type: "BigIntLiteral"; + value: string; +} +``` + +The `value` property is the string representation of the `BigInt` value. It doesn't include the suffix `n`. + # Programs ```js @@ -450,7 +462,7 @@ A `try` statement. If `handler` is `null` then `finalizer` must be a `BlockState ```js interface CatchClause <: Node { type: "CatchClause"; - param: Pattern | null; + param?: Pattern; body: BlockStatement; } ``` @@ -839,7 +851,7 @@ interface AssignmentExpression <: Expression { } ``` -An assignment operator expression. +An assignment operator expression. It has short-circuiting behaviour if the `operator` is one of `"||="`, `"&&="`, and `"??="`. #### AssignmentOperator @@ -848,6 +860,7 @@ enum AssignmentOperator { "=" | "+=" | "-=" | "*=" | "/=" | "%=" | "**=" | "<<=" | ">>=" | ">>>=" | "|=" | "^=" | "&=" + | "||=" | "&&=" | "??=" } ``` @@ -901,11 +914,10 @@ interface MemberExpression <: Expression, Pattern { object: Expression | Super; property: Expression; computed: boolean; - optional: boolean | null; } ``` -A member expression. If `computed` is `true`, the node corresponds to a computed (`a[b]`) member expression and `property` is an `Expression`. If `computed` is `false`, the node corresponds to a static (`a.b`) member expression and `property` is an `Identifier`. The `optional` flags indicates that the member expression can be called even if the object is null or undefined. If this is the object value (null/undefined) should be returned. +A member expression. If `computed` is `true`, the node corresponds to a computed (`a[b]`) member expression and `property` is an `Expression`. If `computed` is `false`, the node corresponds to a static (`a.b`) member expression and `property` is an `Identifier` or a `PrivateName`. ### BindExpression @@ -987,18 +999,16 @@ interface CallExpression <: Expression { type: "CallExpression"; callee: Expression | Super | Import; arguments: [ Expression | SpreadElement ]; - optional: boolean | null; } ``` -A function or method call expression. +A function or method call expression. When the `callee` is `Import`, the `arguments` must have only one `Expression` element. ## NewExpression ```js interface NewExpression <: CallExpression { type: "NewExpression"; - optional: boolean | null; } ``` @@ -1024,7 +1034,7 @@ interface ParenthesizedExpression <: Expression { } ``` -An expression wrapped by parentheses. +An expression wrapped by parentheses. By default `@babel/parser` does not create this node, unless passed by the `createParenthesizedExpressions: true` option. ## DoExpression @@ -1316,6 +1326,7 @@ _Note: Having `declaration` populated with non-empty `specifiers` or non-null `s interface ExportSpecifier <: ModuleSpecifier { type: "ExportSpecifier"; exported: Identifier; + local?: Identifier; } ``` From 951e8e60301c8d813b8c811f397ed6e340f04891 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Hu=C3=A1ng=20J=C3=B9nli=C3=A0ng?= Date: Mon, 27 Apr 2020 17:05:06 -0400 Subject: [PATCH 2/3] Update packages/babel-parser/ast/spec.md Co-Authored-By: Brian Ng --- packages/babel-parser/ast/spec.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/packages/babel-parser/ast/spec.md b/packages/babel-parser/ast/spec.md index 7a86bdd58812..8e619674a562 100644 --- a/packages/babel-parser/ast/spec.md +++ b/packages/babel-parser/ast/spec.md @@ -1034,7 +1034,7 @@ interface ParenthesizedExpression <: Expression { } ``` -An expression wrapped by parentheses. By default `@babel/parser` does not create this node, unless passed by the `createParenthesizedExpressions: true` option. +An expression wrapped by parentheses. By default `@babel/parser` does not create this node, unless the `createParenthesizedExpressions: true` option is passed. ## DoExpression From 20d0c89216c31f6c2e8a4b77eea169cfec29a59b Mon Sep 17 00:00:00 2001 From: Henry Zhu Date: Tue, 28 Apr 2020 12:29:34 -0400 Subject: [PATCH 3/3] update codesandbox templates [skip ci] --- .codesandbox/ci.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.codesandbox/ci.json b/.codesandbox/ci.json index bd884c923e1d..a349bd52660c 100644 --- a/.codesandbox/ci.json +++ b/.codesandbox/ci.json @@ -1,6 +1,6 @@ { "installCommand": "codesandbox", "buildCommand": false, - "sandboxes": ["9d0wg"], + "sandboxes": ["9d0wg", "7s08o"], "packages": ["packages/*"] }