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

Issue 10540048: Implement 'as' operator. (Closed)

Created:
8 years, 6 months ago by Lasse Reichstein Nielsen
Modified:
8 years, 3 months ago
CC:
reviews_dartlang.org, floitsch
Visibility:
Public.

Description

Implement 'as' operator. This is a quick implementation with room for improvement. It might work. Committed: https://code.google.com/p/dart/source/detail?r=9109

Patch Set 1 #

Patch Set 2 : Make "as" a builtin identifier. #

Total comments: 1

Patch Set 3 : Added missing slashes in test #

Total comments: 2

Patch Set 4 : Update semantics to not throw on null. Merge to head. #

Total comments: 36

Patch Set 5 : Address review comments. #

Total comments: 7

Patch Set 6 : Address further comments. #

Patch Set 7 : Had to move CastException out of corelib to avoid conflict in VM. #

Patch Set 8 : No need to match corelib style for CastException any more. #

Patch Set 9 : Added test. Removed exception for casts the wasn't needed. #

Patch Set 10 : No entries in language.status, vm and dartc already implemented 'as'. #

Total comments: 1
Unified diffs Side-by-side diffs Delta from patch set Stats (+302 lines, -31 lines) Patch
M corelib/src/exceptions.dart View 1 2 3 4 5 6 1 chunk +2 lines, -2 lines 0 comments Download
M lib/compiler/implementation/lib/js_helper.dart View 1 2 3 4 11 chunks +97 lines, -3 lines 1 comment Download
M lib/compiler/implementation/lib/mock.dart View 1 2 3 4 5 6 7 1 chunk +15 lines, -0 lines 0 comments Download
M lib/compiler/implementation/resolver.dart View 1 2 3 4 5 6 7 8 9 2 chunks +2 lines, -1 line 0 comments Download
M lib/compiler/implementation/scanner/keyword.dart View 1 2 chunks +2 lines, -0 lines 0 comments Download
M lib/compiler/implementation/scanner/listener.dart View 2 chunks +11 lines, -0 lines 0 comments Download
M lib/compiler/implementation/scanner/parser.dart View 1 2 3 4 2 chunks +18 lines, -2 lines 0 comments Download
M lib/compiler/implementation/scanner/token.dart View 1 2 3 4 2 chunks +4 lines, -1 line 0 comments Download
M lib/compiler/implementation/ssa/builder.dart View 1 2 3 4 5 6 7 8 3 chunks +20 lines, -2 lines 0 comments Download
M lib/compiler/implementation/ssa/codegen.dart View 1 2 3 4 chunks +35 lines, -3 lines 0 comments Download
M lib/compiler/implementation/ssa/codegen_helpers.dart View 1 2 3 1 chunk +2 lines, -2 lines 0 comments Download
M lib/compiler/implementation/ssa/nodes.dart View 1 2 3 4 5 5 chunks +20 lines, -15 lines 0 comments Download
A tests/language/cast_test.dart View 1 2 3 4 5 6 7 8 9 1 chunk +74 lines, -0 lines 0 comments Download

Messages

