| OLD | NEW |
| 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 <stdio.h> | 5 #include <stdio.h> |
| 6 | 6 |
| 7 #include "vm/unit_test.h" | 7 #include "vm/unit_test.h" |
| 8 | 8 |
| 9 #include "bin/builtin.h" | 9 #include "bin/builtin.h" |
| 10 #include "bin/dartutils.h" | 10 #include "bin/dartutils.h" |
| (...skipping 73 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 84 } else if (DartUtils::IsDartUtfLibURL(url_chars)) { | 84 } else if (DartUtils::IsDartUtfLibURL(url_chars)) { |
| 85 return Builtin::LoadLibrary(Builtin::kUtfLibrary); | 85 return Builtin::LoadLibrary(Builtin::kUtfLibrary); |
| 86 } else if (DartUtils::IsDartCryptoLibURL(url_chars)) { | 86 } else if (DartUtils::IsDartCryptoLibURL(url_chars)) { |
| 87 return Builtin::LoadLibrary(Builtin::kCryptoLibrary); | 87 return Builtin::LoadLibrary(Builtin::kCryptoLibrary); |
| 88 } else if (DartUtils::IsDartWebLibURL(url_chars)) { | 88 } else if (DartUtils::IsDartWebLibURL(url_chars)) { |
| 89 return Builtin::LoadLibrary(Builtin::kWebLibrary); | 89 return Builtin::LoadLibrary(Builtin::kWebLibrary); |
| 90 } else { | 90 } else { |
| 91 return Dart_Error("Do not know how to load '%s'", url_chars); | 91 return Dart_Error("Do not know how to load '%s'", url_chars); |
| 92 } | 92 } |
| 93 } | 93 } |
| 94 result = DartUtils::LoadSource(NULL, | 94 return DartUtils::LoadSource(NULL, |
| 95 library, | 95 library, |
| 96 url, | 96 url, |
| 97 tag, | 97 tag, |
| 98 url_chars); | 98 url_chars); |
| 99 if (!Dart_IsError(result) && (tag == kImportTag)) { | |
| 100 Builtin::ImportLibrary(result, Builtin::kBuiltinLibrary); | |
| 101 } | |
| 102 return result; | |
| 103 } | 99 } |
| 104 | 100 |
| 105 | 101 |
| 106 Dart_Handle TestCase::LoadTestScript(const char* script, | 102 Dart_Handle TestCase::LoadTestScript(const char* script, |
| 107 Dart_NativeEntryResolver resolver, | 103 Dart_NativeEntryResolver resolver, |
| 108 Dart_Handle import_map) { | 104 Dart_Handle import_map) { |
| 109 Dart_Handle url = Dart_NewString(TestCase::url()); | 105 Dart_Handle url = Dart_NewString(TestCase::url()); |
| 110 Dart_Handle source = Dart_NewString(script); | 106 Dart_Handle source = Dart_NewString(script); |
| 111 Dart_Handle result = Dart_SetLibraryTagHandler(LibraryTagHandler); | 107 Dart_Handle result = Dart_SetLibraryTagHandler(LibraryTagHandler); |
| 112 EXPECT_VALID(result); | 108 EXPECT_VALID(result); |
| (...skipping 109 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 222 | 218 |
| 223 bool CompilerTest::TestCompileFunction(const Function& function) { | 219 bool CompilerTest::TestCompileFunction(const Function& function) { |
| 224 Isolate* isolate = Isolate::Current(); | 220 Isolate* isolate = Isolate::Current(); |
| 225 ASSERT(isolate != NULL); | 221 ASSERT(isolate != NULL); |
| 226 ASSERT(ClassFinalizer::AllClassesFinalized()); | 222 ASSERT(ClassFinalizer::AllClassesFinalized()); |
| 227 const Error& error = Error::Handle(Compiler::CompileFunction(function)); | 223 const Error& error = Error::Handle(Compiler::CompileFunction(function)); |
| 228 return error.IsNull(); | 224 return error.IsNull(); |
| 229 } | 225 } |
| 230 | 226 |
| 231 } // namespace dart | 227 } // namespace dart |
| OLD | NEW |