Skip to content

Should we prefer SDOs that handle multiple productions by branching on parse node presence? #3954

Description

@gibson042

The spec currently has separate algorithms for Evaluation of ObjectLiteral : `{` `}` vs. ObjectLiteral : `{` PropertyDefinitionList `,`? `}`:

1. Return OrdinaryObjectCreate(%Object.prototype%).

vs.

1. Let _obj_ be OrdinaryObjectCreate(%Object.prototype%).
1. Perform ? PropertyDefinitionEvaluation of |PropertyDefinitionList| with argument _obj_.
1. Return _obj_.

But as noted at #3938 (comment) , I would prefer to handle them in one:

1. Let _obj_ be OrdinaryObjectCreate(%Object.prototype%).
1. If |PropertyDefinitionList| is present, perform ? PropertyDefinitionEvaluation of |PropertyDefinitionList| with argument _obj_.
1. Return _obj_.

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions