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

Issue 10982051: Make throw an expression (Closed)

Created:
8 years, 2 months ago by hausner
Modified:
8 years, 2 months ago
Reviewers:
regis, siva, kasperl
CC:
reviews_dartlang.org
Visibility:
Public.

Description

Make throw an expression Throw e is now an expression rather than a statement. The language spec says that throw without an expression (i.e. rethrowing the current exception) is an expression as well. I have not implemented this. It is rather difficult to determine at expression level whether the keyword "throw" is followed by an expression or not. Thus, throw without an expression is only allowed at statement level. I think we should change the language spec to that effect. Committed: https://code.google.com/p/dart/source/detail?r=12928

Patch Set 1 #

Patch Set 2 : #

Patch Set 3 : #

Total comments: 1
Unified diffs Side-by-side diffs Delta from patch set Stats (+130 lines, -25 lines) Patch
M runtime/vm/parser.cc View 1 3 chunks +32 lines, -25 lines 0 comments Download
M tests/language/language.status View 1 1 chunk +1 line, -0 lines 0 comments Download
M tests/language/language_dart2js.status View 1 1 chunk +1 line, -0 lines 0 comments Download
A tests/language/throw_expr_test.dart View 1 2 1 chunk +96 lines, -0 lines 1 comment Download

Messages

Total messages: 3 (0 generated)
hausner
8 years, 2 months ago (2012-09-26 20:31:38 UTC) #1
regis
LGTM
8 years, 2 months ago (2012-09-26 20:53:09 UTC) #2
siva
8 years, 2 months ago (2012-09-26 21:09:12 UTC) #3
http://codereview.chromium.org/10982051/diff/6001/tests/language/throw_expr_t...
File tests/language/throw_expr_test.dart (right):

http://codereview.chromium.org/10982051/diff/6001/tests/language/throw_expr_t...
tests/language/throw_expr_test.dart:56: }
I think the test will read much better if you changed the string to "up" instead
of "throw".

Also how about a try { throw 25 - throw 24; } catch (e) { }

Powered by Google App Engine
This is Rietveld 408576698