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
Many constructors can be generated dynamically #8827
Comments
I don't think the the assignment version works - it is missing the 'new'. The compiler should probably inline trivial constructors like this unless there are so many calls (> 10) that the short-hand of the constructor function is a valuable contraction. |
Yes, the assignment version won't work. Also, |
Added this to the Later milestone. |
Added TriageForM5 label. |
Removed TriageForM5 label. |
Removed this from the Later milestone. |
Removed Oldschool-Milestone-Later label. |
Verified fixed in 79a8654. |
Given this class:
class Point {
var x;
var y;
Point(this.x, this.y);
operator +(Point other) {
return new Point(x + other.x, y + other.y);
}
String toString() => "($x, $y)";
}
dart2js will generate:
$$.Point = {"": "Object;x>,y>",$.S(this.x) + ", " + $ .S(this.y) + ")";
$.Point$ = function(x, y) {
toString$0: function() {
return "(" +
}
};
return new $.Point(x, y);
};
The latter is the constructor, and it can be generated dynamically, or even:
The text was updated successfully, but these errors were encountered: