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

Side by Side Diff: vm/object.cc

Issue 9359009: Implement support for specifying string interopolation style variable substitution in the import ... (Closed) Base URL: http://dart.googlecode.com/svn/branches/bleeding_edge/dart/runtime/
Patch Set: '' Created 8 years, 10 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 | « vm/object.h ('k') | vm/parser.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/object.h" 5 #include "vm/object.h"
6 6
7 #include "platform/assert.h" 7 #include "platform/assert.h"
8 #include "vm/assembler.h" 8 #include "vm/assembler.h"
9 #include "vm/bigint_operations.h" 9 #include "vm/bigint_operations.h"
10 #include "vm/bootstrap.h" 10 #include "vm/bootstrap.h"
(...skipping 3982 matching lines...) Expand 10 before | Expand all | Expand 10 after
3993 3993
3994 void ClassDictionaryIterator::MoveToNextClass() { 3994 void ClassDictionaryIterator::MoveToNextClass() {
3995 Object& obj = Object::Handle(array_.At(next_ix_)); 3995 Object& obj = Object::Handle(array_.At(next_ix_));
3996 while (!obj.IsClass() && HasNext()) { 3996 while (!obj.IsClass() && HasNext()) {
3997 next_ix_++; 3997 next_ix_++;
3998 obj = array_.At(next_ix_); 3998 obj = array_.At(next_ix_);
3999 } 3999 }
4000 } 4000 }
4001 4001
4002 4002
4003 void Library::set_import_map(const Array& map) const {
4004 StorePointer(&raw_ptr()->import_map_, map.raw());
4005 }
4006
4007
4003 void Library::SetName(const String& name) const { 4008 void Library::SetName(const String& name) const {
4004 // Only set name once. 4009 // Only set name once.
4005 ASSERT(!Loaded()); 4010 ASSERT(!Loaded());
4006 ASSERT(name.IsSymbol()); 4011 ASSERT(name.IsSymbol());
4007 StorePointer(&raw_ptr()->name_, name.raw()); 4012 StorePointer(&raw_ptr()->name_, name.raw());
4008 } 4013 }
4009 4014
4010 4015
4011 void Library::SetLoadInProgress() const { 4016 void Library::SetLoadInProgress() const {
4012 // Should not be already loaded. 4017 // Should not be already loaded.
(...skipping 449 matching lines...) Expand 10 before | Expand all | Expand 10 after
4462 lib ^= imports.At(i); 4467 lib ^= imports.At(i);
4463 import_url = lib.url(); 4468 import_url = lib.url();
4464 if (url.Equals(import_url)) { 4469 if (url.Equals(import_url)) {
4465 return lib.raw(); 4470 return lib.raw();
4466 } 4471 }
4467 } 4472 }
4468 return Library::null(); 4473 return Library::null();
4469 } 4474 }
4470 4475
4471 4476
4477 RawString* Library::LookupImportMap(const String& ident) const {
4478 Array& import_map = Array::Handle(this->import_map());
4479 intptr_t length = import_map.Length();
4480 intptr_t index = 0;
4481 String& name = String::Handle();
4482 while (index < (length - 1)) {
4483 name ^= import_map.At(index);
4484 if (name.Equals(ident)) {
4485 name ^= import_map.At(index + 1);
4486 return name.raw();
4487 }
4488 index += 2;
4489 }
4490 return String::null();
4491 }
4492
4493
4472 void Library::AddImport(const Library& library) const { 4494 void Library::AddImport(const Library& library) const {
4473 Array& imports = Array::Handle(this->imports()); 4495 Array& imports = Array::Handle(this->imports());
4474 intptr_t capacity = imports.Length(); 4496 intptr_t capacity = imports.Length();
4475 if (num_imports() == capacity) { 4497 if (num_imports() == capacity) {
4476 capacity = capacity + kImportsCapacityIncrement; 4498 capacity = capacity + kImportsCapacityIncrement;
4477 imports = Array::Grow(imports, capacity); 4499 imports = Array::Grow(imports, capacity);
4478 StorePointer(&raw_ptr()->imports_, imports.raw()); 4500 StorePointer(&raw_ptr()->imports_, imports.raw());
4479 } 4501 }
4480 intptr_t index = num_imports(); 4502 intptr_t index = num_imports();
4481 imports.SetAt(index, library); 4503 imports.SetAt(index, library);
(...skipping 55 matching lines...) Expand 10 before | Expand all | Expand 10 after
4537 4559
4538 RawLibrary* Library::NewLibraryHelper(const String& url, 4560 RawLibrary* Library::NewLibraryHelper(const String& url,
4539 bool import_core_lib) { 4561 bool import_core_lib) {
4540 const Library& result = Library::Handle(Library::New()); 4562 const Library& result = Library::Handle(Library::New());
4541 result.raw_ptr()->name_ = url.raw(); 4563 result.raw_ptr()->name_ = url.raw();
4542 result.raw_ptr()->url_ = url.raw(); 4564 result.raw_ptr()->url_ = url.raw();
4543 result.raw_ptr()->private_key_ = Scanner::AllocatePrivateKey(result); 4565 result.raw_ptr()->private_key_ = Scanner::AllocatePrivateKey(result);
4544 result.raw_ptr()->dictionary_ = Array::Empty(); 4566 result.raw_ptr()->dictionary_ = Array::Empty();
4545 result.raw_ptr()->anonymous_classes_ = Array::Empty(); 4567 result.raw_ptr()->anonymous_classes_ = Array::Empty();
4546 result.raw_ptr()->num_anonymous_ = 0; 4568 result.raw_ptr()->num_anonymous_ = 0;
4569 result.raw_ptr()->import_map_ = Array::Empty();
4547 result.raw_ptr()->imports_ = Array::Empty(); 4570 result.raw_ptr()->imports_ = Array::Empty();
4548 result.raw_ptr()->next_registered_ = Library::null(); 4571 result.raw_ptr()->next_registered_ = Library::null();
4549 result.raw_ptr()->loaded_scripts_ = Array::null(); 4572 result.raw_ptr()->loaded_scripts_ = Array::null();
4550 result.set_native_entry_resolver(NULL); 4573 result.set_native_entry_resolver(NULL);
4551 result.raw_ptr()->corelib_imported_ = true; 4574 result.raw_ptr()->corelib_imported_ = true;
4552 result.raw_ptr()->load_state_ = RawLibrary::kAllocated; 4575 result.raw_ptr()->load_state_ = RawLibrary::kAllocated;
4553 result.InitClassDictionary(); 4576 result.InitClassDictionary();
4554 result.InitImportList(); 4577 result.InitImportList();
4555 result.InitImportedIntoList(); 4578 result.InitImportedIntoList();
4556 if (import_core_lib) { 4579 if (import_core_lib) {
(...skipping 3429 matching lines...) Expand 10 before | Expand all | Expand 10 after
7986 const String& str = String::Handle(pattern()); 8009 const String& str = String::Handle(pattern());
7987 const char* format = "JSRegExp: pattern=%s flags=%s"; 8010 const char* format = "JSRegExp: pattern=%s flags=%s";
7988 intptr_t len = OS::SNPrint(NULL, 0, format, str.ToCString(), Flags()); 8011 intptr_t len = OS::SNPrint(NULL, 0, format, str.ToCString(), Flags());
7989 char* chars = reinterpret_cast<char*>( 8012 char* chars = reinterpret_cast<char*>(
7990 Isolate::Current()->current_zone()->Allocate(len + 1)); 8013 Isolate::Current()->current_zone()->Allocate(len + 1));
7991 OS::SNPrint(chars, (len + 1), format, str.ToCString(), Flags()); 8014 OS::SNPrint(chars, (len + 1), format, str.ToCString(), Flags());
7992 return chars; 8015 return chars;
7993 } 8016 }
7994 8017
7995 } // namespace dart 8018 } // namespace dart
OLDNEW
« no previous file with comments | « vm/object.h ('k') | vm/parser.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698