| 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/ast.h" | 8 #include "src/ast/ast.h" |
| 9 #include "src/ast/scopes.h" | 9 #include "src/ast/scopes.h" |
| 10 #include "src/bailout-reason.h" | 10 #include "src/bailout-reason.h" |
| (...skipping 2155 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2166 if (has_initializer) { | 2166 if (has_initializer) { |
| 2167 value = this->ParseAssignmentExpression( | 2167 value = this->ParseAssignmentExpression( |
| 2168 true, CHECK_OK_CUSTOM(EmptyFunctionLiteral)); | 2168 true, CHECK_OK_CUSTOM(EmptyFunctionLiteral)); |
| 2169 impl()->RewriteNonPattern(CHECK_OK_CUSTOM(EmptyFunctionLiteral)); | 2169 impl()->RewriteNonPattern(CHECK_OK_CUSTOM(EmptyFunctionLiteral)); |
| 2170 } else { | 2170 } else { |
| 2171 value = factory()->NewUndefinedLiteral(kNoSourcePosition); | 2171 value = factory()->NewUndefinedLiteral(kNoSourcePosition); |
| 2172 } | 2172 } |
| 2173 initializer_scope->set_end_position(scanner()->location().end_pos); | 2173 initializer_scope->set_end_position(scanner()->location().end_pos); |
| 2174 typename Types::StatementList body = impl()->NewStatementList(1); | 2174 typename Types::StatementList body = impl()->NewStatementList(1); |
| 2175 body->Add(factory()->NewReturnStatement(value, kNoSourcePosition), zone()); | 2175 body->Add(factory()->NewReturnStatement(value, kNoSourcePosition), zone()); |
| 2176 initializer_scope->DeclareArguments(ast_value_factory()); |
| 2176 FunctionLiteralT function_literal = factory()->NewFunctionLiteral( | 2177 FunctionLiteralT function_literal = factory()->NewFunctionLiteral( |
| 2177 impl()->EmptyIdentifierString(), initializer_scope, body, | 2178 impl()->EmptyIdentifierString(), initializer_scope, body, |
| 2178 initializer_state.materialized_literal_count(), | 2179 initializer_state.materialized_literal_count(), |
| 2179 initializer_state.expected_property_count(), 0, | 2180 initializer_state.expected_property_count(), 0, |
| 2180 FunctionLiteral::kNoDuplicateParameters, | 2181 FunctionLiteral::kNoDuplicateParameters, |
| 2181 FunctionLiteral::kAnonymousExpression, | 2182 FunctionLiteral::kAnonymousExpression, |
| 2182 FunctionLiteral::kShouldLazyCompile, kind, | 2183 FunctionLiteral::kShouldLazyCompile, kind, |
| 2183 initializer_scope->start_position()); | 2184 initializer_scope->start_position()); |
| 2184 function_literal->set_is_class_field_initializer(true); | 2185 function_literal->set_is_class_field_initializer(true); |
| 2185 return function_literal; | 2186 return function_literal; |
| (...skipping 2122 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 4308 has_seen_constructor_ = true; | 4309 has_seen_constructor_ = true; |
| 4309 return; | 4310 return; |
| 4310 } | 4311 } |
| 4311 } | 4312 } |
| 4312 | 4313 |
| 4313 | 4314 |
| 4314 } // namespace internal | 4315 } // namespace internal |
| 4315 } // namespace v8 | 4316 } // namespace v8 |
| 4316 | 4317 |
| 4317 #endif // V8_PARSING_PARSER_BASE_H | 4318 #endif // V8_PARSING_PARSER_BASE_H |
| OLD | NEW |