OLD | NEW |
1 // Copyright 2011 the V8 project authors. All rights reserved. | 1 // Copyright 2011 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 3488 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
3499 ZoneList<Expression*>* Parser::ParseArguments(bool* ok) { | 3499 ZoneList<Expression*>* Parser::ParseArguments(bool* ok) { |
3500 // Arguments :: | 3500 // Arguments :: |
3501 // '(' (AssignmentExpression)*[','] ')' | 3501 // '(' (AssignmentExpression)*[','] ')' |
3502 | 3502 |
3503 ZoneList<Expression*>* result = new(zone()) ZoneList<Expression*>(4); | 3503 ZoneList<Expression*>* result = new(zone()) ZoneList<Expression*>(4); |
3504 Expect(Token::LPAREN, CHECK_OK); | 3504 Expect(Token::LPAREN, CHECK_OK); |
3505 bool done = (peek() == Token::RPAREN); | 3505 bool done = (peek() == Token::RPAREN); |
3506 while (!done) { | 3506 while (!done) { |
3507 Expression* argument = ParseAssignmentExpression(true, CHECK_OK); | 3507 Expression* argument = ParseAssignmentExpression(true, CHECK_OK); |
3508 result->Add(argument); | 3508 result->Add(argument); |
| 3509 if (result->length() > kMaxNumFunctionParameters) { |
| 3510 ReportMessageAt(scanner().location(), "too_many_arguments", |
| 3511 Vector<const char*>::empty()); |
| 3512 *ok = false; |
| 3513 return NULL; |
| 3514 } |
3509 done = (peek() == Token::RPAREN); | 3515 done = (peek() == Token::RPAREN); |
3510 if (!done) Expect(Token::COMMA, CHECK_OK); | 3516 if (!done) Expect(Token::COMMA, CHECK_OK); |
3511 } | 3517 } |
3512 Expect(Token::RPAREN, CHECK_OK); | 3518 Expect(Token::RPAREN, CHECK_OK); |
3513 return result; | 3519 return result; |
3514 } | 3520 } |
3515 | 3521 |
3516 | 3522 |
3517 FunctionLiteral* Parser::ParseFunctionLiteral(Handle<String> var_name, | 3523 FunctionLiteral* Parser::ParseFunctionLiteral(Handle<String> var_name, |
3518 bool name_is_reserved, | 3524 bool name_is_reserved, |
(...skipping 1469 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
4988 info->is_global(), | 4994 info->is_global(), |
4989 info->StrictMode()); | 4995 info->StrictMode()); |
4990 } | 4996 } |
4991 } | 4997 } |
4992 | 4998 |
4993 info->SetFunction(result); | 4999 info->SetFunction(result); |
4994 return (result != NULL); | 5000 return (result != NULL); |
4995 } | 5001 } |
4996 | 5002 |
4997 } } // namespace v8::internal | 5003 } } // namespace v8::internal |
OLD | NEW |