| OLD | NEW |
| 1 // Copyright 2010 the V8 project authors. All rights reserved. | 1 // Copyright 2010 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 3396 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 3407 ZoneList<Expression*>* Parser::ParseArguments(bool* ok) { | 3407 ZoneList<Expression*>* Parser::ParseArguments(bool* ok) { |
| 3408 // Arguments :: | 3408 // Arguments :: |
| 3409 // '(' (AssignmentExpression)*[','] ')' | 3409 // '(' (AssignmentExpression)*[','] ')' |
| 3410 | 3410 |
| 3411 ZoneList<Expression*>* result = new ZoneList<Expression*>(4); | 3411 ZoneList<Expression*>* result = new ZoneList<Expression*>(4); |
| 3412 Expect(Token::LPAREN, CHECK_OK); | 3412 Expect(Token::LPAREN, CHECK_OK); |
| 3413 bool done = (peek() == Token::RPAREN); | 3413 bool done = (peek() == Token::RPAREN); |
| 3414 while (!done) { | 3414 while (!done) { |
| 3415 Expression* argument = ParseAssignmentExpression(true, CHECK_OK); | 3415 Expression* argument = ParseAssignmentExpression(true, CHECK_OK); |
| 3416 result->Add(argument); | 3416 result->Add(argument); |
| 3417 if (result->length() > kMaxNumFunctionParameters) { |
| 3418 ReportMessageAt(scanner().location(), "too_many_arguments", |
| 3419 Vector<const char*>::empty()); |
| 3420 *ok = false; |
| 3421 return NULL; |
| 3422 } |
| 3417 done = (peek() == Token::RPAREN); | 3423 done = (peek() == Token::RPAREN); |
| 3418 if (!done) Expect(Token::COMMA, CHECK_OK); | 3424 if (!done) Expect(Token::COMMA, CHECK_OK); |
| 3419 } | 3425 } |
| 3420 Expect(Token::RPAREN, CHECK_OK); | 3426 Expect(Token::RPAREN, CHECK_OK); |
| 3421 return result; | 3427 return result; |
| 3422 } | 3428 } |
| 3423 | 3429 |
| 3424 | 3430 |
| 3425 FunctionLiteral* Parser::ParseFunctionLiteral(Handle<String> var_name, | 3431 FunctionLiteral* Parser::ParseFunctionLiteral(Handle<String> var_name, |
| 3426 int function_token_position, | 3432 int function_token_position, |
| (...skipping 1608 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 5035 Handle<String> source = Handle<String>(String::cast(script->source())); | 5041 Handle<String> source = Handle<String>(String::cast(script->source())); |
| 5036 result = parser.ParseProgram(source, info->is_global()); | 5042 result = parser.ParseProgram(source, info->is_global()); |
| 5037 } | 5043 } |
| 5038 } | 5044 } |
| 5039 | 5045 |
| 5040 info->SetFunction(result); | 5046 info->SetFunction(result); |
| 5041 return (result != NULL); | 5047 return (result != NULL); |
| 5042 } | 5048 } |
| 5043 | 5049 |
| 5044 } } // namespace v8::internal | 5050 } } // namespace v8::internal |
| OLD | NEW |