| 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 3370 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 3381 | 3381 |
| 3382 Expression* Parser::ParseMemberWithNewPrefixesExpression(PositionStack* stack, | 3382 Expression* Parser::ParseMemberWithNewPrefixesExpression(PositionStack* stack, |
| 3383 bool* ok) { | 3383 bool* ok) { |
| 3384 // MemberExpression :: | 3384 // MemberExpression :: |
| 3385 // (PrimaryExpression | FunctionLiteral) | 3385 // (PrimaryExpression | FunctionLiteral) |
| 3386 // ('[' Expression ']' | '.' Identifier | Arguments)* | 3386 // ('[' Expression ']' | '.' Identifier | Arguments)* |
| 3387 | 3387 |
| 3388 // Parse the initial primary or function expression. | 3388 // Parse the initial primary or function expression. |
| 3389 Expression* result = NULL; | 3389 Expression* result = NULL; |
| 3390 if (peek() == Token::FUNCTION) { | 3390 if (peek() == Token::FUNCTION) { |
| 3391 Expect(Token::FUNCTION, CHECK_OK); | 3391 Consume(Token::FUNCTION); |
| 3392 int function_token_position = position(); | 3392 int function_token_position = position(); |
| 3393 bool is_generator = allow_generators() && Check(Token::MUL); | 3393 bool is_generator = allow_generators() && Check(Token::MUL); |
| 3394 Handle<String> name; | 3394 Handle<String> name; |
| 3395 bool is_strict_reserved_name = false; | 3395 bool is_strict_reserved_name = false; |
| 3396 Scanner::Location function_name_location = Scanner::Location::invalid(); | 3396 Scanner::Location function_name_location = Scanner::Location::invalid(); |
| 3397 if (peek_any_identifier()) { | 3397 if (peek_any_identifier()) { |
| 3398 name = ParseIdentifierOrStrictReservedWord(&is_strict_reserved_name, | 3398 name = ParseIdentifierOrStrictReservedWord(&is_strict_reserved_name, |
| 3399 CHECK_OK); | 3399 CHECK_OK); |
| 3400 function_name_location = scanner().location(); | 3400 function_name_location = scanner().location(); |
| 3401 } | 3401 } |
| (...skipping 856 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 4258 | 4258 |
| 4259 // Validate strict mode. | 4259 // Validate strict mode. |
| 4260 if (!top_scope_->is_classic_mode()) { | 4260 if (!top_scope_->is_classic_mode()) { |
| 4261 if (IsEvalOrArguments(function_name)) { | 4261 if (IsEvalOrArguments(function_name)) { |
| 4262 ReportMessageAt(function_name_location, | 4262 ReportMessageAt(function_name_location, |
| 4263 "strict_eval_arguments", | 4263 "strict_eval_arguments", |
| 4264 Vector<const char*>::empty()); | 4264 Vector<const char*>::empty()); |
| 4265 *ok = false; | 4265 *ok = false; |
| 4266 return NULL; | 4266 return NULL; |
| 4267 } | 4267 } |
| 4268 if (name_is_strict_reserved) { |
| 4269 ReportMessageAt(function_name_location, "unexpected_strict_reserved", |
| 4270 Vector<const char*>::empty()); |
| 4271 *ok = false; |
| 4272 return NULL; |
| 4273 } |
| 4268 if (name_loc.IsValid()) { | 4274 if (name_loc.IsValid()) { |
| 4269 ReportMessageAt(name_loc, "strict_eval_arguments", | 4275 ReportMessageAt(name_loc, "strict_eval_arguments", |
| 4270 Vector<const char*>::empty()); | 4276 Vector<const char*>::empty()); |
| 4271 *ok = false; | 4277 *ok = false; |
| 4272 return NULL; | 4278 return NULL; |
| 4273 } | 4279 } |
| 4274 if (dupe_loc.IsValid()) { | 4280 if (dupe_loc.IsValid()) { |
| 4275 ReportMessageAt(dupe_loc, "strict_param_dupe", | 4281 ReportMessageAt(dupe_loc, "strict_param_dupe", |
| 4276 Vector<const char*>::empty()); | 4282 Vector<const char*>::empty()); |
| 4277 *ok = false; | 4283 *ok = false; |
| 4278 return NULL; | 4284 return NULL; |
| 4279 } | |
| 4280 if (name_is_strict_reserved) { | |
| 4281 ReportMessageAt(function_name_location, "unexpected_strict_reserved", | |
| 4282 Vector<const char*>::empty()); | |
| 4283 *ok = false; | |
| 4284 return NULL; | |
| 4285 } | 4285 } |
| 4286 if (reserved_loc.IsValid()) { | 4286 if (reserved_loc.IsValid()) { |
| 4287 ReportMessageAt(reserved_loc, "unexpected_strict_reserved", | 4287 ReportMessageAt(reserved_loc, "unexpected_strict_reserved", |
| 4288 Vector<const char*>::empty()); | 4288 Vector<const char*>::empty()); |
| 4289 *ok = false; | 4289 *ok = false; |
| 4290 return NULL; | 4290 return NULL; |
| 4291 } | 4291 } |
| 4292 CheckOctalLiteral(scope->start_position(), | 4292 CheckOctalLiteral(scope->start_position(), |
| 4293 scope->end_position(), | 4293 scope->end_position(), |
| 4294 CHECK_OK); | 4294 CHECK_OK); |
| (...skipping 1394 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 5689 ASSERT(info()->isolate()->has_pending_exception()); | 5689 ASSERT(info()->isolate()->has_pending_exception()); |
| 5690 } else { | 5690 } else { |
| 5691 result = ParseProgram(); | 5691 result = ParseProgram(); |
| 5692 } | 5692 } |
| 5693 } | 5693 } |
| 5694 info()->SetFunction(result); | 5694 info()->SetFunction(result); |
| 5695 return (result != NULL); | 5695 return (result != NULL); |
| 5696 } | 5696 } |
| 5697 | 5697 |
| 5698 } } // namespace v8::internal | 5698 } } // namespace v8::internal |
| OLD | NEW |