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 is confused with factory constructor #18257

Closed
DartBot opened this issue Apr 16, 2014 · 4 comments
Closed

dart2js is confused with factory constructor #18257

DartBot opened this issue Apr 16, 2014 · 4 comments

Comments

@DartBot
Copy link

DartBot commented Apr 16, 2014

This issue was originally filed by xavier.ha...@gmail.com


What steps will reproduce the problem?
main() {
  A a = new A.a1();
  a.test();
}

class A {
  final bool condition;
  
  A({this.condition: true});
  
  factory A.a1({condition}) = _A1;
  
  test() {
    if(condition == true) {
      print('ok');
    } else {
      print('not ok but $condition');
    }
  }
}

class _A1 extends A {
  _A1({condition: true}):
      super(condition: condition);
}

What is the expected output? What do you see instead?
When compiled to javascript it prints "not ok but true" while it should print "ok" like in Dartium.

What version of the product are you using? On what operating system?
Editor: 1.3.0.release (2014-04-08)
OS: Windows 8 - amd64 (6.2)

Please provide any additional information below.
For some reason, dart2js output the main as:
  main: function() {
    P.print("not ok but true");
  }

@johnniwinther
Copy link
Member

Set owner to @johnniwinther.
Removed Priority-Unassigned label.
Added Priority-Medium, Area-Dart2JS, Accepted labels.

@johnniwinther
Copy link
Member

Added Started label.

@ghost
Copy link

ghost commented Aug 29, 2014

Proposed fix at https://codereview.chromium.org/519693002/.


cc @johnniwinther.
Set owner to @herhut-ggl.

@ghost
Copy link

ghost commented Sep 9, 2014

This has been fixed in r39794.


Added Fixed label.

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

No branches or pull requests

2 participants