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

Issue 8342046: Add an imported into list for libraries so that it is possible to lookup (Closed)

Created:
9 years, 2 months ago by siva
Modified:
9 years, 2 months ago
Reviewers:
hausner, Ivan Posva
CC:
reviews_dartlang.org, vm-dev_dartlang.org
Visibility:
Public.

Description

Add an imported into list for libraries so that it is possible to lookup the local scope at the imported site in order to check if a variable is already defined. Added a check for duplicate definitions during class finialization which checks for duplicate definitions. Committed: https://code.google.com/p/dart/source/detail?r=593

Patch Set 1 #

Patch Set 2 : '' #

Patch Set 3 : '' #

Patch Set 4 : '' #

Total comments: 14

Patch Set 5 : '' #

Patch Set 6 : '' #

Unified diffs Side-by-side diffs Delta from patch set Stats (+469 lines, -23 lines) Patch
M vm/class_finalizer.cc View 1 2 3 4 5 1 chunk +7 lines, -0 lines 0 comments Download
M vm/dart_api_impl.cc View 1 2 3 4 5 1 chunk +1 line, -0 lines 0 comments Download
M vm/dart_api_impl_test.cc View 1 2 3 4 5 1 chunk +232 lines, -0 lines 0 comments Download
M vm/isolate.cc View 1 2 3 4 5 1 chunk +1 line, -1 line 0 comments Download
M vm/object.h View 1 2 3 4 5 3 chunks +41 lines, -9 lines 0 comments Download
M vm/object.cc View 1 2 3 4 5 8 chunks +180 lines, -11 lines 0 comments Download
M vm/object_test.cc View 1 2 3 4 5 1 chunk +1 line, -1 line 0 comments Download
M vm/raw_object.h View 1 2 3 4 5 1 chunk +4 lines, -1 line 0 comments Download
M vm/raw_object_snapshot.cc View 1 2 3 4 5 2 chunks +2 lines, -0 lines 0 comments Download

Messages

Total messages: 4 (0 generated)
siva
9 years, 2 months ago (2011-10-19 23:01:46 UTC) #1
hausner
LGTM w/comment. http://codereview.chromium.org/8342046/diff/2004/vm/raw_object.h File vm/raw_object.h (right): http://codereview.chromium.org/8342046/diff/2004/vm/raw_object.h#newcode451 vm/raw_object.h:451: RawArray* imported_into_; // List of libraries where ...
9 years, 2 months ago (2011-10-19 23:56:27 UTC) #2
Ivan Posva
DBCs and a question: main.dart: #import("library1.dart"); #import("library2.dart", prefix: "foo"); library1.dart: #library("library1.dart"); var foo = 1; ...
9 years, 2 months ago (2011-10-20 08:46:04 UTC) #3
siva
9 years, 2 months ago (2011-10-20 23:08:47 UTC) #4
Yes the test case you had should be an error and I have
added it to the test cases that I have for this in the
other changelist (Library4NegativeTest.dart).

http://codereview.chromium.org/8342046/diff/2004/vm/dart_api_impl_test.cc
File vm/dart_api_impl_test.cc (right):

http://codereview.chromium.org/8342046/diff/2004/vm/dart_api_impl_test.cc#new...
vm/dart_api_impl_test.cc:1436: "#import(\"library1.dart\");\n"
On 2011/10/20 08:46:04, Ivan Posva wrote:
> This would become a little bit more readable if it was:
> "#import('library1.dart');\n"
> 
> Also the \n is not strictly needed either.

Done.

http://codereview.chromium.org/8342046/diff/2004/vm/dart_api_impl_test.cc#new...
vm/dart_api_impl_test.cc:1471: assert(!Dart_IsValidResult(result));
On 2011/10/20 08:46:04, Ivan Posva wrote:
> Could you check that there is a complaint about "foo" in the error string?

Done.

http://codereview.chromium.org/8342046/diff/2004/vm/dart_api_impl_test.cc#new...
vm/dart_api_impl_test.cc:1582: "#library(\"library2.dart\");\n"
Changed to libraryB.dart
On 2011/10/20 08:46:04, Ivan Posva wrote:
> library2.dart?

Done.

http://codereview.chromium.org/8342046/diff/2004/vm/object.cc
File vm/object.cc (right):

http://codereview.chromium.org/8342046/diff/2004/vm/object.cc#newcode3632
vm/object.cc:3632: // First check if name is found in the local scope of the
library into
On 2011/10/20 08:46:04, Ivan Posva wrote:
> Please factor this out as it is essentially LookupObjectFiltered(name, *this)
> where the second parameter is used to filter which imported library is
skipped.
> LookupObject then calls LookupObjectFiltered(name, Library::Handle()).

Done.

http://codereview.chromium.org/8342046/diff/2004/vm/object.cc#newcode3701
vm/object.cc:3701: if (obj.IsNull()) {
True, I changed this to an assertion.

On 2011/10/20 08:46:04, Ivan Posva wrote:
> I don't think the iterator is ever handing out null objects.

http://codereview.chromium.org/8342046/diff/2004/vm/object.cc#newcode3712
vm/object.cc:3712: } else {
Added comment stating that library prefixes in this library are not visible in
the importing scope.

On 2011/10/20 08:46:04, Ivan Posva wrote:
> Please add a comment explaining why you can skip library prefixes.

http://codereview.chromium.org/8342046/diff/2004/vm/raw_object.h
File vm/raw_object.h (right):

http://codereview.chromium.org/8342046/diff/2004/vm/raw_object.h#newcode451
vm/raw_object.h:451: RawArray* imported_into_;      // List of libraries where
this is imported.
On 2011/10/19 23:56:27, hausner wrote:
> It doesn't fit on one line, but I think it's worthwhile to point out that the
> list contains the importers that import _without_ a prefix.

Done.

Powered by Google App Engine
This is Rietveld 408576698