Files
sdk/runtime/vm/bootstrap.cc
T
turnidge@google.com 0ddd4c04e9 Dart_PropagateError, take 2.
This change hopefully takes care of the non-mac build issues.  The
checked mode failures are fixed in a separate cl.
Review URL: https://chromiumcodereview.appspot.com//9316071

git-svn-id: https://dart.googlecode.com/svn/branches/bleeding_edge/dart@3863 260f80e4-7a28-3924-810f-c04153c831b5
2012-02-02 19:05:06 +00:00

56 lines
1.6 KiB
C++

// Copyright (c) 2011, the Dart project authors. Please see the AUTHORS file
// for details. All rights reserved. Use of this source code is governed by a
// BSD-style license that can be found in the LICENSE file.
#include "vm/bootstrap.h"
#include "include/dart_api.h"
#include "vm/compiler.h"
#include "vm/dart_api_impl.h"
#include "vm/object.h"
#include "vm/object_store.h"
namespace dart {
DEFINE_FLAG(bool, print_bootstrap, false, "Print the bootstrap source.");
RawScript* Bootstrap::LoadScript() {
const String& url = String::Handle(String::New("bootstrap", Heap::kOld));
const String& src = String::Handle(String::New(corelib_source_, Heap::kOld));
const Script& result =
Script::Handle(Script::New(url, src, RawScript::kSource));
return result.raw();
}
RawScript* Bootstrap::LoadImplScript() {
const String& url = String::Handle(String::New("bootstrap_impl",
Heap::kOld));
const String& src = String::Handle(String::New(corelib_impl_source_,
Heap::kOld));
const Script& result =
Script::Handle(Script::New(url, src, RawScript::kSource));
return result.raw();
}
RawError* Bootstrap::Compile(const Library& library, const Script& script) {
if (FLAG_print_bootstrap) {
OS::Print("Bootstrap source '%s':\n%s\n",
String::Handle(script.url()).ToCString(),
String::Handle(script.source()).ToCString());
}
library.SetLoadInProgress();
const Error& error = Error::Handle(Compiler::Compile(library, script));
if (error.IsNull()) {
library.SetLoaded();
}
return error.raw();
}
} // namespace dart