Skip to content

Poor constant propagation through destructuring assignments #4219

@KimlikDAO-bot

Description

@KimlikDAO-bot

Google closure struggles with constant propagation through destructing assignments, which, unfortunately happens very frequently in modern js code.

const { A: a, B: b } = { A: 1, B: 2 }
console.log(a, b);

google-closure-compiler --js a.js -O ADVANCED outputs

const {g:a,h:b}={g:1,h:2};console.log(a,b);

Many function call happen through "object pattern" parameters in modern js and google closure does no constant propagation through them nor does it have "re-write to normal params" kind of pass.

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