Limit entry points into the parser API.

R=ulan@chromium.org

Review URL: https://codereview.chromium.org/24104006

git-svn-id: http://v8.googlecode.com/svn/branches/bleeding_edge@17033 ce2b1a6d-e550-0410-aec6-3dcde31c8c00
parent b267a955
......@@ -3170,8 +3170,7 @@ Expression* Parser::ParseUnaryExpression(bool* ok) {
if (op == Token::NOT) {
// Convert the literal to a boolean condition and negate it.
bool condition = literal->BooleanValue();
Handle<Object> result(isolate()->heap()->ToBoolean(!condition),
isolate());
Handle<Object> result = isolate()->factory()->ToBoolean(!condition);
return factory()->NewLiteral(result);
} else if (literal->IsNumber()) {
// Compute some expressions involving only number literals.
......
......@@ -461,9 +461,6 @@ class Parser BASE_EMBEDDED {
static bool Parse(CompilationInfo* info) { return Parser(info).Parse(); }
bool Parse();
// Returns NULL if parsing failed.
FunctionLiteral* ParseProgram();
void ReportMessageAt(Scanner::Location loc,
const char* message,
Vector<const char*> args);
......@@ -568,6 +565,9 @@ class Parser BASE_EMBEDDED {
Mode old_mode_;
};
// Returns NULL if parsing failed.
FunctionLiteral* ParseProgram();
FunctionLiteral* ParseLazy();
FunctionLiteral* ParseLazy(Utf16CharacterStream* source);
......
......@@ -1027,11 +1027,11 @@ TEST(ScopePositions) {
parser.set_allow_harmony_scoping(true);
info.MarkAsGlobal();
info.SetLanguageMode(source_data[i].language_mode);
i::FunctionLiteral* function = parser.ParseProgram();
CHECK(function != NULL);
parser.Parse();
CHECK(info.function() != NULL);
// Check scope types and positions.
i::Scope* scope = function->scope();
i::Scope* scope = info.function()->scope();
CHECK(scope->is_global_scope());
CHECK_EQ(scope->start_position(), 0);
CHECK_EQ(scope->end_position(), kProgramSize);
......@@ -1137,7 +1137,8 @@ void TestParserSyncWithFlags(i::Handle<i::String> source, unsigned flags) {
i::Parser parser(&info);
SET_PARSER_FLAGS(parser, flags);
info.MarkAsGlobal();
function = parser.ParseProgram();
parser.Parse();
function = info.function();
}
// Check that preparsing fails iff parsing fails.
......
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