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

Side by Side Diff: runtime/bin/dartutils.cc

Issue 12036089: Fix issue 8094: (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 | « no previous file | tests/language/language.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 "bin/dartutils.h" 5 #include "bin/dartutils.h"
6 6
7 #include "bin/extensions.h" 7 #include "bin/extensions.h"
8 #include "bin/directory.h" 8 #include "bin/directory.h"
9 #include "bin/file.h" 9 #include "bin/file.h"
10 #include "bin/io_buffer.h" 10 #include "bin/io_buffer.h"
(...skipping 288 matching lines...) Expand 10 before | Expand all | Expand 10 after
299 // Resolve the url within the context of the library's URL. 299 // Resolve the url within the context of the library's URL.
300 Dart_Handle builtin_lib = 300 Dart_Handle builtin_lib =
301 Builtin::LoadAndCheckLibrary(Builtin::kBuiltinLibrary); 301 Builtin::LoadAndCheckLibrary(Builtin::kBuiltinLibrary);
302 Dart_Handle library_url = Dart_LibraryUrl(library); 302 Dart_Handle library_url = Dart_LibraryUrl(library);
303 if (Dart_IsError(library_url)) { 303 if (Dart_IsError(library_url)) {
304 return library_url; 304 return library_url;
305 } 305 }
306 return ResolveUri(library_url, url, builtin_lib); 306 return ResolveUri(library_url, url, builtin_lib);
307 } 307 }
308 if (is_dart_scheme_url) { 308 if (is_dart_scheme_url) {
309 ASSERT(tag == kImportTag); 309 if (tag == kImportTag) {
310 // Handle imports of other built-in libraries present in the SDK. 310 // Handle imports of other built-in libraries present in the SDK.
311 Builtin::BuiltinLibraryId id; 311 Builtin::BuiltinLibraryId id;
312 if (DartUtils::IsDartCryptoLibURL(url_string)) { 312 if (DartUtils::IsDartCryptoLibURL(url_string)) {
313 id = Builtin::kCryptoLibrary; 313 id = Builtin::kCryptoLibrary;
314 } else if (DartUtils::IsDartIOLibURL(url_string)) { 314 } else if (DartUtils::IsDartIOLibURL(url_string)) {
315 id = Builtin::kIOLibrary; 315 id = Builtin::kIOLibrary;
316 } else if (DartUtils::IsDartJsonLibURL(url_string)) { 316 } else if (DartUtils::IsDartJsonLibURL(url_string)) {
317 id = Builtin::kJsonLibrary; 317 id = Builtin::kJsonLibrary;
318 } else if (DartUtils::IsDartUriLibURL(url_string)) { 318 } else if (DartUtils::IsDartUriLibURL(url_string)) {
319 id = Builtin::kUriLibrary; 319 id = Builtin::kUriLibrary;
320 } else if (DartUtils::IsDartUtfLibURL(url_string)) { 320 } else if (DartUtils::IsDartUtfLibURL(url_string)) {
321 id = Builtin::kUtfLibrary; 321 id = Builtin::kUtfLibrary;
322 } else {
323 return Dart_Error("Do not know how to load '%s'", url_string);
324 }
325 return Builtin::LoadAndCheckLibrary(id);
322 } else { 326 } else {
323 return Dart_Error("Do not know how to load '%s'", url_string); 327 ASSERT(tag == kSourceTag);
328 return Dart_Error("Unable to load source '%s' ", url_string);
324 } 329 }
325 return Builtin::LoadAndCheckLibrary(id);
326 } else { 330 } else {
327 // Get the file path out of the url. 331 // Get the file path out of the url.
328 Dart_Handle builtin_lib = 332 Dart_Handle builtin_lib =
329 Builtin::LoadAndCheckLibrary(Builtin::kBuiltinLibrary); 333 Builtin::LoadAndCheckLibrary(Builtin::kBuiltinLibrary);
330 Dart_Handle file_path = FilePathFromUri(url, builtin_lib); 334 Dart_Handle file_path = FilePathFromUri(url, builtin_lib);
331 if (Dart_IsError(file_path)) { 335 if (Dart_IsError(file_path)) {
332 return file_path; 336 return file_path;
333 } 337 }
334 Dart_StringToCString(file_path, &url_string); 338 Dart_StringToCString(file_path, &url_string);
335 } 339 }
(...skipping 377 matching lines...) Expand 10 before | Expand all | Expand 10 after
713 717
714 CObject* CObject::NewOSError(OSError* os_error) { 718 CObject* CObject::NewOSError(OSError* os_error) {
715 CObject* error_message = 719 CObject* error_message =
716 new CObjectString(CObject::NewString(os_error->message())); 720 new CObjectString(CObject::NewString(os_error->message()));
717 CObjectArray* result = new CObjectArray(CObject::NewArray(3)); 721 CObjectArray* result = new CObjectArray(CObject::NewArray(3));
718 result->SetAt(0, new CObjectInt32(CObject::NewInt32(kOSError))); 722 result->SetAt(0, new CObjectInt32(CObject::NewInt32(kOSError)));
719 result->SetAt(1, new CObjectInt32(CObject::NewInt32(os_error->code()))); 723 result->SetAt(1, new CObjectInt32(CObject::NewInt32(os_error->code())));
720 result->SetAt(2, error_message); 724 result->SetAt(2, error_message);
721 return result; 725 return result;
722 } 726 }
OLDNEW
« no previous file with comments | « no previous file | tests/language/language.status » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698