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

Issue 10867032: Beginning support for library prefixes in the dart API. (Closed)

Created:
8 years, 4 months ago by Mads Ager (google)
Modified:
8 years, 3 months ago
Reviewers:
turnidge, Ivan Posva
CC:
reviews_dartlang.org
Visibility:
Public.

Description

Beginning support for library prefixes in the dart API. This is a request for comments. Do we want to expose library prefixes like this? Is there a way to import with a prefix already and lookup members? The reason why I would like to do this is so that I can import the user-supplied builtins library under a prefix. This will be a useful first step to move the print function to corelib while preserving the ability to patch in a print implementation via the builtins library. R=iposva@google.com,turnidge@google.com BUG= Committed: https://code.google.com/p/dart/source/detail?r=11494

Patch Set 1 #

Patch Set 2 : Cut down to what I actually need at this point. #

Total comments: 4

Patch Set 3 : Address review comment. #

Total comments: 4

Patch Set 4 : Address review comments. #

Patch Set 5 : Use Dart_Null in builtin.cc #

Unified diffs Side-by-side diffs Delta from patch set Stats (+96 lines, -18 lines) Patch
M runtime/bin/builtin.cc View 1 2 3 4 2 chunks +4 lines, -2 lines 0 comments Download
M runtime/bin/builtin_nolib.cc View 1 2 3 1 chunk +3 lines, -1 line 0 comments Download
M runtime/include/dart_api.h View 1 2 3 1 chunk +13 lines, -2 lines 0 comments Download
M runtime/vm/dart_api_impl.cc View 1 2 3 3 chunks +23 lines, -3 lines 0 comments Download
M runtime/vm/dart_api_impl_test.cc View 1 2 3 3 chunks +50 lines, -9 lines 0 comments Download
M runtime/vm/snapshot_test.cc View 1 2 3 1 chunk +3 lines, -1 line 0 comments Download

Messages

Total messages: 8 (0 generated)
Mads Ager (google)
8 years, 4 months ago (2012-08-23 12:51:43 UTC) #1
Mads Ager (google)
Here is a sketch of how I would like to use this to move print ...
8 years, 4 months ago (2012-08-23 13:58:56 UTC) #2
Mads Ager (google)
I have cut this down to what is actually needed to support the 'print' corelib ...
8 years, 3 months ago (2012-08-27 09:39:55 UTC) #3
Ivan Posva
https://chromiumcodereview.appspot.com/10867032/diff/3001/runtime/include/dart_api.h File runtime/include/dart_api.h (right): https://chromiumcodereview.appspot.com/10867032/diff/3001/runtime/include/dart_api.h#newcode2540 runtime/include/dart_api.h:2540: ? https://chromiumcodereview.appspot.com/10867032/diff/3001/runtime/vm/dart_api_impl.cc File runtime/vm/dart_api_impl.cc (right): https://chromiumcodereview.appspot.com/10867032/diff/3001/runtime/vm/dart_api_impl.cc#newcode4050 runtime/vm/dart_api_impl.cc:4050: if (prefix_vm.IsNull()) ...
8 years, 3 months ago (2012-08-27 23:55:00 UTC) #4
Ivan Posva
On 2012/08/27 23:55:00, Ivan Posva wrote: > https://chromiumcodereview.appspot.com/10867032/diff/3001/runtime/include/dart_api.h > File runtime/include/dart_api.h (right): > > https://chromiumcodereview.appspot.com/10867032/diff/3001/runtime/include/dart_api.h#newcode2540 ...
8 years, 3 months ago (2012-08-27 23:55:35 UTC) #5
Mads Ager (google)
https://chromiumcodereview.appspot.com/10867032/diff/3001/runtime/include/dart_api.h File runtime/include/dart_api.h (right): https://chromiumcodereview.appspot.com/10867032/diff/3001/runtime/include/dart_api.h#newcode2540 runtime/include/dart_api.h:2540: On 2012/08/27 23:55:00, Ivan Posva wrote: > ? Done. ...
8 years, 3 months ago (2012-08-28 05:58:31 UTC) #6
Ivan Posva
LGTM with comments. -Ivan https://chromiumcodereview.appspot.com/10867032/diff/9001/runtime/bin/builtin.cc File runtime/bin/builtin.cc (right): https://chromiumcodereview.appspot.com/10867032/diff/9001/runtime/bin/builtin.cc#newcode83 runtime/bin/builtin.cc:83: prefix)); Siva and I discussed ...
8 years, 3 months ago (2012-08-28 23:22:02 UTC) #7
Mads Ager (google)
8 years, 3 months ago (2012-08-29 05:52:10 UTC) #8
Thanks Ivan.

I will prepare the corresponding Dartium change and land.

https://chromiumcodereview.appspot.com/10867032/diff/9001/runtime/bin/builtin.cc
File runtime/bin/builtin.cc (right):

https://chromiumcodereview.appspot.com/10867032/diff/9001/runtime/bin/builtin...
runtime/bin/builtin.cc:83: prefix));
On 2012/08/28 23:22:02, Ivan Posva wrote:
> Siva and I discussed this and we feel that being able to pass Dart_Null()
> instead of allocating an empty string is the right choice here.

Sounds good. I updated the code to allow both Dart_Null as well as an empty
string to act as no prefix. Additionally, I added a bit of documentation to the
API.

https://chromiumcodereview.appspot.com/10867032/diff/9001/runtime/vm/dart_api...
File runtime/vm/dart_api_impl_test.cc (right):

https://chromiumcodereview.appspot.com/10867032/diff/9001/runtime/vm/dart_api...
runtime/vm/dart_api_impl_test.cc:5299: "#library('library2_name');";
On 2012/08/28 23:22:02, Ivan Posva wrote:
> Also add a test that something in the prefixed library can be found for
example:
> 
> foobar() => bar.foo();

Done.

Powered by Google App Engine
This is Rietveld 408576698