Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

dart2js: reduce boilerplate code and (optionally) minify names used in it #16546

Open
kasperl opened this issue Feb 5, 2014 · 1 comment
Open
Labels
area-web Use area-web for Dart web related issues, including the DDC and dart2js compilers and JS interop. P2 A bug or feature request we're likely to work on type-bug Incorrect behavior (everything from a crash to more subtle misbehavior) web-dart2js

Comments

@kasperl
Copy link

kasperl commented Feb 5, 2014

There's quite a lot of boiler plate generated. Some of it can clearly be avoided.

Furthermore, it would be awesome if we could minify whitespace and names used in the boiler plate code.

@rakudrama
Copy link
Member

The boilerplate is also tricky to generate.
Some code interpolates strings (which makes it difficult to defer naming decisions).
Other places generate minifiable boilerplate via hard to read code that constructs sequences of statements etc.

My rough idea for this is:

  1. Expand parsing JS code to include statements.
  2. Do #-stubstitution in two phases: (a) parse to a template (b) apply template (mostly a tree clone).
  3. Add a named version of #, since positional will get tedious with larger texts.
  4. Convert all (or most) JS construction to use templates.
  5. Allow # in more places to implement property, identifier, string and list interpolation.
  6. Remove legacy API to ensure JS ASTs are immutable and share structure where possible.

@kevmoo kevmoo added P2 A bug or feature request we're likely to work on type-bug Incorrect behavior (everything from a crash to more subtle misbehavior) and removed triaged labels Mar 1, 2016
@vsmenon vsmenon added the area-web Use area-web for Dart web related issues, including the DDC and dart2js compilers and JS interop. label Jul 20, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
area-web Use area-web for Dart web related issues, including the DDC and dart2js compilers and JS interop. P2 A bug or feature request we're likely to work on type-bug Incorrect behavior (everything from a crash to more subtle misbehavior) web-dart2js
Projects
None yet
Development

No branches or pull requests

4 participants