diff --git a/es2020.md b/es2020.md new file mode 100644 index 0000000..8cefd9e --- /dev/null +++ b/es2020.md @@ -0,0 +1,43 @@ +This document specifies the extensions to the core ESTree AST types to support the ES2020 grammar. + +# Literal + +```js +extend interface Literal <: Expression { + type: "Literal"; + value: string | boolean | null | number | RegExp | bigint; +} +``` + +- `value` property can be a `BigInt` value to represent `BigInt` literals + such as `100n`. + +## BigIntLiteral + +```js +interface BigIntLiteral <: Literal { + bigint: string; +} +``` + +- `bigint` property is the string representation of the `BigInt` value. + It doesn't include the suffix `n`. +- In environments that don't support `BigInt` values, `value` property will be + `null` as the `BigInt` value can't be represented natively. + +# Expressions + +## ImportExpression + +```js +interface ImportExpression <: Expression { + type: "ImportExpression"; + source: Expression; +} +``` + +- `ImportExpression` node represents Dynamic Imports such as `import(source)`. + The `source` property is the importing source as similar to [ImportExpression] + node, but it can be an arbitrary expression node. + +[ImportExpression]: es2015.md#importdeclaration diff --git a/experimental/import-expression.md b/experimental/import-expression.md deleted file mode 100644 index 2d5122d..0000000 --- a/experimental/import-expression.md +++ /dev/null @@ -1,13 +0,0 @@ -# [Dynamic Import Expression](https://github.com/domenic/proposal-dynamic-import) - -## Import - -```js -interface Import <: Node { - type: "Import"; -} - -interface CallExpression <: Expression { - callee: Expression | Super | Import; -} -```