dart - Dart2js brackets Symbol in metadata annotation -


i can run code on dart vm:

@mirrorsused(metatargets: tag) import 'dart:mirrors';  class tag {   final symbol name;   const tag(this.name); } @proxy @tag(#[]) class tagged {   nosuchmethod(invocation invocation) {     instancemirror instancemirror = reflect(this);     classmirror classmirror = instancemirror.type;     classmirror.metadata.foreach((em) {       if (em.reflectee tag && em.reflectee.name == invocation.membername)          print(invocation.positionalarguments);     });   } } void main() {   var tagged = new tagged();   tagged[42];   tagged.foo();   tagged["dart"]; } 

output:

[42]
[dart]

but when try compile dart2js fails error:

[error dart2js]:
bin\dart2jswithbracketanotation.dart:9:7:
expected identifier, got '['.
@tag(#[])

so 1 has bug?:

  1. (dart vm) because can run @ all.
  2. (dart2js) because doesn't compile js.

update: i reported bug

i think it's bug in dart2js because operator should allowed @ position.


Comments

Popular posts from this blog

database - VFP Grid + SQL server 2008 - grid not showing correctly -

jquery - Set jPicker field to empty value -

.htaccess - htaccess convert request to clean url and add slash at the end of the url -