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 895 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
906 bool IsValidPattern(ExpressionT expression) { | 906 bool IsValidPattern(ExpressionT expression) { |
907 return expression->IsObjectLiteral() || expression->IsArrayLiteral(); | 907 return expression->IsObjectLiteral() || expression->IsArrayLiteral(); |
908 } | 908 } |
909 | 909 |
910 // Keep track of eval() calls since they disable all local variable | 910 // Keep track of eval() calls since they disable all local variable |
911 // optimizations. This checks if expression is an eval call, and if yes, | 911 // optimizations. This checks if expression is an eval call, and if yes, |
912 // forwards the information to scope. | 912 // forwards the information to scope. |
913 void CheckPossibleEvalCall(ExpressionT expression, Scope* scope) { | 913 void CheckPossibleEvalCall(ExpressionT expression, Scope* scope) { |
914 if (Traits::IsIdentifier(expression) && | 914 if (Traits::IsIdentifier(expression) && |
915 Traits::IsEval(Traits::AsIdentifier(expression))) { | 915 Traits::IsEval(Traits::AsIdentifier(expression))) { |
916 scope->DeclarationScope()->RecordEvalCall(); | |
917 scope->RecordEvalCall(); | 916 scope->RecordEvalCall(); |
| 917 if (is_sloppy(scope->language_mode())) { |
| 918 // For sloppy scopes we also have to record the call at function level, |
| 919 // in case it includes declarations that will be hoisted. |
| 920 scope->DeclarationScope()->RecordEvalCall(); |
| 921 } |
918 } | 922 } |
919 } | 923 } |
920 | 924 |
921 // Used to validate property names in object literals and class literals | 925 // Used to validate property names in object literals and class literals |
922 enum PropertyKind { | 926 enum PropertyKind { |
923 kAccessorProperty, | 927 kAccessorProperty, |
924 kValueProperty, | 928 kValueProperty, |
925 kMethodProperty | 929 kMethodProperty |
926 }; | 930 }; |
927 | 931 |
(...skipping 2283 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
3211 has_seen_constructor_ = true; | 3215 has_seen_constructor_ = true; |
3212 return; | 3216 return; |
3213 } | 3217 } |
3214 } | 3218 } |
3215 | 3219 |
3216 | 3220 |
3217 } // namespace internal | 3221 } // namespace internal |
3218 } // namespace v8 | 3222 } // namespace v8 |
3219 | 3223 |
3220 #endif // V8_PARSING_PARSER_BASE_H | 3224 #endif // V8_PARSING_PARSER_BASE_H |
OLD | NEW |