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

Method is not compiled properly by dart2js without the checked option #18717

Closed
DartBot opened this issue May 8, 2014 · 8 comments
Closed

Method is not compiled properly by dart2js without the checked option #18717

DartBot opened this issue May 8, 2014 · 8 comments
Labels
P1 A high priority bug; for example, a single project is unusable or has many test failures web-dart2js

Comments

@DartBot
Copy link

DartBot commented May 8, 2014

This issue was originally filed by ni...@blossom.io


If this is too little information please close it. Sadly I don't have reproducible example for you guys. It only happens in our main application.

Dart Editor version 1.3.6.release (STABLE)
Dart SDK version 1.3.6

In our case dart2js didn't compile a class method properly. It only didn't work for two classes, but worked for many other ones which are similar. All these classes are part of one Dart library.

As you can see in the code example the part where fullName and projectId is added to output is missing.

shell command


dart2js --out=dart/application/web/out/index.html_bootstrap.dart.js dart/application/web/out/index.html_bootstrap.dart

dart code


    core.Map toJson() {
      var output = new core.Map();
      if (fullName != null) {
        output["fullName"] = fullName;
      }
      if (projectId != null) {
        output["projectId"] = projectId;
      }
      return output;
    }

js code


    ApiMessagesGithubRepositoryConnectionCreateMessage: {
      "^": "Object;fullName<-,projectId-",
      toJson$0: [function() {
        var output = P.LinkedHashMap_LinkedHashMap(null, null, null, null, null);
        return output;
      }, "call$0", "get$toJson", 0, 0, 734, "toJson"],

When I compile it with the option --checked the output is fine and it works.

@floitschG
Copy link
Contributor

The most likely reason is that the type-inference concluded that fullName and projectId must be null.
You should be able to test this by replacing if (fullName != null) with if (fullName == null). If my suspicion is correct it should remove the if and unconditionally execute the body.

@stephan: do you recognize this bug? Do you have a good way to figure out what went wrong?


cc @herhut-ggl.
Added Area-Dart2JS, Triaged labels.

@ghost
Copy link

ghost commented May 13, 2014

I also think that probably the inference for fullName or projectId is the culprit here.

@nik: Can you share the code or at least the portion that shows how fullName and projectId are declared and defined? From the generated JS, it seems that both are fields but neither of them has a setter.

@kasperl
Copy link

kasperl commented Jun 10, 2014

Nik, do you have any new information? We've gotten another report that might be related to this one (issue #18836).


Set owner to @herhut-ggl.
Removed Priority-Unassigned label.
Added Priority-High label.

@kasperl
Copy link

kasperl commented Jun 12, 2014

This may have been fixed in r37254. Is there any way you can try to verify if the problem has gone away, Nik?

http://gsdview.appspot.com/dart-archive/channels/be/raw/37255/


Added Started label.

@kasperl
Copy link

kasperl commented Jun 13, 2014

The possible fix has shipped to the dev channel in version 1.5.0-dev.4.11. Marking this as fixed -- but if you could verify that the problem is gone, Nik, that would be fantastic.


Added Fixed label.

@DartBot
Copy link
Author

DartBot commented Jun 13, 2014

This comment was originally written by ni...@blossom.io


Thanks a lot guys. I will try to confirm it in the next couple days.

@kasperl
Copy link

kasperl commented Jun 17, 2014

The fix is now also available on the stable channel in version 1.4.3.

@DartBot
Copy link
Author

DartBot commented Jun 18, 2014

This comment was originally written by ni...@blossom.io


Looks good. Thank you very much guys. Good job.

  "+ ApiMessagesGithubRepositoriesSimpleMessage_toJson_closure": 0,
  ApiMessagesGithubRepositoryConnectionCreateMessage: {
    "^": "Object;fullName<-,projectId-",
    toJson$0: [function() {
      var output, t1;
      output = P.LinkedHashMap_LinkedHashMap(null, null, null, null, null);
      t1 = this.fullName;
      if (t1 != null)
        output.$indexSet(0, "fullName", t1);
      t1 = this.projectId;
      if (t1 != null)
        output.$indexSet(0, "projectId", t1);
      return output;
    }, "call$0", "get$toJson", 0, 0, 697, "toJson"],
    toString$0: [function(_) {

This issue was closed.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
P1 A high priority bug; for example, a single project is unusable or has many test failures web-dart2js
Projects
None yet
Development

No branches or pull requests

3 participants