Total messages: 17 (0 generated)
Lasse Reichstein Nielsen
Karl and Nicolas: Am I doing the right thing with the type checks? It seems ...
8 years, 6 months ago (2012-06-07 12:23:33 UTC) #1
ahe
Initial comments. http://codereview.chromium.org/10540048/diff/3001/tests/language/cast_test.dart File tests/language/cast_test.dart (right): http://codereview.chromium.org/10540048/diff/3001/tests/language/cast_test.dart#newcode52 tests/language/cast_test.dart:52: c = oc; // 09: static type ...
8 years, 6 months ago (2012-06-07 13:12:58 UTC) #2
ahe
http://codereview.chromium.org/10540048/diff/5001/lib/compiler/implementation/lib/js_helper.dart File lib/compiler/implementation/lib/js_helper.dart (right): http://codereview.chromium.org/10540048/diff/5001/lib/compiler/implementation/lib/js_helper.dart#newcode955 lib/compiler/implementation/lib/js_helper.dart:955: class CastException extends TypeError { Why is this not ...
8 years, 6 months ago (2012-06-08 08:14:57 UTC) #3
Lasse Reichstein Nielsen
Ping non-Peters. I suggest we commit this as the spec says, get some experience with ...
8 years, 6 months ago (2012-06-20 08:09:54 UTC) #4
ahe
On 2012/06/20 08:09:54, Lasse Reichstein Nielsen wrote: > Ping non-Peters. > I suggest we commit ...
8 years, 6 months ago (2012-06-20 08:47:45 UTC) #5
Lasse Reichstein Nielsen
Excellent!
8 years, 6 months ago (2012-06-20 09:32:36 UTC) #6
Lasse Reichstein Nielsen
Please take another look. Some tests still fail due to an existing bug (https://code.google.com/p/dart/issues/detail?id=3857).
8 years, 6 months ago (2012-06-25 07:54:45 UTC) #7
ahe
Everything but the SSA looks fine (I'm not sure I understand it). I would like ...
8 years, 6 months ago (2012-06-25 10:36:56 UTC) #8
Lasse Reichstein Nielsen
Thanks for the comments. Adding Florian for the SSA part. http://codereview.chromium.org/10540048/diff/10001/corelib/src/exceptions.dart File corelib/src/exceptions.dart (right): http://codereview.chromium.org/10540048/diff/10001/corelib/src/exceptions.dart#newcode143 ...
8 years, 6 months ago (2012-06-25 11:20:06 UTC) #9
ahe
http://codereview.chromium.org/10540048/diff/10001/corelib/src/exceptions.dart File corelib/src/exceptions.dart (right): http://codereview.chromium.org/10540048/diff/10001/corelib/src/exceptions.dart#newcode154 corelib/src/exceptions.dart:154: String get exceptionName() => "CastException"; On 2012/06/25 11:20:06, Lasse ...
8 years, 6 months ago (2012-06-25 11:57:03 UTC) #10
Lasse Reichstein Nielsen
http://codereview.chromium.org/10540048/diff/10001/corelib/src/exceptions.dart File corelib/src/exceptions.dart (right): http://codereview.chromium.org/10540048/diff/10001/corelib/src/exceptions.dart#newcode154 corelib/src/exceptions.dart:154: String get exceptionName() => "CastException"; I don't think the ...
8 years, 6 months ago (2012-06-25 12:51:10 UTC) #11
ahe
http://codereview.chromium.org/10540048/diff/10001/lib/compiler/implementation/lib/js_helper.dart File lib/compiler/implementation/lib/js_helper.dart (right): http://codereview.chromium.org/10540048/diff/10001/lib/compiler/implementation/lib/js_helper.dart#newcode1073 lib/compiler/implementation/lib/js_helper.dart:1073: propertyTypeCast(Object value, Object property) { On 2012/06/25 12:51:10, Lasse ...
8 years, 6 months ago (2012-06-25 12:56:32 UTC) #12
ahe
LGTM (except for ssa/*)
8 years, 6 months ago (2012-06-25 13:06:33 UTC) #13
Lasse Reichstein Nielsen
Addressed Peter's comments. Florian, please take a look, and perhaps check the CL out and ...
8 years, 6 months ago (2012-06-25 15:16:07 UTC) #14
floitsch
LGTM. couldn't reproduce your errors. Maybe they are already fixed. http://codereview.chromium.org/10540048/diff/17001/corelib/src/exceptions.dart File corelib/src/exceptions.dart (right): http://codereview.chromium.org/10540048/diff/17001/corelib/src/exceptions.dart#newcode42 ...
8 years, 6 months ago (2012-06-25 18:21:09 UTC) #15
Lasse Reichstein Nielsen
http://codereview.chromium.org/10540048/diff/17001/corelib/src/exceptions.dart File corelib/src/exceptions.dart (right): http://codereview.chromium.org/10540048/diff/17001/corelib/src/exceptions.dart#newcode42 corelib/src/exceptions.dart:42: this._existingArgumentNames = existingArgumentNames; On 2012/06/25 18:21:09, floitsch wrote: > ...
8 years, 6 months ago (2012-06-26 08:26:03 UTC) #16
ngeoffray
8 years, 3 months ago (2012-08-27 14:24:00 UTC) #17
https://chromiumcodereview.appspot.com/10540048/diff/14003/lib/compiler/imple...
File lib/compiler/implementation/lib/js_helper.dart (right):

https://chromiumcodereview.appspot.com/10540048/diff/14003/lib/compiler/imple...
lib/compiler/implementation/lib/js_helper.dart:995: stringTypeCast(value) {
These helpers share sooo much with their checked mode equivalent. Any reason why
you did not use a boolean flag to the existing helpers that tells whether it's
checked mode or cast mode?

Powered by Google App Engine
This is Rietveld 408576698