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

Issue 10823396: Implement import scope (Closed)

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

Description

Implement import scope Implement the new scope rule for imports. - Imported identifiers are in a scope that is shadowed by the importing library's top-level scope. - Conflicting names imported from different libraries are not an error unless the name is referenced. - Conflicting type names are only an error in checked mode. In a follow-on change, I'll remove the "imported_into" pointers in libraries. They are no longer needed. Issue 2945 Committed: https://code.google.com/p/dart/source/detail?r=10923

Patch Set 1 #

Patch Set 2 : #

Total comments: 14

Patch Set 3 : #

Unified diffs Side-by-side diffs Delta from patch set Stats (+312 lines, -338 lines) Patch
M runtime/vm/class_finalizer.cc View 1 2 1 chunk +0 lines, -7 lines 0 comments Download
M runtime/vm/dart_api_impl_test.cc View 1 2 5 chunks +47 lines, -117 lines 0 comments Download
M runtime/vm/object.cc View 1 2 2 chunks +5 lines, -16 lines 0 comments Download
M runtime/vm/parser.h View 1 2 2 chunks +25 lines, -6 lines 0 comments Download
M runtime/vm/parser.cc View 1 2 14 chunks +208 lines, -105 lines 0 comments Download
M tests/co19/co19-runtime.status View 1 2 4 chunks +5 lines, -2 lines 0 comments Download
M tests/language/library1_negative_test.dart View 1 2 2 chunks +2 lines, -3 lines 0 comments Download
D tests/language/library2_negative_test.dart View 1 2 1 chunk +0 lines, -14 lines 0 comments Download
D tests/language/library3_negative_test.dart View 1 2 1 chunk +0 lines, -18 lines 0 comments Download
D tests/language/library4_negative_test.dart View 1 2 1 chunk +0 lines, -14 lines 0 comments Download
D tests/language/library5_negative_test.dart View 1 2 1 chunk +0 lines, -14 lines 0 comments Download
A tests/language/library6.dart View 1 chunk +17 lines, -0 lines 0 comments Download
D tests/language/library6_negative_test.dart View 1 2 1 chunk +0 lines, -17 lines 0 comments Download
M tests/language/prefix3_negative_test.dart View 1 2 1 chunk +2 lines, -5 lines 0 comments Download
M tests/language/pseudo_kw_illegal_test.dart View 1 2 1 chunk +1 line, -0 lines 0 comments Download

Messages

Total messages: 3 (0 generated)
hausner
8 years, 4 months ago (2012-08-17 19:10:43 UTC) #1
regis
LGTM http://codereview.chromium.org/10823396/diff/6002/runtime/vm/parser.cc File runtime/vm/parser.cc (right): http://codereview.chromium.org/10823396/diff/6002/runtime/vm/parser.cc#newcode6237 runtime/vm/parser.cc:6237: String* Parser::ExpectTypeIdentifier(const char* msg) { This should be ...
8 years, 4 months ago (2012-08-17 20:23:07 UTC) #2
hausner
8 years, 4 months ago (2012-08-17 21:05:52 UTC) #3
Thank you.

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

http://codereview.chromium.org/10823396/diff/6002/runtime/vm/parser.cc#newcod...
runtime/vm/parser.cc:6237: String* Parser::ExpectTypeIdentifier(const char* msg)
{
On 2012/08/17 20:23:07, regis wrote:
> This should be called ExpectClassIdentifier.

Done.

http://codereview.chromium.org/10823396/diff/6002/runtime/vm/parser.cc#newcod...
runtime/vm/parser.cc:6243: ErrorMsg("illegal type name '%s'",
ident->ToCString());
On 2012/08/17 20:23:07, regis wrote:
> "illegal class name"

Re-used the error message defined by the caller, since this check is used for
classes, interfaces, and typedefs.

http://codereview.chromium.org/10823396/diff/6002/runtime/vm/parser.cc#newcod...
runtime/vm/parser.cc:7647: // Resolve an name by checking the global scope of
the current
On 2012/08/17 20:23:07, regis wrote:
> s/an/a/

Done.

http://codereview.chromium.org/10823396/diff/6002/runtime/vm/parser.cc#newcod...
runtime/vm/parser.cc:7671: "'%s' is defined in library '%s' and also in '%s'.",
On 2012/08/17 20:23:07, regis wrote:
> We usually do not terminate error messages with a period.

Done.

http://codereview.chromium.org/10823396/diff/6002/runtime/vm/parser.cc#newcod...
runtime/vm/parser.cc:7783: TRACE_PARSER("ResolveIdentInPrefixScope");
On 2012/08/17 20:23:07, regis wrote:
> No TRACE_PARSER in other calls. On purpose?

No on purpose. We have lots of functions that don't trace. I added a few where I
thought it makes sense.

http://codereview.chromium.org/10823396/diff/6002/runtime/vm/parser.cc#newcod...
runtime/vm/parser.cc:8819: *qual_ident.ident);
On 2012/08/17 20:23:07, regis wrote:
> indentation

Done.

http://codereview.chromium.org/10823396/diff/6002/runtime/vm/parser.h
File runtime/vm/parser.h (right):

http://codereview.chromium.org/10823396/diff/6002/runtime/vm/parser.h#newcode499
runtime/vm/parser.h:499: const String& ident);
On 2012/08/17 20:23:07, regis wrote:
> Reorder these 6 methods and group them in pairs.
> Explaining in a comment the difference between a Name and an Ident would be
> helpful.

Done.

Powered by Google App Engine
This is Rietveld 408576698