Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(322)

Issue 19754002: Rewrite how we handle synthesized constructors in the compiler. This was motivated by issue https:/… (Closed)

Created:
7 years, 5 months ago by ngeoffray
Modified:
7 years, 4 months ago
Reviewers:
ahe, karlklose
CC:
reviews_dartlang.org
Visibility:
Public.

Description

Rewrite how we handle synthesized constructors in the compiler. This was motivated by issue https://code.google.com/p/dart/issues/detail?id=11822. This change: - Removes the need to create synthesized nodes for the default constructor. - Treats the default constructor and forwarding constructors in mixins uniformaly: they both are synthesized constructors that call a super constructor. - Makes the compiler aware that some elements may not have nodes, and acts accordingly. Before, the default constructor had a synthesized node, so the compiler was happy with it. And the forwarding constructors were handled specially to just skip to a non-synthesized constructor. The latter behavior was the cause of issue 11822, and type inference problems. - Makes the resolver implement what is specified in the specification for forwarding constructors: we create one synthesized constructor per generative constructor of the super class. - Implements forwarding constructor in named (aka typedef) mixin applications. See builder.dart, and mixin_typedef_constructor_test.dart - Implements const classes in the presence of mixins: tests/language/const_constructor_mixin_test.dart. - Fixes type inference in the presence of forwarding constructors: tests/language/inference_mixin_field_test.dart. R=ahe@google.com, karlklose@google.com Committed: https://code.google.com/p/dart/source/detail?r=25148

Patch Set 1 : #

Total comments: 18

Patch Set 2 : #

Patch Set 3 : #

Patch Set 4 : #

Patch Set 5 : #

Unified diffs Side-by-side diffs Delta from patch set Stats (+408 lines, -194 lines) Patch
M sdk/lib/_internal/compiler/implementation/closure.dart View 1 1 chunk +2 lines, -0 lines 0 comments Download
M sdk/lib/_internal/compiler/implementation/compile_time_constants.dart View 1 8 chunks +28 lines, -22 lines 0 comments Download
M sdk/lib/_internal/compiler/implementation/compiler.dart View 1 2 3 1 chunk +3 lines, -3 lines 0 comments Download
M sdk/lib/_internal/compiler/implementation/dart_backend/backend.dart View 1 1 chunk +2 lines, -1 line 0 comments Download
M sdk/lib/_internal/compiler/implementation/deferred_load.dart View 1 1 chunk +1 line, -0 lines 0 comments Download
M sdk/lib/_internal/compiler/implementation/elements/elements.dart View 1 1 chunk +1 line, -5 lines 0 comments Download
M sdk/lib/_internal/compiler/implementation/elements/modelx.dart View 1 2 chunks +15 lines, -54 lines 0 comments Download
M sdk/lib/_internal/compiler/implementation/enqueue.dart View 1 1 chunk +0 lines, -6 lines 0 comments Download
M sdk/lib/_internal/compiler/implementation/js_backend/emitter.dart View 1 1 chunk +1 line, -1 line 0 comments Download
M sdk/lib/_internal/compiler/implementation/resolution/members.dart View 1 2 3 4 5 chunks +33 lines, -18 lines 0 comments Download
M sdk/lib/_internal/compiler/implementation/ssa/builder.dart View 1 13 chunks +68 lines, -67 lines 0 comments Download
M sdk/lib/_internal/compiler/implementation/ssa/codegen.dart View 1 2 3 1 chunk +15 lines, -8 lines 0 comments Download
M sdk/lib/_internal/compiler/implementation/types/simple_types_inferrer.dart View 1 2 chunks +10 lines, -7 lines 0 comments Download
M sdk/lib/_internal/compiler/implementation/universe/universe.dart View 1 2 chunks +74 lines, -1 line 0 comments Download
M tests/compiler/dart2js/mock_compiler.dart View 1 1 chunk +1 line, -0 lines 0 comments Download
A tests/language/const_constructor_mixin_test.dart View 1 chunk +18 lines, -0 lines 0 comments Download
A tests/language/inference_mixin_field_test.dart View 1 chunk +28 lines, -0 lines 0 comments Download
A tests/language/mixin_forwarding_constructor1_test.dart View 1 chunk +31 lines, -0 lines 0 comments Download
A tests/language/mixin_forwarding_constructor2_test.dart View 1 chunk +30 lines, -0 lines 0 comments Download
A tests/language/mixin_typedef_constructor_test.dart View 1 chunk +22 lines, -0 lines 0 comments Download
A tests/language/mixin_with_two_implicit_constructors_test.dart View 1 chunk +22 lines, -0 lines 0 comments Download
M tests/utils/dummy_compiler_test.dart View 1 1 chunk +1 line, -0 lines 0 comments Download
M tests/utils/recursive_import_test.dart View 1 1 chunk +2 lines, -1 line 0 comments Download

