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

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

Issue 1135173008: Fix for bug 23484 (obscure error when a compilation error happens during Object::Init()) (Closed) Base URL: https://github.com/dart-lang/sdk.git@master
Patch Set: fix-comment Created 5 years, 7 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
« no previous file with comments | « no previous file | runtime/vm/dart_api_impl.cc » ('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/bootstrap.h" 5 #include "vm/bootstrap.h"
6 6
7 #include "include/dart_api.h" 7 #include "include/dart_api.h"
8 8
9 #include "vm/bootstrap_natives.h" 9 #include "vm/bootstrap_natives.h"
10 #include "vm/class_finalizer.h" 10 #include "vm/class_finalizer.h"
(...skipping 216 matching lines...) Expand 10 before | Expand all | Expand 10 after
227 String& source = String::Handle(isolate); 227 String& source = String::Handle(isolate);
228 Script& script = Script::Handle(isolate); 228 Script& script = Script::Handle(isolate);
229 Error& error = Error::Handle(isolate); 229 Error& error = Error::Handle(isolate);
230 const Array& strings = Array::Handle(isolate, Array::New(3)); 230 const Array& strings = Array::Handle(isolate, Array::New(3));
231 strings.SetAt(0, patch_uri); 231 strings.SetAt(0, patch_uri);
232 strings.SetAt(1, Symbols::Slash()); 232 strings.SetAt(1, Symbols::Slash());
233 for (intptr_t j = 0; patch_files[j] != NULL; j += 2) { 233 for (intptr_t j = 0; patch_files[j] != NULL; j += 2) {
234 patch_file_uri = String::New(patch_files[j]); 234 patch_file_uri = String::New(patch_files[j]);
235 source = GetLibrarySource(lib, patch_file_uri, true); 235 source = GetLibrarySource(lib, patch_file_uri, true);
236 if (source.IsNull()) { 236 if (source.IsNull()) {
237 return Api::UnwrapErrorHandle( 237 const String& message = String::Handle(
238 isolate, 238 String::NewFormatted("Unable to find dart patch source for %s",
239 Api::NewError("Unable to find dart patch source for %s", 239 patch_file_uri.ToCString()));
240 patch_file_uri.ToCString())).raw(); 240 return ApiError::New(message);
241 } 241 }
242 // Prepend the patch library URI to form a unique script URI for the patch. 242 // Prepend the patch library URI to form a unique script URI for the patch.
243 strings.SetAt(2, patch_file_uri); 243 strings.SetAt(2, patch_file_uri);
244 patch_file_uri = String::ConcatAll(strings); 244 patch_file_uri = String::ConcatAll(strings);
245 script = Script::New(patch_file_uri, source, RawScript::kPatchTag); 245 script = Script::New(patch_file_uri, source, RawScript::kPatchTag);
246 error = lib.Patch(script); 246 error = lib.Patch(script);
247 if (!error.IsNull()) { 247 if (!error.IsNull()) {
248 return error.raw(); 248 return error.raw();
249 } 249 }
250 } 250 }
(...skipping 34 matching lines...) Expand 10 before | Expand all | Expand 10 after
285 285
286 // Load, compile and patch bootstrap libraries. 286 // Load, compile and patch bootstrap libraries.
287 for (intptr_t i = 0; 287 for (intptr_t i = 0;
288 bootstrap_libraries[i].index_ != ObjectStore::kNone; 288 bootstrap_libraries[i].index_ != ObjectStore::kNone;
289 ++i) { 289 ++i) {
290 uri = Symbols::New(bootstrap_libraries[i].uri_); 290 uri = Symbols::New(bootstrap_libraries[i].uri_);
291 lib = Library::LookupLibrary(uri); 291 lib = Library::LookupLibrary(uri);
292 ASSERT(!lib.IsNull()); 292 ASSERT(!lib.IsNull());
293 source = GetLibrarySource(lib, uri, false); 293 source = GetLibrarySource(lib, uri, false);
294 if (source.IsNull()) { 294 if (source.IsNull()) {
295 error ^= Api::UnwrapErrorHandle( 295 const String& message = String::Handle(
296 isolate, Api::NewError("Unable to find dart source for %s", 296 String::NewFormatted("Unable to find dart source for %s",
297 uri.ToCString())).raw(); 297 uri.ToCString()));
298 error ^= ApiError::New(message);
298 break; 299 break;
299 } 300 }
300 script = Script::New(uri, source, RawScript::kLibraryTag); 301 script = Script::New(uri, source, RawScript::kLibraryTag);
301 error = Compile(lib, script); 302 error = Compile(lib, script);
302 if (!error.IsNull()) { 303 if (!error.IsNull()) {
303 break; 304 break;
304 } 305 }
305 // If a patch exists, load and patch the script. 306 // If a patch exists, load and patch the script.
306 if (bootstrap_libraries[i].patch_paths_ != NULL) { 307 if (bootstrap_libraries[i].patch_paths_ != NULL) {
307 patch_uri = Symbols::New(bootstrap_libraries[i].patch_uri_); 308 patch_uri = Symbols::New(bootstrap_libraries[i].patch_uri_);
(...skipping 20 matching lines...) Expand all
328 Compiler::CompileClass(cls); 329 Compiler::CompileClass(cls);
329 } 330 }
330 331
331 // Restore the library tag handler for the isolate. 332 // Restore the library tag handler for the isolate.
332 isolate->set_library_tag_handler(saved_tag_handler); 333 isolate->set_library_tag_handler(saved_tag_handler);
333 334
334 return error.raw(); 335 return error.raw();
335 } 336 }
336 337
337 } // namespace dart 338 } // namespace dart
OLDNEW
« no previous file with comments | « no previous file | runtime/vm/dart_api_impl.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698