Navigation Menu

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

Use dart2js --enable-enum when "Enable Enums" preference is selected #21823

Closed
kwalrath opened this issue Dec 8, 2014 · 10 comments
Closed

Use dart2js --enable-enum when "Enable Enums" preference is selected #21823

kwalrath opened this issue Dec 8, 2014 · 10 comments
Assignees
Labels
closed-obsolete Closed as the reported issue is no longer relevant
Milestone

Comments

@kwalrath
Copy link
Contributor

kwalrath commented Dec 8, 2014

If you're using enums in your web app, then obviously you want to use the --enable-enum option when compiling to JavaScript.

Hopefully that's an easy fix. In the meantime, what's the workaround?

(I couldn't figure out how to specify dart2js options from the Manage Launches dialog. I deleted all my launches and launched the app from the index.html file. When I opened Run > Manage Launches again, I didn't see any command-line options—just HTML/URL paths you could specify.)

@clayberg
Copy link

clayberg commented Dec 9, 2014

cc @danrubel.
Set owner to @keertip.
Removed Priority-Unassigned label.
Added Priority-Medium label.

@DartBot
Copy link

DartBot commented Dec 9, 2014

This comment was originally written by @zoechi


As far as I know this can only be set using the transformers section in pubspec.yaml like

transformers:

  • $dart2js:
        commandLineOptions: [--enable-enums]

but is this really necessary?
I thought this is only for the analyzer.

@kwalrath
Copy link
Contributor Author

kwalrath commented Dec 9, 2014

It's very much needed. Thanks for the magic code! I'd forgotten about being able to configure dart2js options in pub. Here's what I used:

transformers:

  • $dart2js:
        commandLineOptions: [--enable-enum]
  • another_transformer

(It's --enable-enum, singular, btw.)

When I don't use the command-line option, I get this error message:

web/main.dart:10:1:
Build completed with 1 errors.Experimental language feature 'enums' is not supported.

[web] GET /main.dart.js => Could not find asset web_async_enum|web/main.dart.js.Use option '--enable-enum' to use enum declarations.

enum Color {
^^^^^^^^^^^^^

@DartBot
Copy link

DartBot commented Dec 9, 2014

This comment was originally written by @zoechi


As far as I know the $dart2js transformer needs to be the last transformer. There should be an open issue to cope with this more gracefully if it is not the case but I couldn't find the issue.

@kwalrath
Copy link
Contributor Author

kwalrath commented Dec 9, 2014

Oh, strange. Thanks for that intel, gzoechi. I originally had it last, but Dart Editor complained until I moved it first. (DE was probably just having a bad moment; it seems to be working now that I move it to last place. I'll follow up with the pub engineers about this.)

@kwalrath
Copy link
Contributor Author

kwalrath commented Dec 9, 2014

It looks like the order doesn't matter any more: https://code.google.com/p/dart/source/detail?r=42072

@sethladd
Copy link
Contributor

We expect dart2js to default to enabling enums https://code.google.com/p/dart/issues/detail?id=21885 so perhaps we can close this?

@dgrove
Copy link
Contributor

dgrove commented Jan 16, 2015

dart2js already accepts enums by default. This can be closed now.

@clayberg
Copy link

Added AssumedStale label.

@clayberg
Copy link

Added this to the 1.9 milestone.

@kwalrath kwalrath added Type-Defect closed-obsolete Closed as the reported issue is no longer relevant labels Mar 25, 2015
@kwalrath kwalrath added this to the 1.9 milestone Mar 25, 2015
This issue was closed.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
closed-obsolete Closed as the reported issue is no longer relevant
Projects
None yet
Development

No branches or pull requests

6 participants