Messages

Total messages: 8 (0 generated)
ngeoffray
7 years, 5 months ago (2013-07-18 08:53:17 UTC) #1
ahe
I need to do another pass on this change. Below are my initial comments. What ...
7 years, 5 months ago (2013-07-18 09:59:32 UTC) #2
ahe
LGTM! https://codereview.chromium.org/19754002/diff/2001/sdk/lib/_internal/compiler/implementation/compiler.dart File sdk/lib/_internal/compiler/implementation/compiler.dart (right): https://codereview.chromium.org/19754002/diff/2001/sdk/lib/_internal/compiler/implementation/compiler.dart#newcode1056 sdk/lib/_internal/compiler/implementation/compiler.dart:1056: if (tree != null) validator.validate(tree); assert(invariant(element, !element.isSynthetic || ...
7 years, 5 months ago (2013-07-18 14:32:56 UTC) #3
ngeoffray
Thanks Peter! https://codereview.chromium.org/19754002/diff/2001/sdk/lib/_internal/compiler/implementation/compiler.dart File sdk/lib/_internal/compiler/implementation/compiler.dart (right): https://codereview.chromium.org/19754002/diff/2001/sdk/lib/_internal/compiler/implementation/compiler.dart#newcode1056 sdk/lib/_internal/compiler/implementation/compiler.dart:1056: if (tree != null) validator.validate(tree); On 2013/07/18 ...
7 years, 5 months ago (2013-07-18 15:25:14 UTC) #4
karlklose
LGTM.
7 years, 5 months ago (2013-07-18 15:29:47 UTC) #5
ngeoffray
Committed patchset #5 manually as r25148 (presubmit successful).
7 years, 5 months ago (2013-07-18 15:51:57 UTC) #6
ahe
https://codereview.chromium.org/19754002/diff/2001/sdk/lib/_internal/compiler/implementation/js_backend/emitter.dart File sdk/lib/_internal/compiler/implementation/js_backend/emitter.dart (right): https://codereview.chromium.org/19754002/diff/2001/sdk/lib/_internal/compiler/implementation/js_backend/emitter.dart#newcode3420 sdk/lib/_internal/compiler/implementation/js_backend/emitter.dart:3420: FunctionSignature signature = element.computeSignature(compiler); On 2013/07/18 15:25:14, ngeoffray wrote: ...
7 years, 5 months ago (2013-07-19 09:10:44 UTC) #7
ngeoffray
7 years, 4 months ago (2013-08-15 08:23:19 UTC) #8
Message was sent while issue was closed.
https://codereview.chromium.org/19754002/diff/2001/sdk/lib/_internal/compiler...
File sdk/lib/_internal/compiler/implementation/js_backend/emitter.dart (right):

https://codereview.chromium.org/19754002/diff/2001/sdk/lib/_internal/compiler...
sdk/lib/_internal/compiler/implementation/js_backend/emitter.dart:3420:
FunctionSignature signature = element.computeSignature(compiler);
On 2013/07/19 09:10:44, ahe wrote:
> On 2013/07/18 15:25:14, ngeoffray wrote:
> > On 2013/07/18 09:59:32, ahe wrote:
> > > Why this change?
> > 
> > Apparently, it's not ensured that functionSignature is not null at this
point.
> 
> That is a bug.  It must be non-null. Calling computeSignature can start
> enqueueing stuff.
> 
> I think it would be best if you can ensure the resolver has computed the
> signature already.

Done in: https://codereview.chromium.org/22874003/

Powered by Google App Engine
This is Rietveld 408576698