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

Different behavior between VM an dart2js version / Uncaught exception in js_helper #21

Open
MikeMitterer opened this issue Feb 8, 2016 · 2 comments

Comments

@MikeMitterer
Copy link
Contributor

Just want to let you know there is a problem between the VM and the dart2js version.

abstract class Name {
    String get firstName;
}

// Fails if compiled to JS - it works with "extends"!!!!!!
class NameImpl implements Name {

  @override
  String get firstName => "Mike";
}

class ExampleModule extends dice.Module {
    configure() {
        register(Name).toInstance(new NameImpl());

    }
}

main() async {
    final dice.Injector injector = new dice.Injector(new ExampleModule());
    final Name name = injector.getInstance(Name);

   print(name.firstName);
}

More infos here: dart-lang/sdk#25715 (comment)

@MikeMitterer
Copy link
Contributor Author

This should also work but fails in dart2js

abstract class Name {
    String get firstName;
}

class NameImpl extends Name {

  @override
  String get firstName => "Mike";
}

class ExampleModule extends dice.Module {
    configure() {
        //register(Name).toInstance(new NameImpl());

        // concrete implementation!
        register(NameImpl);

    }
}

main() async {
    final dice.Injector injector = new dice.Injector(new ExampleModule());
    final Name name = injector.getInstance(NameImpl);

    print(name.firstName);
}

@ltackmann
Copy link
Owner

Will look into this ASAP

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants