OLD | NEW |
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 4183 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
4194 ZoneList<Expression*>* Parser::ParseArguments(bool* ok) { | 4194 ZoneList<Expression*>* Parser::ParseArguments(bool* ok) { |
4195 // Arguments :: | 4195 // Arguments :: |
4196 // '(' (AssignmentExpression)*[','] ')' | 4196 // '(' (AssignmentExpression)*[','] ')' |
4197 | 4197 |
4198 ZoneList<Expression*>* result = new(zone()) ZoneList<Expression*>(4, zone()); | 4198 ZoneList<Expression*>* result = new(zone()) ZoneList<Expression*>(4, zone()); |
4199 Expect(Token::LPAREN, CHECK_OK); | 4199 Expect(Token::LPAREN, CHECK_OK); |
4200 bool done = (peek() == Token::RPAREN); | 4200 bool done = (peek() == Token::RPAREN); |
4201 while (!done) { | 4201 while (!done) { |
4202 Expression* argument = ParseAssignmentExpression(true, CHECK_OK); | 4202 Expression* argument = ParseAssignmentExpression(true, CHECK_OK); |
4203 result->Add(argument, zone()); | 4203 result->Add(argument, zone()); |
4204 if (result->length() > kMaxNumFunctionParameters) { | 4204 if (result->length() > Code::kMaxArguments) { |
4205 ReportMessageAt(scanner().location(), "too_many_arguments", | 4205 ReportMessageAt(scanner().location(), "too_many_arguments", |
4206 Vector<const char*>::empty()); | 4206 Vector<const char*>::empty()); |
4207 *ok = false; | 4207 *ok = false; |
4208 return NULL; | 4208 return NULL; |
4209 } | 4209 } |
4210 done = (peek() == Token::RPAREN); | 4210 done = (peek() == Token::RPAREN); |
4211 if (!done) Expect(Token::COMMA, CHECK_OK); | 4211 if (!done) Expect(Token::COMMA, CHECK_OK); |
4212 } | 4212 } |
4213 Expect(Token::RPAREN, CHECK_OK); | 4213 Expect(Token::RPAREN, CHECK_OK); |
4214 return result; | 4214 return result; |
(...skipping 156 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
4371 if (!dupe_loc.IsValid() && top_scope_->IsDeclared(param_name)) { | 4371 if (!dupe_loc.IsValid() && top_scope_->IsDeclared(param_name)) { |
4372 duplicate_parameters = FunctionLiteral::kHasDuplicateParameters; | 4372 duplicate_parameters = FunctionLiteral::kHasDuplicateParameters; |
4373 dupe_loc = scanner().location(); | 4373 dupe_loc = scanner().location(); |
4374 } | 4374 } |
4375 if (!reserved_loc.IsValid() && is_strict_reserved) { | 4375 if (!reserved_loc.IsValid() && is_strict_reserved) { |
4376 reserved_loc = scanner().location(); | 4376 reserved_loc = scanner().location(); |
4377 } | 4377 } |
4378 | 4378 |
4379 top_scope_->DeclareParameter(param_name, VAR); | 4379 top_scope_->DeclareParameter(param_name, VAR); |
4380 num_parameters++; | 4380 num_parameters++; |
4381 if (num_parameters > kMaxNumFunctionParameters) { | 4381 if (num_parameters > Code::kMaxArguments) { |
4382 ReportMessageAt(scanner().location(), "too_many_parameters", | 4382 ReportMessageAt(scanner().location(), "too_many_parameters", |
4383 Vector<const char*>::empty()); | 4383 Vector<const char*>::empty()); |
4384 *ok = false; | 4384 *ok = false; |
4385 return NULL; | 4385 return NULL; |
4386 } | 4386 } |
4387 done = (peek() == Token::RPAREN); | 4387 done = (peek() == Token::RPAREN); |
4388 if (!done) Expect(Token::COMMA, CHECK_OK); | 4388 if (!done) Expect(Token::COMMA, CHECK_OK); |
4389 } | 4389 } |
4390 Expect(Token::RPAREN, CHECK_OK); | 4390 Expect(Token::RPAREN, CHECK_OK); |
4391 | 4391 |
(...skipping 1550 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
5942 ASSERT(info->isolate()->has_pending_exception()); | 5942 ASSERT(info->isolate()->has_pending_exception()); |
5943 } else { | 5943 } else { |
5944 result = parser.ParseProgram(); | 5944 result = parser.ParseProgram(); |
5945 } | 5945 } |
5946 } | 5946 } |
5947 info->SetFunction(result); | 5947 info->SetFunction(result); |
5948 return (result != NULL); | 5948 return (result != NULL); |
5949 } | 5949 } |
5950 | 5950 |
5951 } } // namespace v8::internal | 5951 } } // namespace v8::internal |
OLD | NEW |