Added ScriptData::HasError.

Review URL: http://codereview.chromium.org/542010


git-svn-id: http://v8.googlecode.com/svn/branches/bleeding_edge@3575 ce2b1a6d-e550-0410-aec6-3dcde31c8c00
parent 1705b1eb
......@@ -503,6 +503,7 @@ class V8EXPORT ScriptData { // NOLINT
virtual int Length() = 0;
virtual unsigned* Data() = 0;
virtual bool HasError() = 0;
};
......
......@@ -4711,6 +4711,11 @@ unsigned* ScriptDataImpl::Data() {
}
bool ScriptDataImpl::HasError() {
return has_error();
}
ScriptDataImpl* PreParse(Handle<String> source,
unibrow::CharacterStream* stream,
v8::Extension* extension) {
......
......@@ -91,6 +91,7 @@ class ScriptDataImpl : public ScriptData {
virtual ~ScriptDataImpl();
virtual int Length();
virtual unsigned* Data();
virtual bool HasError();
FunctionEntry GetFunctionEnd(int start);
bool SanityCheck();
......
......@@ -6742,6 +6742,27 @@ TEST(PreCompile) {
v8::ScriptData::PreCompile(script, i::StrLength(script));
CHECK_NE(sd->Length(), 0);
CHECK_NE(sd->Data(), NULL);
CHECK(!sd->HasError());
delete sd;
}
TEST(PreCompileWithError) {
v8::V8::Initialize();
const char *script = "function foo(a) { return 1 * * 2; }";
v8::ScriptData *sd =
v8::ScriptData::PreCompile(script, i::StrLength(script));
CHECK(sd->HasError());
delete sd;
}
TEST(Regress31661) {
v8::V8::Initialize();
const char *script = " The Definintive Guide";
v8::ScriptData *sd =
v8::ScriptData::PreCompile(script, i::StrLength(script));
CHECK(sd->HasError());
delete sd;
}
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment