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

Issue 8676001: Implement type checking of list literals (issue 220). (Closed)

Created:
9 years, 1 month ago by regis
Modified:
9 years, 1 month ago
Reviewers:
hausner
CC:
reviews_dartlang.org
Visibility:
Public.

Description

Implement type checking of list literals (issue 220). Remove expose_core_impl flag. Add tests. Fix tests. Cleanup type checking of map literals. Committed: https://code.google.com/p/dart/source/detail?r=1809

Patch Set 1 #

Total comments: 6

Patch Set 2 : '' #

Unified diffs Side-by-side diffs Delta from patch set Stats (+248 lines, -148 lines) Patch
M runtime/lib/growable_array.dart View 1 4 chunks +6 lines, -12 lines 0 comments Download
M runtime/lib/lib_sources.gypi View 1 1 chunk +1 line, -1 line 0 comments Download
A + runtime/lib/literal_factory.dart View 1 2 chunks +35 lines, -6 lines 0 comments Download
D runtime/lib/literal_map_factory.dart View 1 1 chunk +0 lines, -26 lines 0 comments Download
M runtime/vm/object.cc View 1 2 chunks +0 lines, -6 lines 0 comments Download
M runtime/vm/parser.h View 1 2 chunks +4 lines, -4 lines 0 comments Download
M runtime/vm/parser.cc View 1 12 chunks +92 lines, -77 lines 0 comments Download
M runtime/vm/scanner.cc View 1 2 chunks +1 line, -2 lines 0 comments Download
M tests/co19/co19-runtime.status View 1 1 chunk +0 lines, -1 line 0 comments Download
M tests/corelib/src/StringBaseVMTest.dart View 1 2 chunks +3 lines, -9 lines 0 comments Download
M tests/language/language.status View 1 3 chunks +8 lines, -3 lines 0 comments Download
M tests/language/src/CanonicalConstTest.dart View 1 1 chunk +1 line, -1 line 0 comments Download
A tests/language/src/ListLiteral1NegativeTest.dart View 1 chunk +22 lines, -0 lines 0 comments Download
A tests/language/src/ListLiteral2NegativeTest.dart View 1 chunk +22 lines, -0 lines 0 comments Download
A tests/language/src/ListLiteral4Test.dart View 1 chunk +53 lines, -0 lines 0 comments Download

Messages

Total messages: 3 (0 generated)
regis
9 years, 1 month ago (2011-11-23 04:47:02 UTC) #1
hausner
LGTM with a couple of comments. http://codereview.chromium.org/8676001/diff/1/runtime/lib/literal_factory.dart File runtime/lib/literal_factory.dart (right): http://codereview.chromium.org/8676001/diff/1/runtime/lib/literal_factory.dart#newcode16 runtime/lib/literal_factory.dart:16: // In checked ...
9 years, 1 month ago (2011-11-23 17:34:34 UTC) #2
regis
9 years, 1 month ago (2011-11-23 19:29:43 UTC) #3
Thanks

http://codereview.chromium.org/8676001/diff/1/runtime/lib/literal_factory.dart
File runtime/lib/literal_factory.dart (right):

http://codereview.chromium.org/8676001/diff/1/runtime/lib/literal_factory.dar...
runtime/lib/literal_factory.dart:16: // In checked mode only, rethrow an
eventual type error with a more user
On 2011/11/23 17:34:34, hausner wrote:
> eventual -> potential

Done.

http://codereview.chromium.org/8676001/diff/1/runtime/lib/literal_factory.dar...
runtime/lib/literal_factory.dart:18: try {
On 2011/11/23 17:34:34, hausner wrote:
> Instead of doing the type check here, could the parser add a type check
AstNode
> to the element expression node, so that the type is checked right after the
> element is evaluated?

What would the advantage be? I would not be able to intercept the type error,
since it would happen in the caller of this factory.
I'll submit as is and revisit, since the script of the error may not be the
correct one and your suggestion may fix it.

http://codereview.chromium.org/8676001/diff/1/runtime/vm/parser.cc
File runtime/vm/parser.cc (right):

http://codereview.chromium.org/8676001/diff/1/runtime/vm/parser.cc#newcode6648
runtime/vm/parser.cc:6648: "list literal element must be a constant of type
'%s'",
On 2011/11/23 17:34:34, hausner wrote:
> Even though we indicate the column position of the element, it might be nice
to
> include the index value in the error message: "list literal element 5 must be
> ...."

Done here and for map literals below.

Powered by Google App Engine
This is Rietveld 408576698