From 347a7138dd58e55e11ca262894775f0e39d2a398 Mon Sep 17 00:00:00 2001 From: Adrian Heine Date: Mon, 13 Nov 2017 10:22:44 +0100 Subject: [PATCH] Add OptId{Class,Function}Declaration for ExportDefaultDeclaration Closes #98. This implementation was initially suggested by Sebastian McKenzie. --- es2015.md | 19 ++++++++++++++++++- 1 file changed, 18 insertions(+), 1 deletion(-) diff --git a/es2015.md b/es2015.md index 6d48743..969070a 100644 --- a/es2015.md +++ b/es2015.md @@ -4,6 +4,7 @@ This document specifies the extensions to the [core ESTree AST types](es5.md) to - [Programs](#programs) - [Functions](#functions) + - [OptIdFunctionDeclaration](#optidfunctiondeclaration) - [Statements](#statements) - [ForOfStatement](#forofstatement) - [Declarations](#declarations) @@ -26,6 +27,7 @@ This document specifies the extensions to the [core ESTree AST types](es5.md) to - [ClassDeclaration](#classdeclaration) - [ClassExpression](#classexpression) - [MetaProperty](#metaproperty) + - [OptIdClassDeclaration](#optidclassdeclaration) - [Modules](#modules) - [ModuleDeclaration](#moduledeclaration) - [ModuleSpecifier](#modulespecifier) @@ -61,6 +63,13 @@ extend interface Function { } ``` +## OptIdFunctionDeclaration + +```js +interface OptIdFunctionDeclaration <: FunctionDeclaration { + id: Identifier | null; +} + # Statements ## ForOfStatement @@ -299,6 +308,14 @@ interface MetaProperty <: Expression { } ``` +## OptIdClassDeclaration + +```js +interface OptIdClassDeclaration <: ClassDeclaration { + id: Identifier | null; +} +``` + # Modules ## ModuleDeclaration @@ -397,7 +414,7 @@ An exported variable binding, e.g., `{foo}` in `export {foo}` or `{bar as foo}` ```js interface ExportDefaultDeclaration <: ModuleDeclaration { type: "ExportDefaultDeclaration"; - declaration: Declaration | Expression; + declaration: OptIdFunctionDeclaration | OptIdClassDeclaration | Expression; } ```