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

Issue 9359009: Implement support for specifying string interopolation style variable substitution in the import ... (Closed)

Created:
8 years, 10 months ago by siva
Modified:
8 years, 10 months ago
Reviewers:
hausner
CC:
reviews_dartlang.org, vm-dev_dartlang.org
Visibility:
Public.

Description

Implement support for specifying string interopolation style variable substitution in the import and source statements. e.g: sivamach[runtime]>more /workspace/asiva/expr/test1.dart #library('test1.dart'); #import('${GOOGLE}$SRC/test2.dart'); #import('$DART/test3.dart'); test1() { print("test1"); } main() { test1(); test2(); test3(); } sivamach[runtime]>more /workspace/asiva/expr/src/test2.dart #library('test2.dart'); #source('$GOOGLE$SRC/test2a.dart'); test2() { print("test2"); test2a(); } sivamach[runtime]>more /workspace/asiva/expr/src/test2a.dart test2a() { print("test2a"); } sivamach[runtime]>more /workspace/asiva/expr/src/test3.dart #library('test3.dart'); #source('test3a.dart'); test3() { print("test3"); test3a(); } sivamach[runtime]>more /workspace/asiva/expr/src/test3a.dart test3a() { print("test3a"); } sivamach[runtime]>out/Debug_ia32/dart --import_map=GOOGLE,/workspace/asiva/expr --import_map=SRC,src --import_map=DART,/workspace/asiva/expr/src /workspace/asiva/expr/test1.dart test1 test2 test2a test3 test3a Committed: https://code.google.com/p/dart/source/detail?r=4199

Patch Set 1 #

Patch Set 2 : '' #

Patch Set 3 : '' #

Total comments: 10

Patch Set 4 : '' #

Unified diffs Side-by-side diffs Delta from patch set Stats (+466 lines, -84 lines) Patch
M bin/builtin.cc View 1 2 3 1 chunk +2 lines, -1 line 0 comments Download
M bin/dartutils.h View 1 2 3 1 chunk +2 lines, -1 line 0 comments Download
M bin/dartutils.cc View 1 2 3 2 chunks +3 lines, -2 lines 0 comments Download
M bin/gen_snapshot.cc View 1 2 3 4 chunks +20 lines, -5 lines 0 comments Download
M bin/main.cc View 1 2 3 8 chunks +45 lines, -6 lines 0 comments Download
M include/dart_api.h View 1 2 3 3 chunks +6 lines, -3 lines 0 comments Download
A tests/vm/src/mysrc/test2.dart View 1 2 3 1 chunk +13 lines, -0 lines 0 comments Download
A tests/vm/src/mysrc/test2a.dart View 1 2 3 1 chunk +7 lines, -0 lines 0 comments Download
A tests/vm/src/mysrc/test3.dart View 1 2 3 1 chunk +13 lines, -0 lines 0 comments Download
A tests/vm/src/mysrc/test3a.dart View 1 2 3 1 chunk +7 lines, -0 lines 0 comments Download
A tests/vm/src/test1.dart View 1 2 3 1 chunk +22 lines, -0 lines 0 comments Download
M vm/dart_api_impl.cc View 1 2 3 5 chunks +15 lines, -2 lines 0 comments Download
M vm/dart_api_impl_test.cc View 1 2 3 19 chunks +183 lines, -46 lines 0 comments Download
M vm/object.h View 1 2 3 2 chunks +3 lines, -0 lines 0 comments Download
M vm/object.cc View 1 2 3 3 chunks +23 lines, -0 lines 0 comments Download
M vm/parser.h View 1 2 3 3 chunks +5 lines, -2 lines 0 comments Download
M vm/parser.cc View 1 2 3 8 chunks +85 lines, -11 lines 0 comments Download
M vm/raw_object.h View 1 2 3 1 chunk +1 line, -0 lines 0 comments Download
M vm/snapshot_test.cc View 1 2 3 1 chunk +3 lines, -1 line 0 comments Download
M vm/unit_test.h View 1 2 3 1 chunk +2 lines, -1 line 0 comments Download
M vm/unit_test.cc View 1 2 3 3 chunks +6 lines, -3 lines 0 comments Download

Messages

Total messages: 3 (0 generated)
siva
8 years, 10 months ago (2012-02-08 07:13:49 UTC) #1
hausner
LGTM with comments. http://codereview.chromium.org/9359009/diff/2024/vm/object.cc File vm/object.cc (right): http://codereview.chromium.org/9359009/diff/2024/vm/object.cc#newcode4569 vm/object.cc:4569: result.raw_ptr()->import_map_ = Array::Empty(); I don't see ...
8 years, 10 months ago (2012-02-08 18:28:46 UTC) #2
siva
8 years, 10 months ago (2012-02-08 23:23:47 UTC) #3
Thanks, addressed review comments.

I also uploaded the test case I had above into the tests/vm directory.

http://codereview.chromium.org/9359009/diff/2024/vm/object.cc
File vm/object.cc (right):

http://codereview.chromium.org/9359009/diff/2024/vm/object.cc#newcode4569
vm/object.cc:4569: result.raw_ptr()->import_map_ = Array::Empty();
On 2012/02/08 18:28:47, hausner wrote:
> I don't see that this field is written to the snapshot. Is that intentional?
If
> so you still have to initialize it when the snapshot code reads the library in
> Library::ReadFrom(), right? 


The field is written out in a snapshot (all object fields between from_ and to_
in the declaration are written out).

http://codereview.chromium.org/9359009/diff/2024/vm/parser.cc
File vm/parser.cc (right):

http://codereview.chromium.org/9359009/diff/2024/vm/parser.cc#newcode7411
vm/parser.cc:7411: if (CurrentToken() == Token::kIDENT) {
On 2012/02/08 18:28:47, hausner wrote:
> I would check for IsIdentifier(). I guarantee you someone will insist that
they
> can't live without using pseudo keywords as import variable names.

Nice :-)

I have changed it to IsIdentifier();

http://codereview.chromium.org/9359009/diff/2024/vm/parser.cc#newcode7415
vm/parser.cc:7415: ExpectToken(Token::kINTERPOL_END);
On 2012/02/08 18:28:47, hausner wrote:
> I would add a more specific error message here, like:
> 
> if (CurrentToken() != Token::kINTERPOL_END) {
>   ErrorMsg("'}' expected");
> }
> 
> Your version would print: '' expected

Done.

http://codereview.chromium.org/9359009/diff/2024/vm/parser.cc#newcode7417
vm/parser.cc:7417: ErrorMsg("'%s' expected", Token::Str(Token::kIDENT));
On 2012/02/08 18:28:47, hausner wrote:
> How about just "idenitfier expected" or "import variable name expected"?

Done.

http://codereview.chromium.org/9359009/diff/2024/vm/parser.cc#newcode7424
vm/parser.cc:7424: ErrorMsg("'%s' expected", Token::Str(Token::kINTERPOL_VAR));
On 2012/02/08 18:28:47, hausner wrote:
> This else path is impossible due to the guard in the while statement.

Good point, removed.

Powered by Google App Engine
This is Rietveld 408576698