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

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

Issue 1131793012: Ensure libraries always have at least one top-level class and therefore at least one script. (Closed) Base URL: git@github.com:dart-lang/sdk.git@master
Patch Set: Created 5 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
« no previous file with comments | « runtime/vm/object.cc ('k') | tests/lib/lib.status » ('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 "platform/utils.h" 8 #include "platform/utils.h"
9 #include "vm/ast_transformer.h" 9 #include "vm/ast_transformer.h"
10 #include "vm/bootstrap.h" 10 #include "vm/bootstrap.h"
(...skipping 5952 matching lines...) Expand 10 before | Expand all | Expand 10 after
5963 ParseTopLevelFunction(&top_level, metadata_pos); 5963 ParseTopLevelFunction(&top_level, metadata_pos);
5964 } else if (IsTopLevelAccessor()) { 5964 } else if (IsTopLevelAccessor()) {
5965 ParseTopLevelAccessor(&top_level, metadata_pos); 5965 ParseTopLevelAccessor(&top_level, metadata_pos);
5966 } else if (CurrentToken() == Token::kEOS) { 5966 } else if (CurrentToken() == Token::kEOS) {
5967 break; 5967 break;
5968 } else { 5968 } else {
5969 UnexpectedToken(); 5969 UnexpectedToken();
5970 } 5970 }
5971 } 5971 }
5972 } 5972 }
5973 if ((top_level.fields.Length() > 0) || (top_level.functions.Length() > 0)) {
5974 toplevel_class.AddFields(top_level.fields);
5975 5973
5976 const Array& array = Array::Handle(Z, 5974 toplevel_class.AddFields(top_level.fields);
5977 Array::MakeArray(top_level.functions));
5978 toplevel_class.SetFunctions(array);
5979 5975
5980 library_.AddAnonymousClass(toplevel_class); 5976 const Array& array = Array::Handle(Z, Array::MakeArray(top_level.functions));
5981 pending_classes.Add(toplevel_class, Heap::kOld); 5977 toplevel_class.SetFunctions(array);
5982 } 5978
5979 library_.AddAnonymousClass(toplevel_class);
hausner 2015/05/19 05:43:03 A library with 100 part files will now have 100 to
rmacnak 2015/05/19 15:57:41 Done.
5980 pending_classes.Add(toplevel_class, Heap::kOld);
5983 } 5981 }
5984 5982
5985 5983
5986 void Parser::ChainNewBlock(LocalScope* outer_scope) { 5984 void Parser::ChainNewBlock(LocalScope* outer_scope) {
5987 Block* block = new(Z) Block( 5985 Block* block = new(Z) Block(
5988 current_block_, 5986 current_block_,
5989 outer_scope, 5987 outer_scope,
5990 new(Z) SequenceNode(TokenPos(), outer_scope)); 5988 new(Z) SequenceNode(TokenPos(), outer_scope));
5991 current_block_ = block; 5989 current_block_ = block;
5992 } 5990 }
(...skipping 7482 matching lines...) Expand 10 before | Expand all | Expand 10 after
13475 void Parser::SkipQualIdent() { 13473 void Parser::SkipQualIdent() {
13476 ASSERT(IsIdentifier()); 13474 ASSERT(IsIdentifier());
13477 ConsumeToken(); 13475 ConsumeToken();
13478 if (CurrentToken() == Token::kPERIOD) { 13476 if (CurrentToken() == Token::kPERIOD) {
13479 ConsumeToken(); // Consume the kPERIOD token. 13477 ConsumeToken(); // Consume the kPERIOD token.
13480 ExpectIdentifier("identifier expected after '.'"); 13478 ExpectIdentifier("identifier expected after '.'");
13481 } 13479 }
13482 } 13480 }
13483 13481
13484 } // namespace dart 13482 } // namespace dart
OLDNEW
« no previous file with comments | « runtime/vm/object.cc ('k') | tests/lib/lib.status » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698