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

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

Issue 11826024: Clean up uses of X::CheckedHandle where X::Cast or X::Handle is sufficient. (Closed) Base URL: http://dart.googlecode.com/svn/branches/bleeding_edge/dart/
Patch Set: Created 7 years, 11 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.cc ('k') | no next file » | 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 "vm/bigint_operations.h" 7 #include "vm/bigint_operations.h"
8 #include "vm/class_finalizer.h" 8 #include "vm/class_finalizer.h"
9 #include "vm/compiler.h" 9 #include "vm/compiler.h"
10 #include "vm/compiler_stats.h" 10 #include "vm/compiler_stats.h"
(...skipping 6339 matching lines...) Expand 10 before | Expand all | Expand 10 after
6350 } 6350 }
6351 6351
6352 6352
6353 RawString* Parser::FormatMessage(const Script& script, 6353 RawString* Parser::FormatMessage(const Script& script,
6354 intptr_t token_pos, 6354 intptr_t token_pos,
6355 const char* message_header, 6355 const char* message_header,
6356 const char* format, va_list args) { 6356 const char* format, va_list args) {
6357 String& result = String::Handle(); 6357 String& result = String::Handle();
6358 const String& msg = String::Handle(String::NewFormattedV(format, args)); 6358 const String& msg = String::Handle(String::NewFormattedV(format, args));
6359 if (!script.IsNull()) { 6359 if (!script.IsNull()) {
6360 const String& script_url = String::CheckedHandle(script.url()); 6360 const String& script_url = String::Handle(script.url());
6361 if (token_pos >= 0) { 6361 if (token_pos >= 0) {
6362 intptr_t line, column; 6362 intptr_t line, column;
6363 script.GetTokenLocation(token_pos, &line, &column); 6363 script.GetTokenLocation(token_pos, &line, &column);
6364 result = String::NewFormatted("'%s': %s: line %"Pd" pos %"Pd": ", 6364 result = String::NewFormatted("'%s': %s: line %"Pd" pos %"Pd": ",
6365 script_url.ToCString(), 6365 script_url.ToCString(),
6366 message_header, 6366 message_header,
6367 line, 6367 line,
6368 column); 6368 column);
6369 // Append the formatted error or warning message. 6369 // Append the formatted error or warning message.
6370 result = String::Concat(result, msg); 6370 result = String::Concat(result, msg);
(...skipping 1008 matching lines...) Expand 10 before | Expand all | Expand 10 after
7379 // Super field access handled in ParseSuperFieldAccess(), 7379 // Super field access handled in ParseSuperFieldAccess(),
7380 // super calls handled in ParseSuperCall(). 7380 // super calls handled in ParseSuperCall().
7381 ASSERT(!left->AsPrimaryNode()->IsSuper()); 7381 ASSERT(!left->AsPrimaryNode()->IsSuper());
7382 left = LoadFieldIfUnresolved(left); 7382 left = LoadFieldIfUnresolved(left);
7383 } 7383 }
7384 } 7384 }
7385 const intptr_t ident_pos = TokenPos(); 7385 const intptr_t ident_pos = TokenPos();
7386 String* ident = ExpectIdentifier("identifier expected"); 7386 String* ident = ExpectIdentifier("identifier expected");
7387 if (CurrentToken() == Token::kLPAREN) { 7387 if (CurrentToken() == Token::kLPAREN) {
7388 // Identifier followed by a opening paren: method call. 7388 // Identifier followed by a opening paren: method call.
7389 if (left->IsPrimaryNode() 7389 if (left->IsPrimaryNode() &&
7390 && left->AsPrimaryNode()->primary().IsClass()) { 7390 left->AsPrimaryNode()->primary().IsClass()) {
7391 // Static method call prefixed with class name. 7391 // Static method call prefixed with class name.
7392 Class& cls = Class::CheckedHandle( 7392 const Class& cls = Class::Cast(left->AsPrimaryNode()->primary());
7393 left->AsPrimaryNode()->primary().raw());
7394 selector = ParseStaticCall(cls, *ident, ident_pos); 7393 selector = ParseStaticCall(cls, *ident, ident_pos);
7395 } else { 7394 } else {
7396 selector = ParseInstanceCall(left, *ident); 7395 selector = ParseInstanceCall(left, *ident);
7397 } 7396 }
7398 } else { 7397 } else {
7399 // Field access. 7398 // Field access.
7400 Class& cls = Class::Handle(); 7399 Class& cls = Class::Handle();
7401 if (left->IsPrimaryNode()) { 7400 if (left->IsPrimaryNode()) {
7402 PrimaryNode* primary_node = left->AsPrimaryNode(); 7401 PrimaryNode* primary_node = left->AsPrimaryNode();
7403 if (primary_node->primary().IsClass()) { 7402 if (primary_node->primary().IsClass()) {
(...skipping 35 matching lines...) Expand 10 before | Expand all | Expand 10 after
7439 } 7438 }
7440 selector = new LoadIndexedNode(bracket_pos, 7439 selector = new LoadIndexedNode(bracket_pos,
7441 array, 7440 array,
7442 index, 7441 index,
7443 Class::ZoneHandle()); 7442 Class::ZoneHandle());
7444 } else if (CurrentToken() == Token::kLPAREN) { 7443 } else if (CurrentToken() == Token::kLPAREN) {
7445 if (left->IsPrimaryNode()) { 7444 if (left->IsPrimaryNode()) {
7446 PrimaryNode* primary = left->AsPrimaryNode(); 7445 PrimaryNode* primary = left->AsPrimaryNode();
7447 const intptr_t primary_pos = primary->token_pos(); 7446 const intptr_t primary_pos = primary->token_pos();
7448 if (primary->primary().IsFunction()) { 7447 if (primary->primary().IsFunction()) {
7449 Function& func = Function::CheckedHandle(primary->primary().raw()); 7448 const Function& func = Function::Cast(primary->primary());
7450 String& func_name = String::ZoneHandle(func.name()); 7449 const String& func_name = String::ZoneHandle(func.name());
7451 if (func.is_static()) { 7450 if (func.is_static()) {
7452 // Parse static function call. 7451 // Parse static function call.
7453 Class& cls = Class::Handle(func.Owner()); 7452 Class& cls = Class::Handle(func.Owner());
7454 selector = ParseStaticCall(cls, func_name, primary_pos); 7453 selector = ParseStaticCall(cls, func_name, primary_pos);
7455 } else { 7454 } else {
7456 // Dynamic function call on implicit "this" parameter. 7455 // Dynamic function call on implicit "this" parameter.
7457 if (current_function().is_static()) { 7456 if (current_function().is_static()) {
7458 ErrorMsg(primary_pos, 7457 ErrorMsg(primary_pos,
7459 "cannot access instance method '%s' " 7458 "cannot access instance method '%s' "
7460 "from static function", 7459 "from static function",
(...skipping 2246 matching lines...) Expand 10 before | Expand all | Expand 10 after
9707 void Parser::SkipQualIdent() { 9706 void Parser::SkipQualIdent() {
9708 ASSERT(IsIdentifier()); 9707 ASSERT(IsIdentifier());
9709 ConsumeToken(); 9708 ConsumeToken();
9710 if (CurrentToken() == Token::kPERIOD) { 9709 if (CurrentToken() == Token::kPERIOD) {
9711 ConsumeToken(); // Consume the kPERIOD token. 9710 ConsumeToken(); // Consume the kPERIOD token.
9712 ExpectIdentifier("identifier expected after '.'"); 9711 ExpectIdentifier("identifier expected after '.'");
9713 } 9712 }
9714 } 9713 }
9715 9714
9716 } // namespace dart 9715 } // namespace dart
OLDNEW
« no previous file with comments | « runtime/vm/object.cc ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698