| OLD | NEW |
| 1 // Copyright 2012 the V8 project authors. All rights reserved. | 1 // Copyright 2012 the V8 project authors. All rights reserved. |
| 2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
| 3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
| 4 | 4 |
| 5 #ifndef V8_PARSING_PARSER_BASE_H | 5 #ifndef V8_PARSING_PARSER_BASE_H |
| 6 #define V8_PARSING_PARSER_BASE_H | 6 #define V8_PARSING_PARSER_BASE_H |
| 7 | 7 |
| 8 #include "src/ast/scopes.h" | 8 #include "src/ast/scopes.h" |
| 9 #include "src/bailout-reason.h" | 9 #include "src/bailout-reason.h" |
| 10 #include "src/hashmap.h" | 10 #include "src/hashmap.h" |
| (...skipping 820 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 831 bool IsValidPattern(ExpressionT expression) { | 831 bool IsValidPattern(ExpressionT expression) { |
| 832 return expression->IsObjectLiteral() || expression->IsArrayLiteral(); | 832 return expression->IsObjectLiteral() || expression->IsArrayLiteral(); |
| 833 } | 833 } |
| 834 | 834 |
| 835 // Keep track of eval() calls since they disable all local variable | 835 // Keep track of eval() calls since they disable all local variable |
| 836 // optimizations. This checks if expression is an eval call, and if yes, | 836 // optimizations. This checks if expression is an eval call, and if yes, |
| 837 // forwards the information to scope. | 837 // forwards the information to scope. |
| 838 void CheckPossibleEvalCall(ExpressionT expression, Scope* scope) { | 838 void CheckPossibleEvalCall(ExpressionT expression, Scope* scope) { |
| 839 if (Traits::IsIdentifier(expression) && | 839 if (Traits::IsIdentifier(expression) && |
| 840 Traits::IsEval(Traits::AsIdentifier(expression))) { | 840 Traits::IsEval(Traits::AsIdentifier(expression))) { |
| 841 scope->DeclarationScope()->RecordEvalCall(); | |
| 842 scope->RecordEvalCall(); | 841 scope->RecordEvalCall(); |
| 842 if (is_sloppy(scope->language_mode())) { |
| 843 // For sloppy scopes we also have to record the call at function level, |
| 844 // in case it includes declarations that will be hoisted. |
| 845 scope->DeclarationScope()->RecordEvalCall(); |
| 846 } |
| 843 } | 847 } |
| 844 } | 848 } |
| 845 | 849 |
| 846 // Used to validate property names in object literals and class literals | 850 // Used to validate property names in object literals and class literals |
| 847 enum PropertyKind { | 851 enum PropertyKind { |
| 848 kAccessorProperty, | 852 kAccessorProperty, |
| 849 kValueProperty, | 853 kValueProperty, |
| 850 kMethodProperty | 854 kMethodProperty |
| 851 }; | 855 }; |
| 852 | 856 |
| (...skipping 2274 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 3127 has_seen_constructor_ = true; | 3131 has_seen_constructor_ = true; |
| 3128 return; | 3132 return; |
| 3129 } | 3133 } |
| 3130 } | 3134 } |
| 3131 | 3135 |
| 3132 | 3136 |
| 3133 } // namespace internal | 3137 } // namespace internal |
| 3134 } // namespace v8 | 3138 } // namespace v8 |
| 3135 | 3139 |
| 3136 #endif // V8_PARSING_PARSER_BASE_H | 3140 #endif // V8_PARSING_PARSER_BASE_H |
| OLD | NEW |