Skip to content

traverse: port scope.push API from Babel #5049

@Dunqing

Description

@Dunqing

Babel's implementation is here

Why need this API?

We need to combine the variable declarators required by different plugins to be inserted at the top of the statements.

Related tests:

  • logical-assignment/null-coalescing/input.js
-var _obj$x, _obj$x2, _deep$obj, _deep$obj$x, _deep$obj2, _deep$obj2$x, _key, _obj$_key, _key2, _obj$_key2, _deep$obj3, _key3, _deep$obj3$_key, _deep$obj4, _key4, _deep$obj4$_key;
+var _obj$x, _obj$x2, _deep$obj$x, _deep$obj2$x, _obj$_key, _obj$_key2, _deep$obj3$_key, _deep$obj4$_key;
+var _deep$obj, _deep$obj2, _key, _key2, _deep$obj3, _key3, _deep$obj4, _key4;

Metadata

Metadata

Assignees

Labels

A-transformerArea - Transformer / TranspilerC-enhancementCategory - New feature or request

Type

No type

Projects

No projects

Relationships

None yet

Development

No branches or pull requests

Issue actions