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

Side by Side Diff: runtime/vm/parser.cc

Issue 14791005: BREAKING CHANGE: enforce part of directive (Closed) Base URL: http://dart.googlecode.com/svn/branches/bleeding_edge/dart/
Patch Set: Created 7 years, 7 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
« no previous file with comments | « runtime/vm/object_test.cc ('k') | runtime/vm/parser_test.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright (c) 2012, the Dart project authors. Please see the AUTHORS file 1 // Copyright (c) 2012, the Dart project authors. Please see the AUTHORS file
2 // for details. All rights reserved. Use of this source code is governed by a 2 // for details. All rights reserved. Use of this source code is governed by a
3 // BSD-style license that can be found in the LICENSE file. 3 // BSD-style license that can be found in the LICENSE file.
4 4
5 #include "vm/parser.h" 5 #include "vm/parser.h"
6 6
7 #include "lib/invocation_mirror.h" 7 #include "lib/invocation_mirror.h"
8 #include "vm/bigint_operations.h" 8 #include "vm/bigint_operations.h"
9 #include "vm/class_finalizer.h" 9 #include "vm/class_finalizer.h"
10 #include "vm/compiler.h" 10 #include "vm/compiler.h"
(...skipping 4421 matching lines...) Expand 10 before | Expand all | Expand 10 after
4432 while (CurrentToken() == Token::kPART) { 4432 while (CurrentToken() == Token::kPART) {
4433 ParseLibraryPart(); 4433 ParseLibraryPart();
4434 metadata_pos = TokenPos(); 4434 metadata_pos = TokenPos();
4435 SkipMetadata(); 4435 SkipMetadata();
4436 } 4436 }
4437 SetPosition(metadata_pos); 4437 SetPosition(metadata_pos);
4438 } 4438 }
4439 4439
4440 4440
4441 void Parser::ParsePartHeader() { 4441 void Parser::ParsePartHeader() {
4442 intptr_t metadata_pos = TokenPos();
4443 SkipMetadata(); 4442 SkipMetadata();
4444 // TODO(hausner): Once support for old #source directive is removed 4443 if (CurrentToken() != Token::kPART) {
4445 // from the compiler, add an error message here if we don't find 4444 ErrorMsg("'part of' expected");
4446 // a 'part of' directive. 4445 }
4447 if (CurrentToken() == Token::kPART) { 4446 ConsumeToken();
4447 if (!IsLiteral("of")) {
4448 ErrorMsg("'part of' expected");
4449 }
4450 ConsumeToken();
4451 // The VM is not required to check that the library name matches the
4452 // name of the current library, so we ignore it.
4453 ExpectIdentifier("library name expected");
4454 while (CurrentToken() == Token::kPERIOD) {
4448 ConsumeToken(); 4455 ConsumeToken();
4449 if (!IsLiteral("of")) { 4456 ExpectIdentifier("malformed library name");
4450 ErrorMsg("'part of' expected");
4451 }
4452 ConsumeToken();
4453 // The VM is not required to check that the library name matches the
4454 // name of the current library, so we ignore it.
4455 ExpectIdentifier("library name expected");
4456 while (CurrentToken() == Token::kPERIOD) {
4457 ConsumeToken();
4458 ExpectIdentifier("malformed library name");
4459 }
4460 ExpectSemicolon();
4461 } else {
4462 SetPosition(metadata_pos);
4463 } 4457 }
4458 ExpectSemicolon();
4464 } 4459 }
4465 4460
4466 4461
4467 void Parser::ParseTopLevel() { 4462 void Parser::ParseTopLevel() {
4468 TRACE_PARSER("ParseTopLevel"); 4463 TRACE_PARSER("ParseTopLevel");
4469 // Collect the classes found at the top level in this growable array. 4464 // Collect the classes found at the top level in this growable array.
4470 // They need to be registered with class finalization after parsing 4465 // They need to be registered with class finalization after parsing
4471 // has been completed. 4466 // has been completed.
4472 Isolate* isolate = Isolate::Current(); 4467 Isolate* isolate = Isolate::Current();
4473 ObjectStore* object_store = isolate->object_store(); 4468 ObjectStore* object_store = isolate->object_store();
(...skipping 5484 matching lines...) Expand 10 before | Expand all | Expand 10 after
9958 void Parser::SkipQualIdent() { 9953 void Parser::SkipQualIdent() {
9959 ASSERT(IsIdentifier()); 9954 ASSERT(IsIdentifier());
9960 ConsumeToken(); 9955 ConsumeToken();
9961 if (CurrentToken() == Token::kPERIOD) { 9956 if (CurrentToken() == Token::kPERIOD) {
9962 ConsumeToken(); // Consume the kPERIOD token. 9957 ConsumeToken(); // Consume the kPERIOD token.
9963 ExpectIdentifier("identifier expected after '.'"); 9958 ExpectIdentifier("identifier expected after '.'");
9964 } 9959 }
9965 } 9960 }
9966 9961
9967 } // namespace dart 9962 } // namespace dart
OLDNEW
« no previous file with comments | « runtime/vm/object_test.cc ('k') | runtime/vm/parser_test.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698