Skip to content

Commit

Permalink
Make FunctionBody/Expression variants of arrow expressions. Closes #43.
Browse files Browse the repository at this point in the history
  • Loading branch information
syg committed Jun 22, 2018
1 parent 79d9ddd commit 9aa4feb
Showing 1 changed file with 29 additions and 12 deletions.
41 changes: 29 additions & 12 deletions spec.html
Original file line number Diff line number Diff line change
Expand Up @@ -247,8 +247,10 @@ <h1>Tree Grammar</h1>

typedef (EagerSetter or LazySetter) Setter;

typedef (EagerArrowExpression or
LazyArrowExpression) ArrowExpression;
typedef (EagerArrowExpressionWithFunctionBody or
LazyArrowExpressionWithFunctionBody or
EagerArrowExpressionWithExpression or
LazyArrowExpressionWithExpression) ArrowExpression;

// bindings

Expand Down Expand Up @@ -587,26 +589,41 @@ <h1>Tree Grammar</h1>

// `ArrowFunction`,
// `AsyncArrowFunction`
interface EagerArrowExpression : Node {
interface EagerArrowExpressionWithFunctionBody : Node {
// True for `AsyncArrowFunction`, false otherwise.
attribute boolean isAsync;
// Null if and only if the body is an Expression.
attribute FrozenArray&lt;Directive&gt;? directives;
attribute ArrowExpressionContents contents;
attribute FrozenArray&lt;Directive&gt; directives;
attribute ArrowExpressionContentsWithFunctionBody contents;
};
interface LazyArrowExpressionWithFunctionBody : Node {
// True for `AsyncArrowFunction`, false otherwise.
attribute boolean isAsync;
attribute FrozenArray&lt;Directive&gt; directives;
[Lazy] attribute ArrowExpressionContentsWithFunctionBody contents;
};
interface EagerArrowExpressionWithExpression : Node {
// True for `AsyncArrowFunction`, false otherwise.
attribute boolean isAsync;
attribute ArrowExpressionContentsWithExpression contents;
};
interface LazyArrowExpression : Node {
interface LazyArrowExpressionWithExpression : Node {
// True for `AsyncArrowFunction`, false otherwise.
attribute boolean isAsync;
// Null if and only if the body is an Expression.
attribute FrozenArray&lt;Directive&gt;? directives;
[Lazy] attribute ArrowExpressionContents contents;
[Lazy] attribute ArrowExpressionContentsWithExpression contents;
};

interface ArrowExpressionContentsWithFunctionBody : Node {
attribute AssertedParameterScope parameterScope;
attribute FormalParameters params;
attribute AssertedVarScope bodyScope;
attribute FunctionBody body;
};

interface ArrowExpressionContents : Node {
interface ArrowExpressionContentsWithExpression : Node {
attribute AssertedParameterScope parameterScope;
attribute FormalParameters params;
attribute AssertedVarScope bodyScope;
attribute (FunctionBody or Expression) body;
attribute Expression body;
};

// `AssignmentExpression :: LeftHandSideExpression = AssignmentExpression`
Expand Down

0 comments on commit 9aa4feb

Please sign in to comment.