| 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 660 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 671 int length() const { return length_; } | 671 int length() const { return length_; } |
| 672 private: | 672 private: |
| 673 int length_; | 673 int length_; |
| 674 }; | 674 }; |
| 675 | 675 |
| 676 | 676 |
| 677 class PreParserScope { | 677 class PreParserScope { |
| 678 public: | 678 public: |
| 679 explicit PreParserScope(PreParserScope* outer_scope, ScopeType scope_type) | 679 explicit PreParserScope(PreParserScope* outer_scope, ScopeType scope_type) |
| 680 : scope_type_(scope_type) { | 680 : scope_type_(scope_type) { |
| 681 if (outer_scope) { | 681 strict_mode_ = outer_scope ? outer_scope->strict_mode() : SLOPPY; |
| 682 scope_inside_with_ = outer_scope->scope_inside_with_ || is_with_scope(); | |
| 683 strict_mode_ = outer_scope->strict_mode(); | |
| 684 } else { | |
| 685 scope_inside_with_ = is_with_scope(); | |
| 686 strict_mode_ = SLOPPY; | |
| 687 } | |
| 688 } | |
| 689 | |
| 690 bool is_with_scope() const { return scope_type_ == WITH_SCOPE; } | |
| 691 bool inside_with() const { | |
| 692 return scope_inside_with_; | |
| 693 } | 682 } |
| 694 | 683 |
| 695 ScopeType type() { return scope_type_; } | 684 ScopeType type() { return scope_type_; } |
| 696 StrictMode strict_mode() const { return strict_mode_; } | 685 StrictMode strict_mode() const { return strict_mode_; } |
| 697 void SetStrictMode(StrictMode strict_mode) { strict_mode_ = strict_mode; } | 686 void SetStrictMode(StrictMode strict_mode) { strict_mode_ = strict_mode; } |
| 698 | 687 |
| 699 private: | 688 private: |
| 700 ScopeType scope_type_; | 689 ScopeType scope_type_; |
| 701 bool scope_inside_with_; | |
| 702 StrictMode strict_mode_; | 690 StrictMode strict_mode_; |
| 703 }; | 691 }; |
| 704 | 692 |
| 705 | 693 |
| 706 class PreParserFactory { | 694 class PreParserFactory { |
| 707 public: | 695 public: |
| 708 explicit PreParserFactory(void* extra_param) {} | 696 explicit PreParserFactory(void* extra_param) {} |
| 709 PreParserExpression NewLiteral(PreParserIdentifier identifier, | 697 PreParserExpression NewLiteral(PreParserIdentifier identifier, |
| 710 int pos) { | 698 int pos) { |
| 711 return PreParserExpression::Default(); | 699 return PreParserExpression::Default(); |
| (...skipping 1450 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2162 "accessor_get_set"); | 2150 "accessor_get_set"); |
| 2163 } | 2151 } |
| 2164 *ok = false; | 2152 *ok = false; |
| 2165 } | 2153 } |
| 2166 } | 2154 } |
| 2167 | 2155 |
| 2168 | 2156 |
| 2169 } } // v8::internal | 2157 } } // v8::internal |
| 2170 | 2158 |
| 2171 #endif // V8_PREPARSER_H | 2159 #endif // V8_PREPARSER_H |
| OLD | NEW |