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

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

Issue 10868043: Move print to corelib. (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: Make it pass all tests. Created 8 years, 3 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
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 7684 matching lines...) Expand 10 before | Expand all | Expand 10 after
7695 // of the current library, but is defined in more than one imported 7695 // of the current library, but is defined in more than one imported
7696 // library, i.e. if the name cannot be resolved unambiguously. 7696 // library, i.e. if the name cannot be resolved unambiguously.
7697 RawObject* Parser::ResolveNameInCurrentLibraryScope(intptr_t ident_pos, 7697 RawObject* Parser::ResolveNameInCurrentLibraryScope(intptr_t ident_pos,
7698 const String& name) { 7698 const String& name) {
7699 TRACE_PARSER("ResolveNameInCurrentLibraryScope"); 7699 TRACE_PARSER("ResolveNameInCurrentLibraryScope");
7700 Object& obj = Object::Handle(LookupNameInLibrary(library_, name)); 7700 Object& obj = Object::Handle(LookupNameInLibrary(library_, name));
7701 if (obj.IsNull()) { 7701 if (obj.IsNull()) {
7702 // Name is not found in current library. Check scope of all 7702 // Name is not found in current library. Check scope of all
7703 // imported libraries. 7703 // imported libraries.
7704 String& first_lib_url = String::Handle(); 7704 String& first_lib_url = String::Handle();
7705 String& current_lib_url = String::Handle();
7705 Library& lib = Library::Handle(); 7706 Library& lib = Library::Handle();
7706 intptr_t num_imports = library_.num_imports(); 7707 intptr_t num_imports = library_.num_imports();
7707 Object& resolved_obj = Object::Handle(); 7708 Object& resolved_obj = Object::Handle();
7708 for (int i = 0; i < num_imports; i++) { 7709 for (int i = 0; i < num_imports; i++) {
7709 lib ^= library_.ImportAt(i); 7710 lib ^= library_.ImportAt(i);
7710 resolved_obj = LookupNameInLibrary(lib, name); 7711 resolved_obj = LookupNameInLibrary(lib, name);
7711 if (!resolved_obj.IsNull()) { 7712 if (!resolved_obj.IsNull()) {
7712 if (!first_lib_url.IsNull()) { 7713 current_lib_url = lib.url();
7714 if (first_lib_url.IsNull()) {
7715 first_lib_url = lib.url();
7716 obj = resolved_obj.raw();
7717 } else if (!first_lib_url.Equals(current_lib_url)) {
7713 // Found duplicate definition. 7718 // Found duplicate definition.
7714 ErrorMsg(ident_pos, 7719 ErrorMsg(ident_pos,
7715 "ambiguous reference: " 7720 "ambiguous reference: "
7716 "'%s' is defined in library '%s' and also in '%s'", 7721 "'%s' is defined in library '%s' and also in '%s'",
7717 name.ToCString(), 7722 name.ToCString(),
7718 first_lib_url.ToCString(), 7723 first_lib_url.ToCString(),
7719 String::Handle(lib.url()).ToCString()); 7724 String::Handle(lib.url()).ToCString());
7720 } else {
7721 first_lib_url = lib.url();
7722 obj = resolved_obj.raw();
7723 } 7725 }
7724 } 7726 }
7725 } 7727 }
7726 } 7728 }
7727 return obj.raw(); 7729 return obj.raw();
7728 } 7730 }
7729 7731
7730 7732
7731 RawClass* Parser::ResolveClassInCurrentLibraryScope(intptr_t ident_pos, 7733 RawClass* Parser::ResolveClassInCurrentLibraryScope(intptr_t ident_pos,
7732 const String& name) { 7734 const String& name) {
(...skipping 1507 matching lines...) Expand 10 before | Expand all | Expand 10 after
9240 void Parser::SkipQualIdent() { 9242 void Parser::SkipQualIdent() {
9241 ASSERT(IsIdentifier()); 9243 ASSERT(IsIdentifier());
9242 ConsumeToken(); 9244 ConsumeToken();
9243 if (CurrentToken() == Token::kPERIOD) { 9245 if (CurrentToken() == Token::kPERIOD) {
9244 ConsumeToken(); // Consume the kPERIOD token. 9246 ConsumeToken(); // Consume the kPERIOD token.
9245 ExpectIdentifier("identifier expected after '.'"); 9247 ExpectIdentifier("identifier expected after '.'");
9246 } 9248 }
9247 } 9249 }
9248 9250
9249 } // namespace dart 9251 } // namespace dart
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698