| 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 1738 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1749 int position = -1; | 1749 int position = -1; |
| 1750 if (peek() == Token::ASSIGN) { | 1750 if (peek() == Token::ASSIGN) { |
| 1751 Expect(Token::ASSIGN, CHECK_OK); | 1751 Expect(Token::ASSIGN, CHECK_OK); |
| 1752 position = scanner().location().beg_pos; | 1752 position = scanner().location().beg_pos; |
| 1753 value = ParseAssignmentExpression(var_context != kForStatement, CHECK_OK); | 1753 value = ParseAssignmentExpression(var_context != kForStatement, CHECK_OK); |
| 1754 // Don't infer if it is "a = function(){...}();"-like expression. | 1754 // Don't infer if it is "a = function(){...}();"-like expression. |
| 1755 if (fni_ != NULL && | 1755 if (fni_ != NULL && |
| 1756 value->AsCall() == NULL && | 1756 value->AsCall() == NULL && |
| 1757 value->AsCallNew() == NULL) { | 1757 value->AsCallNew() == NULL) { |
| 1758 fni_->Infer(); | 1758 fni_->Infer(); |
| 1759 } else { |
| 1760 fni_->RemoveLastFunction(); |
| 1759 } | 1761 } |
| 1760 } | 1762 } |
| 1761 | 1763 |
| 1762 // Make sure that 'const x' and 'let x' initialize 'x' to undefined. | 1764 // Make sure that 'const x' and 'let x' initialize 'x' to undefined. |
| 1763 if (value == NULL && needs_init) { | 1765 if (value == NULL && needs_init) { |
| 1764 value = GetLiteralUndefined(); | 1766 value = GetLiteralUndefined(); |
| 1765 } | 1767 } |
| 1766 | 1768 |
| 1767 // Global variable declarations must be compiled in a specific | 1769 // Global variable declarations must be compiled in a specific |
| 1768 // way. When the script containing the global variable declaration | 1770 // way. When the script containing the global variable declaration |
| (...skipping 730 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2499 | 2501 |
| 2500 if (fni_ != NULL) { | 2502 if (fni_ != NULL) { |
| 2501 // Check if the right hand side is a call to avoid inferring a | 2503 // Check if the right hand side is a call to avoid inferring a |
| 2502 // name if we're dealing with "a = function(){...}();"-like | 2504 // name if we're dealing with "a = function(){...}();"-like |
| 2503 // expression. | 2505 // expression. |
| 2504 if ((op == Token::INIT_VAR | 2506 if ((op == Token::INIT_VAR |
| 2505 || op == Token::INIT_CONST | 2507 || op == Token::INIT_CONST |
| 2506 || op == Token::ASSIGN) | 2508 || op == Token::ASSIGN) |
| 2507 && (right->AsCall() == NULL && right->AsCallNew() == NULL)) { | 2509 && (right->AsCall() == NULL && right->AsCallNew() == NULL)) { |
| 2508 fni_->Infer(); | 2510 fni_->Infer(); |
| 2511 } else { |
| 2512 fni_->RemoveLastFunction(); |
| 2509 } | 2513 } |
| 2510 fni_->Leave(); | 2514 fni_->Leave(); |
| 2511 } | 2515 } |
| 2512 | 2516 |
| 2513 return new(zone()) Assignment(isolate(), op, expression, right, pos); | 2517 return new(zone()) Assignment(isolate(), op, expression, right, pos); |
| 2514 } | 2518 } |
| 2515 | 2519 |
| 2516 | 2520 |
| 2517 // Precedence = 3 | 2521 // Precedence = 3 |
| 2518 Expression* Parser::ParseConditionalExpression(bool accept_IN, bool* ok) { | 2522 Expression* Parser::ParseConditionalExpression(bool accept_IN, bool* ok) { |
| (...skipping 2681 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 5200 result = parser.ParseProgram(source, | 5204 result = parser.ParseProgram(source, |
| 5201 info->is_global(), | 5205 info->is_global(), |
| 5202 info->StrictMode()); | 5206 info->StrictMode()); |
| 5203 } | 5207 } |
| 5204 } | 5208 } |
| 5205 info->SetFunction(result); | 5209 info->SetFunction(result); |
| 5206 return (result != NULL); | 5210 return (result != NULL); |
| 5207 } | 5211 } |
| 5208 | 5212 |
| 5209 } } // namespace v8::internal | 5213 } } // namespace v8::internal |
| OLD | NEW |