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

Issue 11272032: Handle compound operators. (Closed)

Created:
8 years, 1 month ago by polux
Modified:
8 years, 1 month ago
Reviewers:
karlklose
CC:
reviews_dartlang.org
Visibility:
Public.

Description

Handle compound operators. Committed: https://code.google.com/p/dart/source/detail?r=14682

Patch Set 1 #

Total comments: 20

Patch Set 2 : Address Karl's comments #

Patch Set 3 : Address Karl's comments in tests #

Patch Set 4 : Add name in TODO #

Unified diffs Side-by-side diffs Delta from patch set Stats (+201 lines, -72 lines) Patch
M sdk/lib/_internal/compiler/implementation/types/concrete_types_inferrer.dart View 1 2 3 9 chunks +127 lines, -68 lines 0 comments Download
M tests/compiler/dart2js/cpa_inference_test.dart View 1 2 3 chunks +74 lines, -4 lines 0 comments Download

Messages

Total messages: 2 (0 generated)
karlklose
LGTM with a few comments. https://chromiumcodereview.appspot.com/11272032/diff/1/lib/compiler/implementation/types/concrete_types_inferrer.dart File lib/compiler/implementation/types/concrete_types_inferrer.dart (right): https://chromiumcodereview.appspot.com/11272032/diff/1/lib/compiler/implementation/types/concrete_types_inferrer.dart#newcode992 lib/compiler/implementation/types/concrete_types_inferrer.dart:992: environment = environment.put(receiver, argumentType); ...
8 years, 1 month ago (2012-11-08 10:45:31 UTC) #1
polux
8 years, 1 month ago (2012-11-08 14:04:50 UTC) #2
https://chromiumcodereview.appspot.com/11272032/diff/1/lib/compiler/implement...
File lib/compiler/implementation/types/concrete_types_inferrer.dart (right):

https://chromiumcodereview.appspot.com/11272032/diff/1/lib/compiler/implement...
lib/compiler/implementation/types/concrete_types_inferrer.dart:992: environment
= environment.put(receiver, argumentType);
On 2012/11/08 10:45:31, karlklose wrote:
> Do we keep track of the type of AbstractFields?

Good catch! Added a test. Discovered a similar issue with getters, fixed it and
added a test too.

https://chromiumcodereview.appspot.com/11272032/diff/1/lib/compiler/implement...
lib/compiler/implementation/types/concrete_types_inferrer.dart:1008:
(fieldOrSetter as AbstractFieldElement).setter;
On 2012/11/08 10:45:31, karlklose wrote:
> We usually assign to a variable instead of using as. (A cast includes a type
> check).

Done.

https://chromiumcodereview.appspot.com/11272032/diff/1/lib/compiler/implement...
lib/compiler/implementation/types/concrete_types_inferrer.dart:1009: // TODO:
uncomment if we add an effect system
On 2012/11/08 10:45:31, karlklose wrote:
> "TODO(polux)". Also, can you extend the comment to explain why the call should
> be there?

Done.

https://chromiumcodereview.appspot.com/11272032/diff/1/lib/compiler/implement...
lib/compiler/implementation/types/concrete_types_inferrer.dart:1017: for (final
member in inferrer.getMembersByName(source)) {
On 2012/11/08 10:45:31, karlklose wrote:
> Please type the loop variable.

Done.

https://chromiumcodereview.appspot.com/11272032/diff/1/lib/compiler/implement...
lib/compiler/implementation/types/concrete_types_inferrer.dart:1018: Element
classElem = member.enclosingElement;
On 2012/11/08 10:45:31, karlklose wrote:
> Does this work for fields? Their enclosing member is a variable definition,
> isn't it? I think you should use getEnclosingClass.

Done.

https://chromiumcodereview.appspot.com/11272032/diff/1/lib/compiler/implement...
lib/compiler/implementation/types/concrete_types_inferrer.dart:1049: new
ArgumentsTypes(positionalArguments, new Map());
On 2012/11/08 10:45:31, karlklose wrote:
> How about using {} isntead of new Map()?

This would evaluate to <String,dynamic>{} and would break in checked mode.

https://chromiumcodereview.appspot.com/11272032/diff/1/lib/compiler/implement...
lib/compiler/implementation/types/concrete_types_inferrer.dart:1402:
SourceString canonicalizedMethodName =
On 2012/11/08 10:45:31, karlklose wrote:
> Consider simply calling the variable 'name'. That would make the rest of the
> method easier to read.

Done.

https://chromiumcodereview.appspot.com/11272032/diff/1/tests/compiler/dart2js...
File tests/compiler/dart2js/cpa_inference_test.dart (right):

https://chromiumcodereview.appspot.com/11272032/diff/1/tests/compiler/dart2js...
tests/compiler/dart2js/cpa_inference_test.dart:548: var _x;
On 2012/11/08 10:45:31, karlklose wrote:
> It is unnecessary to use privacy here; using a normal would perhaps make the
> test easier to understand.

Done.

https://chromiumcodereview.appspot.com/11272032/diff/1/tests/compiler/dart2js...
tests/compiler/dart2js/cpa_inference_test.dart:550: var witness2;
On 2012/11/08 10:45:31, karlklose wrote:
> witness2 is unused. Did you want to use it in the setter and the second test?

Done.

https://chromiumcodereview.appspot.com/11272032/diff/1/tests/compiler/dart2js...
tests/compiler/dart2js/cpa_inference_test.dart:566:
result.checkFieldHasType('A', 'witness1', [result.string]);
On 2012/11/08 10:45:31, karlklose wrote:
> witness2?

Done.

Powered by Google App Engine
This is Rietveld 408576698