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

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

Issue 1261673004: Non-tree-shaking --precompile. (Closed) Base URL: git@github.com:dart-lang/sdk.git@master
Patch Set: Created 5 years, 4 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') | runtime/vm/precompiler.h » ('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 1041 matching lines...) Expand 10 before | Expand all | Expand 10 after
1052 intptr_t expr_pos = TokenPos(); 1052 intptr_t expr_pos = TokenPos();
1053 AstNode* expr = ParseExpr(kAllowConst, kConsumeCascades); 1053 AstNode* expr = ParseExpr(kAllowConst, kConsumeCascades);
1054 ReturnNode* ret = new(Z) ReturnNode(expr_pos, expr); 1054 ReturnNode* ret = new(Z) ReturnNode(expr_pos, expr);
1055 current_block_->statements->Add(ret); 1055 current_block_->statements->Add(ret);
1056 return CloseBlock(); 1056 return CloseBlock();
1057 } 1057 }
1058 1058
1059 1059
1060 ParsedFunction* Parser::ParseStaticFieldInitializer(const Field& field) { 1060 ParsedFunction* Parser::ParseStaticFieldInitializer(const Field& field) {
1061 ASSERT(field.is_static()); 1061 ASSERT(field.is_static());
1062 ASSERT(field.value() == Object::transition_sentinel().raw());
1063 Thread* thread = Thread::Current(); 1062 Thread* thread = Thread::Current();
1064 // TODO(koda): Should there be a StackZone here? 1063 // TODO(koda): Should there be a StackZone here?
1065 Zone* zone = thread->zone(); 1064 Zone* zone = thread->zone();
1066 1065
1067 const Class& script_cls = Class::Handle(zone, field.origin()); 1066 const Class& script_cls = Class::Handle(zone, field.origin());
1068 const Script& script = Script::Handle(zone, script_cls.script()); 1067 const Script& script = Script::Handle(zone, script_cls.script());
1069 1068
1070 const String& field_name = String::Handle(zone, field.name()); 1069 const String& field_name = String::Handle(zone, field.name());
1071 String& init_name = String::Handle(zone, 1070 String& init_name = String::Handle(zone,
1072 String::Concat(Symbols::InitPrefix(), field_name)); 1071 String::Concat(Symbols::InitPrefix(), field_name));
(...skipping 4229 matching lines...) Expand 10 before | Expand all | Expand 10 after
5302 } 5301 }
5303 if (CurrentToken() == Token::kASSIGN) { 5302 if (CurrentToken() == Token::kASSIGN) {
5304 ConsumeToken(); 5303 ConsumeToken();
5305 Instance& field_value = Instance::Handle(Z, Object::sentinel().raw()); 5304 Instance& field_value = Instance::Handle(Z, Object::sentinel().raw());
5306 bool has_simple_literal = false; 5305 bool has_simple_literal = false;
5307 if (LookaheadToken(1) == Token::kSEMICOLON) { 5306 if (LookaheadToken(1) == Token::kSEMICOLON) {
5308 has_simple_literal = IsSimpleLiteral(type, &field_value); 5307 has_simple_literal = IsSimpleLiteral(type, &field_value);
5309 } 5308 }
5310 SkipExpr(); 5309 SkipExpr();
5311 field.set_value(field_value); 5310 field.set_value(field_value);
5311 field.set_has_initializer(true);
5312
5312 if (!has_simple_literal) { 5313 if (!has_simple_literal) {
5313 // Create a static final getter. 5314 // Create a static final getter.
5314 String& getter_name = String::Handle(Z, Field::GetterSymbol(var_name)); 5315 String& getter_name = String::Handle(Z, Field::GetterSymbol(var_name));
5315 getter = Function::New(getter_name, 5316 getter = Function::New(getter_name,
5316 RawFunction::kImplicitStaticFinalGetter, 5317 RawFunction::kImplicitStaticFinalGetter,
5317 is_static, 5318 is_static,
5318 is_const, 5319 is_const,
5319 /* is_abstract = */ false, 5320 /* is_abstract = */ false,
5320 /* is_external = */ false, 5321 /* is_external = */ false,
5321 /* is_native = */ false, 5322 /* is_native = */ false,
(...skipping 8489 matching lines...) Expand 10 before | Expand all | Expand 10 after
13811 void Parser::SkipQualIdent() { 13812 void Parser::SkipQualIdent() {
13812 ASSERT(IsIdentifier()); 13813 ASSERT(IsIdentifier());
13813 ConsumeToken(); 13814 ConsumeToken();
13814 if (CurrentToken() == Token::kPERIOD) { 13815 if (CurrentToken() == Token::kPERIOD) {
13815 ConsumeToken(); // Consume the kPERIOD token. 13816 ConsumeToken(); // Consume the kPERIOD token.
13816 ExpectIdentifier("identifier expected after '.'"); 13817 ExpectIdentifier("identifier expected after '.'");
13817 } 13818 }
13818 } 13819 }
13819 13820
13820 } // namespace dart 13821 } // namespace dart
OLDNEW
« no previous file with comments | « runtime/vm/object.cc ('k') | runtime/vm/precompiler.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698