Skip to content
This repository was archived by the owner on Feb 26, 2024. It is now read-only.
This repository was archived by the owner on Feb 26, 2024. It is now read-only.

shorthand assignment desugaring #47

@dariajung

Description

@dariajung

A shorthand assignment is when an object literal is created without explicitly writing the property name using the name: expression syntax.

An example:

var title = "hello world";
var author = "Foo Bar";
var obj = { title, author }; 

is the same as writing

var obj = {title: title, author: author};

We would like to desugar this ourselves when we are in the visit step. If we see a node with SyntaxKind.ShorthandPropertyAssignment, rewrite the identifier like so, and check if the name of the property can be renamed.

property_name_identifier: expression_being_assigned

Difficulty: Between easy and medium

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