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

Side by Side Diff: src/parser.cc

Issue 194503004: Move ParseArguments to ParserBase and add tests. (Closed) Base URL: https://v8.googlecode.com/svn/branches/bleeding_edge
Patch Set: oops 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 | « src/parser.h ('k') | 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 3483 matching lines...) Expand 10 before | Expand all | Expand 10 after
3494 Smi* literal_type = Smi::cast(value->get(kLiteralTypeSlot)); 3494 Smi* literal_type = Smi::cast(value->get(kLiteralTypeSlot));
3495 return static_cast<LiteralType>(literal_type->value()); 3495 return static_cast<LiteralType>(literal_type->value());
3496 } 3496 }
3497 3497
3498 3498
3499 Handle<FixedArray> CompileTimeValue::GetElements(Handle<FixedArray> value) { 3499 Handle<FixedArray> CompileTimeValue::GetElements(Handle<FixedArray> value) {
3500 return Handle<FixedArray>(FixedArray::cast(value->get(kElementsSlot))); 3500 return Handle<FixedArray>(FixedArray::cast(value->get(kElementsSlot)));
3501 } 3501 }
3502 3502
3503 3503
3504 ZoneList<Expression*>* Parser::ParseArguments(bool* ok) {
3505 // Arguments ::
3506 // '(' (AssignmentExpression)*[','] ')'
3507
3508 ZoneList<Expression*>* result = new(zone()) ZoneList<Expression*>(4, zone());
3509 Expect(Token::LPAREN, CHECK_OK);
3510 bool done = (peek() == Token::RPAREN);
3511 while (!done) {
3512 Expression* argument = ParseAssignmentExpression(true, CHECK_OK);
3513 result->Add(argument, zone());
3514 if (result->length() > Code::kMaxArguments) {
3515 ReportMessageAt(scanner()->location(), "too_many_arguments");
3516 *ok = false;
3517 return NULL;
3518 }
3519 done = (peek() == Token::RPAREN);
3520 if (!done) Expect(Token::COMMA, CHECK_OK);
3521 }
3522 Expect(Token::RPAREN, CHECK_OK);
3523 return result;
3524 }
3525
3526
3527 class SingletonLogger : public ParserRecorder { 3504 class SingletonLogger : public ParserRecorder {
3528 public: 3505 public:
3529 SingletonLogger() : has_error_(false), start_(-1), end_(-1) { } 3506 SingletonLogger() : has_error_(false), start_(-1), end_(-1) { }
3530 virtual ~SingletonLogger() { } 3507 virtual ~SingletonLogger() { }
3531 3508
3532 void Reset() { has_error_ = false; } 3509 void Reset() { has_error_ = false; }
3533 3510
3534 virtual void LogFunction(int start, 3511 virtual void LogFunction(int start,
3535 int end, 3512 int end,
3536 int literals, 3513 int literals,
(...skipping 1664 matching lines...) Expand 10 before | Expand all | Expand 10 after
5201 ASSERT(info()->isolate()->has_pending_exception()); 5178 ASSERT(info()->isolate()->has_pending_exception());
5202 } else { 5179 } else {
5203 result = ParseProgram(); 5180 result = ParseProgram();
5204 } 5181 }
5205 } 5182 }
5206 info()->SetFunction(result); 5183 info()->SetFunction(result);
5207 return (result != NULL); 5184 return (result != NULL);
5208 } 5185 }
5209 5186
5210 } } // namespace v8::internal 5187 } } // namespace v8::internal
OLDNEW
« no previous file with comments | « src/parser.h ('k') | src/preparser.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698