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

Side by Side Diff: src/parser.cc

Issue 190853011: Parser & preparser unification: make the ParseFunctionLiteral APIs the same. (Closed) Base URL: https://v8.googlecode.com/svn/branches/bleeding_edge
Patch Set: Created 6 years, 9 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 | Annotate | Revision Log
« no previous file with comments | « no previous file | src/preparser.h » ('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 2012 the V8 project authors. All rights reserved. 1 // Copyright 2012 the V8 project authors. All rights reserved.
2 // Redistribution and use in source and binary forms, with or without 2 // Redistribution and use in source and binary forms, with or without
3 // modification, are permitted provided that the following conditions are 3 // modification, are permitted provided that the following conditions are
4 // met: 4 // met:
5 // 5 //
6 // * Redistributions of source code must retain the above copyright 6 // * Redistributions of source code must retain the above copyright
7 // notice, this list of conditions and the following disclaimer. 7 // notice, this list of conditions and the following disclaimer.
8 // * Redistributions in binary form must reproduce the above 8 // * Redistributions in binary form must reproduce the above
9 // copyright notice, this list of conditions and the following 9 // copyright notice, this list of conditions and the following
10 // disclaimer in the documentation and/or other materials provided 10 // disclaimer in the documentation and/or other materials provided
(...skipping 3342 matching lines...) Expand 10 before | Expand all | Expand 10 after
3353 3353
3354 // Parse the initial primary or function expression. 3354 // Parse the initial primary or function expression.
3355 Expression* result = NULL; 3355 Expression* result = NULL;
3356 if (peek() == Token::FUNCTION) { 3356 if (peek() == Token::FUNCTION) {
3357 Consume(Token::FUNCTION); 3357 Consume(Token::FUNCTION);
3358 int function_token_position = position(); 3358 int function_token_position = position();
3359 bool is_generator = allow_generators() && Check(Token::MUL); 3359 bool is_generator = allow_generators() && Check(Token::MUL);
3360 Handle<String> name; 3360 Handle<String> name;
3361 bool is_strict_reserved_name = false; 3361 bool is_strict_reserved_name = false;
3362 Scanner::Location function_name_location = Scanner::Location::invalid(); 3362 Scanner::Location function_name_location = Scanner::Location::invalid();
3363 FunctionLiteral::FunctionType function_type =
3364 FunctionLiteral::ANONYMOUS_EXPRESSION;
3363 if (peek_any_identifier()) { 3365 if (peek_any_identifier()) {
3364 name = ParseIdentifierOrStrictReservedWord(&is_strict_reserved_name, 3366 name = ParseIdentifierOrStrictReservedWord(&is_strict_reserved_name,
3365 CHECK_OK); 3367 CHECK_OK);
3366 function_name_location = scanner()->location(); 3368 function_name_location = scanner()->location();
3369 function_type = FunctionLiteral::NAMED_EXPRESSION;
3367 } 3370 }
3368 FunctionLiteral::FunctionType function_type = name.is_null()
3369 ? FunctionLiteral::ANONYMOUS_EXPRESSION
3370 : FunctionLiteral::NAMED_EXPRESSION;
3371 result = ParseFunctionLiteral(name, 3371 result = ParseFunctionLiteral(name,
3372 function_name_location, 3372 function_name_location,
3373 is_strict_reserved_name, 3373 is_strict_reserved_name,
3374 is_generator, 3374 is_generator,
3375 function_token_position, 3375 function_token_position,
3376 function_type, 3376 function_type,
3377 CHECK_OK); 3377 CHECK_OK);
3378 } else { 3378 } else {
3379 result = ParsePrimaryExpression(CHECK_OK); 3379 result = ParsePrimaryExpression(CHECK_OK);
3380 } 3380 }
(...skipping 1968 matching lines...) Expand 10 before | Expand all | Expand 10 after
5349 ASSERT(info()->isolate()->has_pending_exception()); 5349 ASSERT(info()->isolate()->has_pending_exception());
5350 } else { 5350 } else {
5351 result = ParseProgram(); 5351 result = ParseProgram();
5352 } 5352 }
5353 } 5353 }
5354 info()->SetFunction(result); 5354 info()->SetFunction(result);
5355 return (result != NULL); 5355 return (result != NULL);
5356 } 5356 }
5357 5357
5358 } } // namespace v8::internal 5358 } } // namespace v8::internal
OLDNEW
« no previous file with comments | « no previous file | src/preparser.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698