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 "vm/unit_test.h" | 5 #include "vm/unit_test.h" |
6 | 6 |
7 #include <stdio.h> | 7 #include <stdio.h> |
8 | 8 |
9 #include "bin/builtin.h" | 9 #include "bin/builtin.h" |
10 #include "bin/dartutils.h" | 10 #include "bin/dartutils.h" |
(...skipping 94 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
105 url, | 105 url, |
106 Builtin::PartSource(Builtin::kIOLibrary, | 106 Builtin::PartSource(Builtin::kIOLibrary, |
107 url_chars)); | 107 url_chars)); |
108 } | 108 } |
109 return DartUtils::LoadSource(library, url, tag, url_chars); | 109 return DartUtils::LoadSource(library, url, tag, url_chars); |
110 } | 110 } |
111 | 111 |
112 | 112 |
113 Dart_Handle TestCase::LoadTestScript(const char* script, | 113 Dart_Handle TestCase::LoadTestScript(const char* script, |
114 Dart_NativeEntryResolver resolver, | 114 Dart_NativeEntryResolver resolver, |
115 const char* lib_url) { | 115 const char* lib_url, |
| 116 bool finalize_classes) { |
116 Dart_Handle url = NewString(lib_url); | 117 Dart_Handle url = NewString(lib_url); |
117 Dart_Handle source = NewString(script); | 118 Dart_Handle source = NewString(script); |
118 Dart_Handle result = Dart_SetLibraryTagHandler(LibraryTagHandler); | 119 Dart_Handle result = Dart_SetLibraryTagHandler(LibraryTagHandler); |
119 EXPECT_VALID(result); | 120 EXPECT_VALID(result); |
120 EXPECT_VALID(result); | |
121 Dart_Handle lib = Dart_LoadScript(url, source, 0, 0); | 121 Dart_Handle lib = Dart_LoadScript(url, source, 0, 0); |
122 DART_CHECK_VALID(lib); | 122 DART_CHECK_VALID(lib); |
123 result = Dart_SetNativeResolver(lib, resolver, NULL); | 123 result = Dart_SetNativeResolver(lib, resolver, NULL); |
124 DART_CHECK_VALID(result); | 124 DART_CHECK_VALID(result); |
| 125 if (finalize_classes) { |
| 126 result = Dart_FinalizeLoading(false); |
| 127 DART_CHECK_VALID(result); |
| 128 } |
125 return lib; | 129 return lib; |
126 } | 130 } |
127 | 131 |
128 | 132 |
129 Dart_Handle TestCase::LoadCoreTestScript(const char* script, | 133 Dart_Handle TestCase::LoadCoreTestScript(const char* script, |
130 Dart_NativeEntryResolver resolver) { | 134 Dart_NativeEntryResolver resolver) { |
131 return LoadTestScript(script, resolver, CORELIB_TEST_URI); | 135 return LoadTestScript(script, resolver, CORELIB_TEST_URI); |
132 } | 136 } |
133 | 137 |
134 | 138 |
(...skipping 107 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
242 Isolate* isolate = Isolate::Current(); | 246 Isolate* isolate = Isolate::Current(); |
243 ASSERT(isolate != NULL); | 247 ASSERT(isolate != NULL); |
244 ASSERT(ClassFinalizer::AllClassesFinalized()); | 248 ASSERT(ClassFinalizer::AllClassesFinalized()); |
245 const Error& error = Error::Handle(Compiler::CompileFunction(isolate, | 249 const Error& error = Error::Handle(Compiler::CompileFunction(isolate, |
246 function)); | 250 function)); |
247 return error.IsNull(); | 251 return error.IsNull(); |
248 } | 252 } |
249 | 253 |
250 | 254 |
251 } // namespace dart | 255 } // namespace dart |
OLD | NEW |