Reviewers: Lasse Reichstein,
Message:
PTAL. What do you think about also changing the type of the parameter to
ParsingFlags, at the expense of having to cast OR'ed values?
Description:
Fix implicit conversions from bool to ParsingFlags.
Please review this at http://codereview.chromium.org/8463013/
SVN Base: https://v8.googlecode.com/svn/branches/bleeding_edge
Affected files:
M src/api.cc
M test/cctest/test-parsing.cc
Index: src/api.cc
diff --git a/src/api.cc b/src/api.cc
index
1ad70e8dbcba5c6943118a72807d52bc875660e6..73b4593ff6bc0547a74c4fa906a9a5da236c2d42
100644
--- a/src/api.cc
+++ b/src/api.cc
@@ -1413,7 +1413,8 @@ void ObjectTemplate::SetInternalFieldCount(int value)
{
ScriptData* ScriptData::PreCompile(const char* input, int length) {
i::Utf8ToUC16CharacterStream stream(
reinterpret_cast<const unsigned char*>(input), length);
- return i::ParserApi::PreParse(&stream, NULL, i::FLAG_harmony_scoping);
+ return i::ParserApi::PreParse(&stream, NULL, i::FLAG_harmony_scoping
+ ? i::kHarmonyScoping : i::kNoParsingFlags);
}
@@ -1422,10 +1423,12 @@ ScriptData*
ScriptData::PreCompile(v8::Handle<String> source) {
if (str->IsExternalTwoByteString()) {
i::ExternalTwoByteStringUC16CharacterStream stream(
i::Handle<i::ExternalTwoByteString>::cast(str), 0, str->length());
- return i::ParserApi::PreParse(&stream, NULL, i::FLAG_harmony_scoping);
+ return i::ParserApi::PreParse(&stream, NULL, i::FLAG_harmony_scoping
+ ? i::kHarmonyScoping :
i::kNoParsingFlags);
} else {
i::GenericStringUC16CharacterStream stream(str, 0, str->length());
- return i::ParserApi::PreParse(&stream, NULL, i::FLAG_harmony_scoping);
+ return i::ParserApi::PreParse(&stream, NULL, i::FLAG_harmony_scoping
+ ? i::kHarmonyScoping :
i::kNoParsingFlags);
}
}
Index: test/cctest/test-parsing.cc
diff --git a/test/cctest/test-parsing.cc b/test/cctest/test-parsing.cc
index
00d200a6c85a533b7119f61bdc56f7ea0292969c..c3dc47accce3c8ba242144af8318187d7e5b8c52
100755
--- a/test/cctest/test-parsing.cc
+++ b/test/cctest/test-parsing.cc
@@ -327,7 +327,7 @@ TEST(RegressChromium62639) {
i::Utf8ToUC16CharacterStream stream(reinterpret_cast<const
i::byte*>(program),
static_cast<unsigned>(strlen(program)));
i::ScriptDataImpl* data =
- i::ParserApi::PreParse(&stream, NULL, false);
+ i::ParserApi::PreParse(&stream, NULL, i::kNoParsingFlags);
CHECK(data->HasError());
delete data;
}
@@ -351,7 +351,7 @@ TEST(Regress928) {
i::Utf8ToUC16CharacterStream stream(reinterpret_cast<const
i::byte*>(program),
static_cast<unsigned>(strlen(program)));
i::ScriptDataImpl* data =
- i::ParserApi::PartialPreParse(&stream, NULL, false);
+ i::ParserApi::PartialPreParse(&stream, NULL, i::kNoParsingFlags);
CHECK(!data->HasError());
data->Initialize();
--
v8-dev mailing list
[email protected]
http://groups.google.com/group/v8-dev