Skip to content
This repository was archived by the owner on Sep 8, 2021. It is now read-only.
This repository was archived by the owner on Sep 8, 2021. It is now read-only.

Different parsing errors between Babel and V8: await as identifier #43

@JLHwung

Description

@JLHwung

Related versions: Babel 7.13.9 V8 9.1.216

await as BindingIdentifier of FunctionDeclaration

C = class { static { function await() {} } };

Babel throws, V8 passes.

According to #27 (comment), a function boundary includes parameters and body. So the binding identifier await should throw here.

await as IdentifierReference in ConciseBody of ArrowFunctionExpression

C = class { static { () => await } };

Babel throws, V8 passes.

C = class { static { () => arguments } }

Babel throws, V8 throws.

In the spec we have same treatment for IdentifierReference when its SV is arguments or await, so they should either both throw or both pass. I am not clear whether function boundary includes an arrow function. But since this already throw

C = class { static p = () => arguments }

I am good to throw for C = class { static { () => arguments } }.

I don't have strong opinion for C = class { static { () => await } };, I tend to forbid it even though we allow C = class { static p = () => await }.

/cc @syg since you implemented static block features.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions