Chromium Code Reviews| 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_PREPARSER_H | 5 #ifndef V8_PREPARSER_H |
| 6 #define V8_PREPARSER_H | 6 #define V8_PREPARSER_H |
| 7 | 7 |
| 8 #include "src/v8.h" | 8 #include "src/v8.h" |
| 9 | 9 |
| 10 #include "src/bailout-reason.h" | 10 #include "src/bailout-reason.h" |
| (...skipping 2828 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 2839 // When parsing a TemplateLiteral, we must have scanned either an initial | 2839 // When parsing a TemplateLiteral, we must have scanned either an initial |
| 2840 // TEMPLATE_SPAN, or a TEMPLATE_TAIL. | 2840 // TEMPLATE_SPAN, or a TEMPLATE_TAIL. |
| 2841 CHECK(peek() == Token::TEMPLATE_SPAN || peek() == Token::TEMPLATE_TAIL); | 2841 CHECK(peek() == Token::TEMPLATE_SPAN || peek() == Token::TEMPLATE_TAIL); |
| 2842 | 2842 |
| 2843 // If we reach a TEMPLATE_TAIL first, we are parsing a NoSubstitutionTemplate. | 2843 // If we reach a TEMPLATE_TAIL first, we are parsing a NoSubstitutionTemplate. |
| 2844 // In this case we may simply consume the token and build a template with a | 2844 // In this case we may simply consume the token and build a template with a |
| 2845 // single TEMPLATE_SPAN and no expressions. | 2845 // single TEMPLATE_SPAN and no expressions. |
| 2846 if (peek() == Token::TEMPLATE_TAIL) { | 2846 if (peek() == Token::TEMPLATE_TAIL) { |
| 2847 Consume(Token::TEMPLATE_TAIL); | 2847 Consume(Token::TEMPLATE_TAIL); |
| 2848 int pos = position(); | 2848 int pos = position(); |
| 2849 CheckOctalLiteral(pos, peek_position(), CHECK_OK); | |
|
arv (Not doing code reviews)
2014/12/18 20:38:51
CheckOctalLiteral needs to be updated to use a dif
caitp (gmail)
2014/12/18 20:44:18
Yeah --- I was undecided whether it should be some
arv (Not doing code reviews)
2014/12/18 20:46:58
I think a new error message would be best.
caitp (gmail)
2014/12/18 21:09:50
Done and done
| |
| 2849 typename Traits::TemplateLiteralState ts = Traits::OpenTemplateLiteral(pos); | 2850 typename Traits::TemplateLiteralState ts = Traits::OpenTemplateLiteral(pos); |
| 2850 Traits::AddTemplateSpan(&ts, true); | 2851 Traits::AddTemplateSpan(&ts, true); |
| 2851 return Traits::CloseTemplateLiteral(&ts, start, tag); | 2852 return Traits::CloseTemplateLiteral(&ts, start, tag); |
| 2852 } | 2853 } |
| 2853 | 2854 |
| 2854 Consume(Token::TEMPLATE_SPAN); | 2855 Consume(Token::TEMPLATE_SPAN); |
| 2855 int pos = position(); | 2856 int pos = position(); |
| 2856 typename Traits::TemplateLiteralState ts = Traits::OpenTemplateLiteral(pos); | 2857 typename Traits::TemplateLiteralState ts = Traits::OpenTemplateLiteral(pos); |
| 2857 Traits::AddTemplateSpan(&ts, false); | 2858 Traits::AddTemplateSpan(&ts, false); |
| 2858 Token::Value next; | 2859 Token::Value next; |
| (...skipping 31 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 2890 ReportMessageAt(Scanner::Location(start, position()), | 2891 ReportMessageAt(Scanner::Location(start, position()), |
| 2891 "unterminated_template"); | 2892 "unterminated_template"); |
| 2892 *ok = false; | 2893 *ok = false; |
| 2893 return Traits::EmptyExpression(); | 2894 return Traits::EmptyExpression(); |
| 2894 } | 2895 } |
| 2895 | 2896 |
| 2896 Traits::AddTemplateSpan(&ts, next == Token::TEMPLATE_TAIL); | 2897 Traits::AddTemplateSpan(&ts, next == Token::TEMPLATE_TAIL); |
| 2897 } while (next == Token::TEMPLATE_SPAN); | 2898 } while (next == Token::TEMPLATE_SPAN); |
| 2898 | 2899 |
| 2899 DCHECK_EQ(next, Token::TEMPLATE_TAIL); | 2900 DCHECK_EQ(next, Token::TEMPLATE_TAIL); |
| 2901 CheckOctalLiteral(pos, peek_position(), CHECK_OK); | |
| 2900 // Once we've reached a TEMPLATE_TAIL, we can close the TemplateLiteral. | 2902 // Once we've reached a TEMPLATE_TAIL, we can close the TemplateLiteral. |
| 2901 return Traits::CloseTemplateLiteral(&ts, start, tag); | 2903 return Traits::CloseTemplateLiteral(&ts, start, tag); |
| 2902 } | 2904 } |
| 2903 | 2905 |
| 2904 | 2906 |
| 2905 template <typename Traits> | 2907 template <typename Traits> |
| 2906 typename ParserBase<Traits>::ExpressionT ParserBase< | 2908 typename ParserBase<Traits>::ExpressionT ParserBase< |
| 2907 Traits>::CheckAndRewriteReferenceExpression(ExpressionT expression, | 2909 Traits>::CheckAndRewriteReferenceExpression(ExpressionT expression, |
| 2908 Scanner::Location location, | 2910 Scanner::Location location, |
| 2909 const char* message, bool* ok) { | 2911 const char* message, bool* ok) { |
| (...skipping 44 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 2954 DCHECK(IsAccessorAccessorConflict(old_type, type)); | 2956 DCHECK(IsAccessorAccessorConflict(old_type, type)); |
| 2955 // Both accessors of the same type. | 2957 // Both accessors of the same type. |
| 2956 parser()->ReportMessage("accessor_get_set"); | 2958 parser()->ReportMessage("accessor_get_set"); |
| 2957 } | 2959 } |
| 2958 *ok = false; | 2960 *ok = false; |
| 2959 } | 2961 } |
| 2960 } | 2962 } |
| 2961 } } // v8::internal | 2963 } } // v8::internal |
| 2962 | 2964 |
| 2963 #endif // V8_PREPARSER_H | 2965 #endif // V8_PREPARSER_H |
| OLD | NEW |