Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(43)

Side by Side Diff: src/preparser.h

Issue 1024063002: [strong] checking of this & super in constructors (Closed) Base URL: https://chromium.googlesource.com/v8/v8.git@master
Patch Set: Typo Created 5 years, 9 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
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 199 matching lines...) Expand 10 before | Expand all | Expand 10 after
210 int materialized_literal_count() { 210 int materialized_literal_count() {
211 return next_materialized_literal_index_; 211 return next_materialized_literal_index_;
212 } 212 }
213 213
214 int NextHandlerIndex() { return next_handler_index_++; } 214 int NextHandlerIndex() { return next_handler_index_++; }
215 int handler_count() { return next_handler_index_; } 215 int handler_count() { return next_handler_index_; }
216 216
217 void AddProperty() { expected_property_count_++; } 217 void AddProperty() { expected_property_count_++; }
218 int expected_property_count() { return expected_property_count_; } 218 int expected_property_count() { return expected_property_count_; }
219 219
220 Scanner::Location this_location() const { return this_location_; }
221 Scanner::Location super_location() const { return super_location_; }
220 Scanner::Location return_location() const { return return_location_; } 222 Scanner::Location return_location() const { return return_location_; }
221 Scanner::Location super_call_location() const { 223 void set_this_location(Scanner::Location location) {
222 return super_call_location_; 224 this_location_ = location;
225 }
226 void set_super_location(Scanner::Location location) {
227 super_location_ = location;
223 } 228 }
224 void set_return_location(Scanner::Location location) { 229 void set_return_location(Scanner::Location location) {
225 return_location_ = location; 230 return_location_ = location;
226 } 231 }
227 void set_super_call_location(Scanner::Location location) {
228 super_call_location_ = location;
229 }
230 232
231 bool is_generator() const { return IsGeneratorFunction(kind_); } 233 bool is_generator() const { return IsGeneratorFunction(kind_); }
232 234
233 FunctionKind kind() const { return kind_; } 235 FunctionKind kind() const { return kind_; }
234 FunctionState* outer() const { return outer_function_state_; } 236 FunctionState* outer() const { return outer_function_state_; }
235 237
236 void set_generator_object_variable( 238 void set_generator_object_variable(
237 typename Traits::Type::GeneratorVariable* variable) { 239 typename Traits::Type::GeneratorVariable* variable) {
238 DCHECK(variable != NULL); 240 DCHECK(variable != NULL);
239 DCHECK(is_generator()); 241 DCHECK(is_generator());
(...skipping 11 matching lines...) Expand all
251 // the function. Includes regexp literals, and boilerplate for object and 253 // the function. Includes regexp literals, and boilerplate for object and
252 // array literals. 254 // array literals.
253 int next_materialized_literal_index_; 255 int next_materialized_literal_index_;
254 256
255 // Used to assign a per-function index to try and catch handlers. 257 // Used to assign a per-function index to try and catch handlers.
256 int next_handler_index_; 258 int next_handler_index_;
257 259
258 // Properties count estimation. 260 // Properties count estimation.
259 int expected_property_count_; 261 int expected_property_count_;
260 262
263 // Location of most recent use of 'this' (invalid if none).
264 Scanner::Location this_location_;
265
261 // Location of most recent 'return' statement (invalid if none). 266 // Location of most recent 'return' statement (invalid if none).
262 Scanner::Location return_location_; 267 Scanner::Location return_location_;
263 268
264 // Location of call to the "super" constructor (invalid if none). 269 // Location of call to the "super" constructor (invalid if none).
265 Scanner::Location super_call_location_; 270 Scanner::Location super_location_;
266 271
267 FunctionKind kind_; 272 FunctionKind kind_;
268 // For generators, this variable may hold the generator object. It variable 273 // For generators, this variable may hold the generator object. It variable
269 // is used by yield expressions and return statements. It is not necessary 274 // is used by yield expressions and return statements. It is not necessary
270 // for generator functions to have this variable set. 275 // for generator functions to have this variable set.
271 Variable* generator_object_variable_; 276 Variable* generator_object_variable_;
272 277
273 FunctionState** function_state_stack_; 278 FunctionState** function_state_stack_;
274 FunctionState* outer_function_state_; 279 FunctionState* outer_function_state_;
275 Scope** scope_stack_; 280 Scope** scope_stack_;
(...skipping 321 matching lines...) Expand 10 before | Expand all | Expand 10 after
597 ExpressionT ParseLeftHandSideExpression(bool* ok); 602 ExpressionT ParseLeftHandSideExpression(bool* ok);
598 ExpressionT ParseMemberWithNewPrefixesExpression(bool* ok); 603 ExpressionT ParseMemberWithNewPrefixesExpression(bool* ok);
599 ExpressionT ParseMemberExpression(bool* ok); 604 ExpressionT ParseMemberExpression(bool* ok);
600 ExpressionT ParseMemberExpressionContinuation(ExpressionT expression, 605 ExpressionT ParseMemberExpressionContinuation(ExpressionT expression,
601 bool* ok); 606 bool* ok);
602 ExpressionT ParseArrowFunctionLiteral(int start_pos, ExpressionT params_ast, 607 ExpressionT ParseArrowFunctionLiteral(int start_pos, ExpressionT params_ast,
603 bool* ok); 608 bool* ok);
604 ExpressionT ParseTemplateLiteral(ExpressionT tag, int start, bool* ok); 609 ExpressionT ParseTemplateLiteral(ExpressionT tag, int start, bool* ok);
605 void AddTemplateExpression(ExpressionT); 610 void AddTemplateExpression(ExpressionT);
606 ExpressionT ParseSuperExpression(bool is_new, bool* ok); 611 ExpressionT ParseSuperExpression(bool is_new, bool* ok);
612 ExpressionT ParseStrongInitializationExpression(bool* ok);
613 ExpressionT ParseStrongSuperCallExpression(bool* ok);
607 614
608 // Checks if the expression is a valid reference expression (e.g., on the 615 // Checks if the expression is a valid reference expression (e.g., on the
609 // left-hand side of assignments). Although ruled out by ECMA as early errors, 616 // left-hand side of assignments). Although ruled out by ECMA as early errors,
610 // we allow calls for web compatibility and rewrite them to a runtime throw. 617 // we allow calls for web compatibility and rewrite them to a runtime throw.
611 ExpressionT CheckAndRewriteReferenceExpression( 618 ExpressionT CheckAndRewriteReferenceExpression(
612 ExpressionT expression, 619 ExpressionT expression,
613 Scanner::Location location, const char* message, bool* ok); 620 Scanner::Location location, const char* message, bool* ok);
614 621
615 // Used to validate property names in object literals and class literals 622 // Used to validate property names in object literals and class literals
616 enum PropertyKind { 623 enum PropertyKind {
(...skipping 1050 matching lines...) Expand 10 before | Expand all | Expand 10 after
1667 } 1674 }
1668 1675
1669 1676
1670 template <class Traits> 1677 template <class Traits>
1671 ParserBase<Traits>::FunctionState::FunctionState( 1678 ParserBase<Traits>::FunctionState::FunctionState(
1672 FunctionState** function_state_stack, Scope** scope_stack, Scope* scope, 1679 FunctionState** function_state_stack, Scope** scope_stack, Scope* scope,
1673 FunctionKind kind, typename Traits::Type::Factory* factory) 1680 FunctionKind kind, typename Traits::Type::Factory* factory)
1674 : next_materialized_literal_index_(0), 1681 : next_materialized_literal_index_(0),
1675 next_handler_index_(0), 1682 next_handler_index_(0),
1676 expected_property_count_(0), 1683 expected_property_count_(0),
1684 this_location_(Scanner::Location::invalid()),
1677 return_location_(Scanner::Location::invalid()), 1685 return_location_(Scanner::Location::invalid()),
1678 super_call_location_(Scanner::Location::invalid()), 1686 super_location_(Scanner::Location::invalid()),
1679 kind_(kind), 1687 kind_(kind),
1680 generator_object_variable_(NULL), 1688 generator_object_variable_(NULL),
1681 function_state_stack_(function_state_stack), 1689 function_state_stack_(function_state_stack),
1682 outer_function_state_(*function_state_stack), 1690 outer_function_state_(*function_state_stack),
1683 scope_stack_(scope_stack), 1691 scope_stack_(scope_stack),
1684 outer_scope_(*scope_stack), 1692 outer_scope_(*scope_stack),
1685 factory_(factory) { 1693 factory_(factory) {
1686 *scope_stack_ = scope; 1694 *scope_stack_ = scope;
1687 *function_state_stack = this; 1695 *function_state_stack = this;
1688 } 1696 }
(...skipping 192 matching lines...) Expand 10 before | Expand all | Expand 10 after
1881 // '(' Expression ')' 1889 // '(' Expression ')'
1882 // TemplateLiteral 1890 // TemplateLiteral
1883 1891
1884 int beg_pos = scanner()->peek_location().beg_pos; 1892 int beg_pos = scanner()->peek_location().beg_pos;
1885 int end_pos = scanner()->peek_location().end_pos; 1893 int end_pos = scanner()->peek_location().end_pos;
1886 ExpressionT result = this->EmptyExpression(); 1894 ExpressionT result = this->EmptyExpression();
1887 Token::Value token = peek(); 1895 Token::Value token = peek();
1888 switch (token) { 1896 switch (token) {
1889 case Token::THIS: { 1897 case Token::THIS: {
1890 Consume(Token::THIS); 1898 Consume(Token::THIS);
1899 if (is_strong(language_mode())) {
1900 // Constructors' usages of 'this' in strong mode are parsed separately.
1901 // TODO(rossberg): this does not work with arrow functions yet.
1902 if (i::IsConstructor(function_state_->kind())) {
1903 ReportMessage("strong_constructor_this");
1904 *ok = false;
1905 break;
1906 }
1907 }
1891 scope_->RecordThisUsage(); 1908 scope_->RecordThisUsage();
1892 result = this->ThisExpression(scope_, factory(), beg_pos); 1909 result = this->ThisExpression(scope_, factory(), beg_pos);
1893 break; 1910 break;
1894 } 1911 }
1895 1912
1896 case Token::NULL_LITERAL: 1913 case Token::NULL_LITERAL:
1897 case Token::TRUE_LITERAL: 1914 case Token::TRUE_LITERAL:
1898 case Token::FALSE_LITERAL: 1915 case Token::FALSE_LITERAL:
1899 case Token::SMI: 1916 case Token::SMI:
1900 case Token::NUMBER: 1917 case Token::NUMBER:
(...skipping 50 matching lines...) Expand 10 before | Expand all | Expand 10 after
1951 parenthesized_function_ = (peek() == Token::FUNCTION); 1968 parenthesized_function_ = (peek() == Token::FUNCTION);
1952 result = this->ParseExpression(true, CHECK_OK); 1969 result = this->ParseExpression(true, CHECK_OK);
1953 result->increase_parenthesization_level(); 1970 result->increase_parenthesization_level();
1954 Expect(Token::RPAREN, CHECK_OK); 1971 Expect(Token::RPAREN, CHECK_OK);
1955 } 1972 }
1956 break; 1973 break;
1957 1974
1958 case Token::CLASS: { 1975 case Token::CLASS: {
1959 Consume(Token::CLASS); 1976 Consume(Token::CLASS);
1960 if (!allow_harmony_sloppy() && is_sloppy(language_mode())) { 1977 if (!allow_harmony_sloppy() && is_sloppy(language_mode())) {
1961 ReportMessage("sloppy_lexical", NULL); 1978 ReportMessage("sloppy_lexical");
1962 *ok = false; 1979 *ok = false;
1963 break; 1980 break;
1964 } 1981 }
1965 int class_token_position = position(); 1982 int class_token_position = position();
1966 IdentifierT name = this->EmptyIdentifier(); 1983 IdentifierT name = this->EmptyIdentifier();
1967 bool is_strict_reserved_name = false; 1984 bool is_strict_reserved_name = false;
1968 Scanner::Location class_name_location = Scanner::Location::invalid(); 1985 Scanner::Location class_name_location = Scanner::Location::invalid();
1969 if (peek_any_identifier()) { 1986 if (peek_any_identifier()) {
1970 name = ParseIdentifierOrStrictReservedWord(&is_strict_reserved_name, 1987 name = ParseIdentifierOrStrictReservedWord(&is_strict_reserved_name,
1971 CHECK_OK); 1988 CHECK_OK);
(...skipping 806 matching lines...) Expand 10 before | Expand all | Expand 10 after
2778 result = ParsePrimaryExpression(CHECK_OK); 2795 result = ParsePrimaryExpression(CHECK_OK);
2779 } 2796 }
2780 2797
2781 result = ParseMemberExpressionContinuation(result, CHECK_OK); 2798 result = ParseMemberExpressionContinuation(result, CHECK_OK);
2782 return result; 2799 return result;
2783 } 2800 }
2784 2801
2785 2802
2786 template <class Traits> 2803 template <class Traits>
2787 typename ParserBase<Traits>::ExpressionT 2804 typename ParserBase<Traits>::ExpressionT
2805 ParserBase<Traits>::ParseStrongInitializationExpression(bool* ok) {
2806 // InitializationExpression :: (strong mode)
2807 // 'this' '.' IdentifierName '=' AssignmentExpression
2808 // 'this' '[' Expression ']' '=' AssignmentExpression
2809
2810 Consume(Token::THIS);
2811 int pos = position();
2812 function_state_->set_this_location(scanner()->location());
2813 scope_->RecordThisUsage();
2814 ExpressionT this_expr = this->ThisExpression(scope_, factory(), pos);
2815
2816 ExpressionT left = this->EmptyExpression();
2817 switch (peek()) {
2818 case Token::LBRACK: {
2819 Consume(Token::LBRACK);
2820 int pos = position();
2821 ExpressionT index = this->ParseExpression(true, CHECK_OK);
2822 left = factory()->NewProperty(this_expr, index, pos);
2823 if (fni_ != NULL) {
2824 this->PushPropertyName(fni_, index);
2825 }
2826 Expect(Token::RBRACK, CHECK_OK);
2827 break;
2828 }
2829 case Token::PERIOD: {
2830 Consume(Token::PERIOD);
2831 int pos = position();
2832 IdentifierT name = ParseIdentifierName(CHECK_OK);
2833 left = factory()->NewProperty(
2834 this_expr, factory()->NewStringLiteral(name, pos), pos);
2835 if (fni_ != NULL) {
2836 this->PushLiteralName(fni_, name);
2837 }
2838 break;
2839 }
2840 default:
2841 ReportMessage("strong_constructor_this");
2842 *ok = false;
2843 return this->EmptyExpression();
2844 }
2845
2846 if (peek() != Token::ASSIGN) {
2847 ReportMessageAt(function_state_->this_location(),
2848 "strong_constructor_this");
2849 *ok = false;
2850 return this->EmptyExpression();
2851 }
2852 Consume(Token::ASSIGN);
2853 left = this->MarkExpressionAsAssigned(left);
2854
2855 ExpressionT right = this->ParseAssignmentExpression(true, CHECK_OK);
2856 this->CheckAssigningFunctionLiteralToProperty(left, right);
2857 function_state_->AddProperty();
2858 if (fni_ != NULL) {
2859 // Check if the right hand side is a call to avoid inferring a
2860 // name if we're dealing with "this.a = function(){...}();"-like
2861 // expression.
2862 if (!right->IsCall() && !right->IsCallNew()) {
2863 fni_->Infer();
2864 } else {
2865 fni_->RemoveLastFunction();
2866 }
2867 fni_->Leave();
2868 }
2869
2870 if (function_state_->return_location().IsValid()) {
2871 ReportMessageAt(function_state_->return_location(),
2872 "strong_constructor_return_misplaced");
2873 *ok = false;
2874 return this->EmptyExpression();
2875 }
2876
2877 return factory()->NewAssignment(Token::ASSIGN, left, right, pos);
2878 }
2879
2880
2881 template <class Traits>
2882 typename ParserBase<Traits>::ExpressionT
2883 ParserBase<Traits>::ParseStrongSuperCallExpression(bool* ok) {
2884 // SuperCallExpression :: (strong mode)
2885 // 'super' '(' ExpressionList ')'
2886
2887 Consume(Token::SUPER);
2888 int pos = position();
2889 Scanner::Location super_loc = scanner()->location();
2890 ExpressionT expr = this->SuperReference(scope_, factory());
2891
2892 if (peek() != Token::LPAREN) {
2893 ReportMessage("strong_constructor_super");
2894 *ok = false;
2895 return this->EmptyExpression();
2896 }
2897
2898 typename Traits::Type::ExpressionList args = ParseArguments(CHECK_OK);
2899
2900 // TODO(rossberg): This doesn't work with arrow functions yet.
2901 if (!IsSubclassConstructor(function_state_->kind())) {
2902 ReportMessage("unexpected_super");
2903 *ok = false;
2904 return this->EmptyExpression();
2905 } else if (function_state_->super_location().IsValid()) {
2906 ReportMessageAt(scanner()->location(), "strong_super_call_duplicate");
2907 *ok = false;
2908 return this->EmptyExpression();
2909 } else if (function_state_->this_location().IsValid()) {
2910 ReportMessageAt(scanner()->location(), "strong_super_call_misplaced");
2911 *ok = false;
2912 return this->EmptyExpression();
2913 } else if (function_state_->return_location().IsValid()) {
2914 ReportMessageAt(function_state_->return_location(),
2915 "strong_constructor_return_misplaced");
2916 *ok = false;
2917 return this->EmptyExpression();
2918 }
2919
2920 function_state_->set_super_location(super_loc);
2921 return factory()->NewCall(expr, args, pos);
2922 }
2923
2924
2925 template <class Traits>
2926 typename ParserBase<Traits>::ExpressionT
2788 ParserBase<Traits>::ParseSuperExpression(bool is_new, bool* ok) { 2927 ParserBase<Traits>::ParseSuperExpression(bool is_new, bool* ok) {
2789 Expect(Token::SUPER, CHECK_OK); 2928 Expect(Token::SUPER, CHECK_OK);
2790 2929
2930 // TODO(aperez): Does this actually work with lazily compiled arrows?
2791 FunctionState* function_state = function_state_; 2931 FunctionState* function_state = function_state_;
2792 while (IsArrowFunction(function_state->kind())) { 2932 while (IsArrowFunction(function_state->kind())) {
2793 function_state = function_state->outer(); 2933 function_state = function_state->outer();
2794 } 2934 }
2795 // TODO(arv): Handle eval scopes similarly. 2935 // TODO(arv): Handle eval scopes similarly.
2796 2936
2797 FunctionKind kind = function_state->kind(); 2937 FunctionKind kind = function_state->kind();
2798 if (IsConciseMethod(kind) || IsAccessorFunction(kind) || 2938 if (IsConciseMethod(kind) || IsAccessorFunction(kind) ||
2799 i::IsConstructor(kind)) { 2939 i::IsConstructor(kind)) {
2800 if (peek() == Token::PERIOD || peek() == Token::LBRACK) { 2940 if (peek() == Token::PERIOD || peek() == Token::LBRACK) {
2801 scope_->RecordSuperPropertyUsage(); 2941 scope_->RecordSuperPropertyUsage();
2802 return this->SuperReference(scope_, factory()); 2942 return this->SuperReference(scope_, factory());
2803 } 2943 }
2804 // new super() is never allowed. 2944 // new super() is never allowed.
2805 // super() is only allowed in derived constructor 2945 // super() is only allowed in derived constructor
2806 if (!is_new && peek() == Token::LPAREN && IsSubclassConstructor(kind)) { 2946 if (!is_new && peek() == Token::LPAREN && IsSubclassConstructor(kind)) {
2807 if (is_strong(language_mode())) { 2947 if (is_strong(language_mode())) {
2808 if (function_state->super_call_location().IsValid()) { 2948 // Super calls in strong mode are parsed separately.
2809 ReportMessageAt(scanner()->location(), "strong_super_call_duplicate"); 2949 ReportMessageAt(scanner()->location(), "strong_constructor_super");
2810 *ok = false; 2950 *ok = false;
2811 return this->EmptyExpression(); 2951 return this->EmptyExpression();
2812 } else if (function_state->return_location().IsValid()) {
2813 ReportMessageAt(function_state->return_location(),
2814 "strong_constructor_return_misplaced");
2815 *ok = false;
2816 return this->EmptyExpression();
2817 }
2818 } 2952 }
2819 function_state->set_super_call_location(scanner()->location()); 2953 function_state->set_super_location(scanner()->location());
2820 return this->SuperReference(scope_, factory()); 2954 return this->SuperReference(scope_, factory());
2821 } 2955 }
2822 } 2956 }
2823 2957
2824 ReportMessageAt(scanner()->location(), "unexpected_super"); 2958 ReportMessageAt(scanner()->location(), "unexpected_super");
2825 *ok = false; 2959 *ok = false;
2826 return this->EmptyExpression(); 2960 return this->EmptyExpression();
2827 } 2961 }
2828 2962
2829 2963
(...skipping 121 matching lines...) Expand 10 before | Expand all | Expand 10 after
2951 // Single-expression body 3085 // Single-expression body
2952 int pos = position(); 3086 int pos = position();
2953 parenthesized_function_ = false; 3087 parenthesized_function_ = false;
2954 ExpressionT expression = ParseAssignmentExpression(true, CHECK_OK); 3088 ExpressionT expression = ParseAssignmentExpression(true, CHECK_OK);
2955 body = this->NewStatementList(1, zone()); 3089 body = this->NewStatementList(1, zone());
2956 body->Add(factory()->NewReturnStatement(expression, pos), zone()); 3090 body->Add(factory()->NewReturnStatement(expression, pos), zone());
2957 materialized_literal_count = function_state.materialized_literal_count(); 3091 materialized_literal_count = function_state.materialized_literal_count();
2958 expected_property_count = function_state.expected_property_count(); 3092 expected_property_count = function_state.expected_property_count();
2959 handler_count = function_state.handler_count(); 3093 handler_count = function_state.handler_count();
2960 } 3094 }
2961 super_loc = function_state.super_call_location(); 3095 super_loc = function_state.super_location();
2962 3096
2963 scope->set_start_position(start_pos); 3097 scope->set_start_position(start_pos);
2964 scope->set_end_position(scanner()->location().end_pos); 3098 scope->set_end_position(scanner()->location().end_pos);
2965 3099
2966 // Arrow function *parameter lists* are always checked as in strict mode. 3100 // Arrow function *parameter lists* are always checked as in strict mode.
2967 // TODO(arv): eval_args_error_loc and reserved_loc needs to be set by 3101 // TODO(arv): eval_args_error_loc and reserved_loc needs to be set by
2968 // DeclareArrowParametersFromExpression. 3102 // DeclareArrowParametersFromExpression.
2969 Scanner::Location eval_args_error_loc = Scanner::Location::invalid(); 3103 Scanner::Location eval_args_error_loc = Scanner::Location::invalid();
2970 Scanner::Location reserved_loc = Scanner::Location::invalid(); 3104 Scanner::Location reserved_loc = Scanner::Location::invalid();
2971 const bool use_strict_params = true; 3105 const bool use_strict_params = true;
(...skipping 10 matching lines...) Expand all
2982 3116
2983 FunctionLiteralT function_literal = factory()->NewFunctionLiteral( 3117 FunctionLiteralT function_literal = factory()->NewFunctionLiteral(
2984 this->EmptyIdentifierString(), ast_value_factory(), scope, body, 3118 this->EmptyIdentifierString(), ast_value_factory(), scope, body,
2985 materialized_literal_count, expected_property_count, handler_count, 3119 materialized_literal_count, expected_property_count, handler_count,
2986 num_parameters, FunctionLiteral::kNoDuplicateParameters, 3120 num_parameters, FunctionLiteral::kNoDuplicateParameters,
2987 FunctionLiteral::ANONYMOUS_EXPRESSION, FunctionLiteral::kIsFunction, 3121 FunctionLiteral::ANONYMOUS_EXPRESSION, FunctionLiteral::kIsFunction,
2988 FunctionLiteral::kNotParenthesized, FunctionKind::kArrowFunction, 3122 FunctionLiteral::kNotParenthesized, FunctionKind::kArrowFunction,
2989 start_pos); 3123 start_pos);
2990 3124
2991 function_literal->set_function_token_position(start_pos); 3125 function_literal->set_function_token_position(start_pos);
2992 if (super_loc.IsValid()) function_state_->set_super_call_location(super_loc); 3126 if (super_loc.IsValid()) function_state_->set_super_location(super_loc);
2993 3127
2994 if (fni_ != NULL) this->InferFunctionName(fni_, function_literal); 3128 if (fni_ != NULL) this->InferFunctionName(fni_, function_literal);
2995 3129
2996 return function_literal; 3130 return function_literal;
2997 } 3131 }
2998 3132
2999 3133
3000 template <typename Traits> 3134 template <typename Traits>
3001 typename ParserBase<Traits>::ExpressionT 3135 typename ParserBase<Traits>::ExpressionT
3002 ParserBase<Traits>::ParseTemplateLiteral(ExpressionT tag, int start, bool* ok) { 3136 ParserBase<Traits>::ParseTemplateLiteral(ExpressionT tag, int start, bool* ok) {
(...skipping 164 matching lines...) Expand 10 before | Expand all | Expand 10 after
3167 *ok = false; 3301 *ok = false;
3168 return; 3302 return;
3169 } 3303 }
3170 has_seen_constructor_ = true; 3304 has_seen_constructor_ = true;
3171 return; 3305 return;
3172 } 3306 }
3173 } 3307 }
3174 } } // v8::internal 3308 } } // v8::internal
3175 3309
3176 #endif // V8_PREPARSER_H 3310 #endif // V8_PREPARSER_H
OLDNEW
« no previous file with comments | « src/parser.cc ('k') | src/preparser.cc » ('j') | test/cctest/test-parsing.cc » ('J')

Powered by Google App Engine
This is Rietveld 408576698