OLD | NEW |
---|---|
1 // Copyright 2015 the V8 project authors. All rights reserved. | 1 // Copyright 2015 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 #include "src/ast.h" | 5 #include "src/ast.h" |
6 #include "src/messages.h" | 6 #include "src/messages.h" |
7 #include "src/parameter-initializer-rewriter.h" | 7 #include "src/parameter-initializer-rewriter.h" |
8 #include "src/parser.h" | 8 #include "src/parser.h" |
9 | 9 |
10 namespace v8 { | 10 namespace v8 { |
11 | 11 |
12 namespace internal { | 12 namespace internal { |
13 | 13 |
14 | 14 |
15 void Parser::PatternRewriter::DeclareAndInitializeVariables( | 15 void Parser::PatternRewriter::DeclareAndInitializeVariables( |
16 Block* block, const DeclarationDescriptor* declaration_descriptor, | 16 Block* block, const DeclarationDescriptor* declaration_descriptor, |
17 const DeclarationParsingResult::Declaration* declaration, | 17 const DeclarationParsingResult::Declaration* declaration, |
18 ZoneList<const AstRawString*>* names, bool* ok) { | 18 ZoneList<const AstRawString*>* names, bool* ok) { |
19 PatternRewriter rewriter; | 19 PatternRewriter rewriter; |
20 | 20 |
21 rewriter.scope_ = declaration_descriptor->scope; | |
22 rewriter.parser_ = declaration_descriptor->parser; | |
23 rewriter.context_ = BINDING; | |
21 rewriter.pattern_ = declaration->pattern; | 24 rewriter.pattern_ = declaration->pattern; |
22 rewriter.initializer_position_ = declaration->initializer_position; | 25 rewriter.initializer_position_ = declaration->initializer_position; |
23 rewriter.block_ = block; | 26 rewriter.block_ = block; |
24 rewriter.descriptor_ = declaration_descriptor; | 27 rewriter.descriptor_ = declaration_descriptor; |
25 rewriter.names_ = names; | 28 rewriter.names_ = names; |
26 rewriter.ok_ = ok; | 29 rewriter.ok_ = ok; |
27 | 30 |
28 rewriter.RecurseIntoSubpattern(rewriter.pattern_, declaration->initializer); | 31 rewriter.RecurseIntoSubpattern(rewriter.pattern_, declaration->initializer); |
29 } | 32 } |
30 | 33 |
31 | 34 |
35 void Parser::PatternRewriter::RewriteDestructuringAssignment( | |
36 Parser* parser, Assignment* assignment, Scope* scope, bool* ok) { | |
37 PatternRewriter rewriter; | |
38 | |
39 DCHECK(assignment->is_destructuring_assignment()); | |
40 DCHECK_EQ(assignment->op(), Token::ASSIGN); | |
41 | |
42 rewriter.scope_ = scope; | |
43 rewriter.parser_ = parser; | |
44 rewriter.context_ = ASSIGNMENT; | |
45 rewriter.pattern_ = assignment; | |
46 rewriter.block_ = nullptr; | |
47 rewriter.descriptor_ = nullptr; | |
48 rewriter.names_ = nullptr; | |
49 rewriter.ok_ = ok; | |
50 | |
51 rewriter.RecurseIntoSubpattern(rewriter.pattern_, nullptr); | |
52 } | |
53 | |
54 | |
32 void Parser::PatternRewriter::VisitVariableProxy(VariableProxy* pattern) { | 55 void Parser::PatternRewriter::VisitVariableProxy(VariableProxy* pattern) { |
33 Expression* value = current_value_; | 56 Expression* value = current_value_; |
57 | |
58 if (IsAssignmentContext()) { | |
59 // In an assignment context, simply perform the assignment | |
60 Assignment* assignment = factory()->NewAssignment( | |
61 Token::ASSIGN, pattern, value, pattern->position()); | |
62 block_->statements()->Add( | |
63 factory()->NewExpressionStatement(assignment, RelocInfo::kNoPosition), | |
64 zone()); | |
65 return; | |
66 } | |
67 | |
34 descriptor_->scope->RemoveUnresolved(pattern); | 68 descriptor_->scope->RemoveUnresolved(pattern); |
35 | 69 |
36 // Declare variable. | 70 // Declare variable. |
37 // Note that we *always* must treat the initial value via a separate init | 71 // Note that we *always* must treat the initial value via a separate init |
38 // assignment for variables and constants because the value must be assigned | 72 // assignment for variables and constants because the value must be assigned |
39 // when the variable is encountered in the source. But the variable/constant | 73 // when the variable is encountered in the source. But the variable/constant |
40 // is declared (and set to 'undefined') upon entering the function within | 74 // is declared (and set to 'undefined') upon entering the function within |
41 // which the variable or constant is declared. Only function variables have | 75 // which the variable or constant is declared. Only function variables have |
42 // an initial value in the declaration (because they are initialized upon | 76 // an initial value in the declaration (because they are initialized upon |
43 // entering the function). | 77 // entering the function). |
44 // | 78 // |
45 // If we have a legacy const declaration, in an inner scope, the proxy | 79 // If we have a legacy const declaration, in an inner scope, the proxy |
46 // is always bound to the declared variable (independent of possibly | 80 // is always bound to the declared variable (independent of possibly |
47 // surrounding 'with' statements). | 81 // surrounding 'with' statements). |
48 // For let/const declarations in harmony mode, we can also immediately | 82 // For let/const declarations in harmony mode, we can also immediately |
49 // pre-resolve the proxy because it resides in the same scope as the | 83 // pre-resolve the proxy because it resides in the same scope as the |
50 // declaration. | 84 // declaration. |
51 Parser* parser = descriptor_->parser; | |
52 const AstRawString* name = pattern->raw_name(); | 85 const AstRawString* name = pattern->raw_name(); |
53 VariableProxy* proxy = parser->NewUnresolved(name, descriptor_->mode); | 86 VariableProxy* proxy = parser_->NewUnresolved(name, descriptor_->mode); |
54 Declaration* declaration = factory()->NewVariableDeclaration( | 87 Declaration* declaration = factory()->NewVariableDeclaration( |
55 proxy, descriptor_->mode, descriptor_->scope, | 88 proxy, descriptor_->mode, descriptor_->scope, |
56 descriptor_->declaration_pos); | 89 descriptor_->declaration_pos); |
57 Variable* var = parser->Declare(declaration, descriptor_->declaration_kind, | 90 Variable* var = |
58 descriptor_->mode != VAR, ok_, | 91 parser_->Declare(declaration, descriptor_->declaration_kind, |
59 descriptor_->hoist_scope); | 92 descriptor_->mode != VAR, ok_, descriptor_->hoist_scope); |
60 if (!*ok_) return; | 93 if (!*ok_) return; |
61 DCHECK_NOT_NULL(var); | 94 DCHECK_NOT_NULL(var); |
62 DCHECK(!proxy->is_resolved() || proxy->var() == var); | 95 DCHECK(!proxy->is_resolved() || proxy->var() == var); |
63 var->set_initializer_position(initializer_position_); | 96 var->set_initializer_position(initializer_position_); |
64 | 97 |
65 DCHECK(initializer_position_ != RelocInfo::kNoPosition); | 98 DCHECK(initializer_position_ != RelocInfo::kNoPosition); |
66 | 99 |
67 if (descriptor_->declaration_scope->num_var_or_const() > | 100 if (descriptor_->declaration_scope->num_var_or_const() > |
68 kMaxNumFunctionLocals) { | 101 kMaxNumFunctionLocals) { |
69 parser->ReportMessage(MessageTemplate::kTooManyVariables); | 102 parser_->ReportMessage(MessageTemplate::kTooManyVariables); |
70 *ok_ = false; | 103 *ok_ = false; |
71 return; | 104 return; |
72 } | 105 } |
73 if (names_) { | 106 if (names_) { |
74 names_->Add(name, zone()); | 107 names_->Add(name, zone()); |
75 } | 108 } |
76 | 109 |
77 // Initialize variables if needed. A | 110 // Initialize variables if needed. A |
78 // declaration of the form: | 111 // declaration of the form: |
79 // | 112 // |
(...skipping 127 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
207 Assignment* assignment = factory()->NewAssignment( | 240 Assignment* assignment = factory()->NewAssignment( |
208 Token::INIT, proxy, value, descriptor_->initialization_pos); | 241 Token::INIT, proxy, value, descriptor_->initialization_pos); |
209 block_->statements()->Add( | 242 block_->statements()->Add( |
210 factory()->NewExpressionStatement(assignment, RelocInfo::kNoPosition), | 243 factory()->NewExpressionStatement(assignment, RelocInfo::kNoPosition), |
211 zone()); | 244 zone()); |
212 } | 245 } |
213 } | 246 } |
214 | 247 |
215 | 248 |
216 Variable* Parser::PatternRewriter::CreateTempVar(Expression* value) { | 249 Variable* Parser::PatternRewriter::CreateTempVar(Expression* value) { |
217 auto temp = descriptor_->parser->scope_->NewTemporary( | 250 auto temp = scope()->NewTemporary(ast_value_factory()->empty_string()); |
218 ast_value_factory()->empty_string()); | |
219 if (value != nullptr) { | 251 if (value != nullptr) { |
220 auto assignment = factory()->NewAssignment( | 252 auto assignment = factory()->NewAssignment( |
221 Token::ASSIGN, factory()->NewVariableProxy(temp), value, | 253 Token::ASSIGN, factory()->NewVariableProxy(temp), value, |
222 RelocInfo::kNoPosition); | 254 RelocInfo::kNoPosition); |
223 | 255 |
224 block_->statements()->Add( | 256 block_->statements()->Add( |
225 factory()->NewExpressionStatement(assignment, RelocInfo::kNoPosition), | 257 factory()->NewExpressionStatement(assignment, RelocInfo::kNoPosition), |
226 zone()); | 258 zone()); |
227 } | 259 } |
228 return temp; | 260 return temp; |
229 } | 261 } |
230 | 262 |
231 | 263 |
232 void Parser::PatternRewriter::VisitObjectLiteral(ObjectLiteral* pattern) { | 264 void Parser::PatternRewriter::VisitObjectLiteral(ObjectLiteral* pattern, |
233 auto temp = CreateTempVar(current_value_); | 265 Variable** temp_var) { |
266 auto temp = *temp_var = CreateTempVar(current_value_); | |
234 | 267 |
235 block_->statements()->Add(descriptor_->parser->BuildAssertIsCoercible(temp), | 268 block_->statements()->Add(parser_->BuildAssertIsCoercible(temp), zone()); |
236 zone()); | |
237 | 269 |
238 for (ObjectLiteralProperty* property : *pattern->properties()) { | 270 for (ObjectLiteralProperty* property : *pattern->properties()) { |
271 PatternContext context = SetInitializerContextIfNeeded(property->value()); | |
239 RecurseIntoSubpattern( | 272 RecurseIntoSubpattern( |
240 property->value(), | 273 property->value(), |
241 factory()->NewProperty(factory()->NewVariableProxy(temp), | 274 factory()->NewProperty(factory()->NewVariableProxy(temp), |
242 property->key(), RelocInfo::kNoPosition)); | 275 property->key(), RelocInfo::kNoPosition)); |
276 set_context(context); | |
adamk
2015/11/25 21:05:28
Can you use an RAII object for this instead of rel
caitp (gmail)
2015/11/25 21:41:51
Doable, but it is (relatively) a lot of code and I
adamk
2015/11/25 21:54:20
I'm ok with this for now if you feel like there ju
| |
243 } | 277 } |
244 } | 278 } |
245 | 279 |
246 | 280 |
247 void Parser::PatternRewriter::VisitArrayLiteral(ArrayLiteral* node) { | 281 void Parser::PatternRewriter::VisitArrayLiteral(ArrayLiteral* node, |
248 auto temp = CreateTempVar(current_value_); | 282 Variable** temp_var) { |
283 auto temp = *temp_var = CreateTempVar(current_value_); | |
249 | 284 |
250 block_->statements()->Add(descriptor_->parser->BuildAssertIsCoercible(temp), | 285 block_->statements()->Add(parser_->BuildAssertIsCoercible(temp), zone()); |
251 zone()); | |
252 | 286 |
253 auto iterator = CreateTempVar(descriptor_->parser->GetIterator( | 287 auto iterator = CreateTempVar( |
254 factory()->NewVariableProxy(temp), factory())); | 288 parser_->GetIterator(factory()->NewVariableProxy(temp), factory())); |
255 auto done = CreateTempVar( | 289 auto done = CreateTempVar( |
256 factory()->NewBooleanLiteral(false, RelocInfo::kNoPosition)); | 290 factory()->NewBooleanLiteral(false, RelocInfo::kNoPosition)); |
257 auto result = CreateTempVar(); | 291 auto result = CreateTempVar(); |
258 auto v = CreateTempVar(); | 292 auto v = CreateTempVar(); |
259 | 293 |
260 Spread* spread = nullptr; | 294 Spread* spread = nullptr; |
261 for (Expression* value : *node->values()) { | 295 for (Expression* value : *node->values()) { |
262 if (value->IsSpread()) { | 296 if (value->IsSpread()) { |
263 spread = value->AsSpread(); | 297 spread = value->AsSpread(); |
264 break; | 298 break; |
265 } | 299 } |
266 | 300 |
301 PatternContext context = SetInitializerContextIfNeeded(value); | |
267 // if (!done) { | 302 // if (!done) { |
268 // result = IteratorNext(iterator); | 303 // result = IteratorNext(iterator); |
269 // v = (done = result.done) ? undefined : result.value; | 304 // v = (done = result.done) ? undefined : result.value; |
270 // } | 305 // } |
271 auto next_block = | 306 auto next_block = |
272 factory()->NewBlock(nullptr, 2, true, RelocInfo::kNoPosition); | 307 factory()->NewBlock(nullptr, 2, true, RelocInfo::kNoPosition); |
273 next_block->statements()->Add( | 308 next_block->statements()->Add(factory()->NewExpressionStatement( |
274 factory()->NewExpressionStatement( | 309 parser_->BuildIteratorNextResult( |
275 descriptor_->parser->BuildIteratorNextResult( | 310 factory()->NewVariableProxy(iterator), |
276 factory()->NewVariableProxy(iterator), result, | 311 result, RelocInfo::kNoPosition), |
277 RelocInfo::kNoPosition), | 312 RelocInfo::kNoPosition), |
278 RelocInfo::kNoPosition), | 313 zone()); |
279 zone()); | |
280 | 314 |
281 auto assign_to_done = factory()->NewAssignment( | 315 auto assign_to_done = factory()->NewAssignment( |
282 Token::ASSIGN, factory()->NewVariableProxy(done), | 316 Token::ASSIGN, factory()->NewVariableProxy(done), |
283 factory()->NewProperty( | 317 factory()->NewProperty( |
284 factory()->NewVariableProxy(result), | 318 factory()->NewVariableProxy(result), |
285 factory()->NewStringLiteral(ast_value_factory()->done_string(), | 319 factory()->NewStringLiteral(ast_value_factory()->done_string(), |
286 RelocInfo::kNoPosition), | 320 RelocInfo::kNoPosition), |
287 RelocInfo::kNoPosition), | 321 RelocInfo::kNoPosition), |
288 RelocInfo::kNoPosition); | 322 RelocInfo::kNoPosition); |
289 auto next_value = factory()->NewConditional( | 323 auto next_value = factory()->NewConditional( |
(...skipping 16 matching lines...) Expand all Loading... | |
306 factory()->NewUnaryOperation(Token::NOT, | 340 factory()->NewUnaryOperation(Token::NOT, |
307 factory()->NewVariableProxy(done), | 341 factory()->NewVariableProxy(done), |
308 RelocInfo::kNoPosition), | 342 RelocInfo::kNoPosition), |
309 next_block, factory()->NewEmptyStatement(RelocInfo::kNoPosition), | 343 next_block, factory()->NewEmptyStatement(RelocInfo::kNoPosition), |
310 RelocInfo::kNoPosition); | 344 RelocInfo::kNoPosition); |
311 block_->statements()->Add(if_statement, zone()); | 345 block_->statements()->Add(if_statement, zone()); |
312 | 346 |
313 if (!(value->IsLiteral() && value->AsLiteral()->raw_value()->IsTheHole())) { | 347 if (!(value->IsLiteral() && value->AsLiteral()->raw_value()->IsTheHole())) { |
314 RecurseIntoSubpattern(value, factory()->NewVariableProxy(v)); | 348 RecurseIntoSubpattern(value, factory()->NewVariableProxy(v)); |
315 } | 349 } |
350 set_context(context); | |
316 } | 351 } |
317 | 352 |
318 if (spread != nullptr) { | 353 if (spread != nullptr) { |
319 // array = []; | 354 // array = []; |
320 // if (!done) %concat_iterable_to_array(array, iterator); | 355 // if (!done) %concat_iterable_to_array(array, iterator); |
321 auto empty_exprs = new (zone()) ZoneList<Expression*>(0, zone()); | 356 auto empty_exprs = new (zone()) ZoneList<Expression*>(0, zone()); |
322 auto array = CreateTempVar(factory()->NewArrayLiteral( | 357 auto array = CreateTempVar(factory()->NewArrayLiteral( |
323 empty_exprs, | 358 empty_exprs, |
324 // Reuse pattern's literal index - it is unused since there is no | 359 // Reuse pattern's literal index - it is unused since there is no |
325 // actual literal allocated. | 360 // actual literal allocated. |
326 node->literal_index(), is_strong(descriptor_->parser->language_mode()), | 361 node->literal_index(), is_strong(scope()->language_mode()), |
327 RelocInfo::kNoPosition)); | 362 RelocInfo::kNoPosition)); |
328 | 363 |
329 auto arguments = new (zone()) ZoneList<Expression*>(2, zone()); | 364 auto arguments = new (zone()) ZoneList<Expression*>(2, zone()); |
330 arguments->Add(factory()->NewVariableProxy(array), zone()); | 365 arguments->Add(factory()->NewVariableProxy(array), zone()); |
331 arguments->Add(factory()->NewVariableProxy(iterator), zone()); | 366 arguments->Add(factory()->NewVariableProxy(iterator), zone()); |
332 auto spread_into_array_call = | 367 auto spread_into_array_call = |
333 factory()->NewCallRuntime(Context::CONCAT_ITERABLE_TO_ARRAY_INDEX, | 368 factory()->NewCallRuntime(Context::CONCAT_ITERABLE_TO_ARRAY_INDEX, |
334 arguments, RelocInfo::kNoPosition); | 369 arguments, RelocInfo::kNoPosition); |
335 | 370 |
336 auto if_statement = factory()->NewIfStatement( | 371 auto if_statement = factory()->NewIfStatement( |
337 factory()->NewUnaryOperation(Token::NOT, | 372 factory()->NewUnaryOperation(Token::NOT, |
338 factory()->NewVariableProxy(done), | 373 factory()->NewVariableProxy(done), |
339 RelocInfo::kNoPosition), | 374 RelocInfo::kNoPosition), |
340 factory()->NewExpressionStatement(spread_into_array_call, | 375 factory()->NewExpressionStatement(spread_into_array_call, |
341 RelocInfo::kNoPosition), | 376 RelocInfo::kNoPosition), |
342 factory()->NewEmptyStatement(RelocInfo::kNoPosition), | 377 factory()->NewEmptyStatement(RelocInfo::kNoPosition), |
343 RelocInfo::kNoPosition); | 378 RelocInfo::kNoPosition); |
344 block_->statements()->Add(if_statement, zone()); | 379 block_->statements()->Add(if_statement, zone()); |
345 | 380 |
346 RecurseIntoSubpattern(spread->expression(), | 381 RecurseIntoSubpattern(spread->expression(), |
347 factory()->NewVariableProxy(array)); | 382 factory()->NewVariableProxy(array)); |
348 } | 383 } |
349 } | 384 } |
350 | 385 |
351 | 386 |
352 void Parser::PatternRewriter::VisitAssignment(Assignment* node) { | 387 void Parser::PatternRewriter::VisitAssignment(Assignment* node) { |
353 // let {<pattern> = <init>} = <value> | 388 if (node->destructuring_assignment()) return; |
354 // becomes | 389 |
355 // temp = <value>; | 390 auto initializer = node->value(); |
356 // <pattern> = temp === undefined ? <init> : temp; | 391 auto value = initializer; |
392 auto temp = CreateTempVar(current_value_); | |
393 | |
394 if (IsInitializerContext()) { | |
395 // let {<pattern> = <init>} = <value> | |
396 // becomes | |
397 // temp = <value>; | |
398 // <pattern> = temp === undefined ? <init> : temp; | |
399 Expression* is_undefined = factory()->NewCompareOperation( | |
400 Token::EQ_STRICT, factory()->NewVariableProxy(temp), | |
401 factory()->NewUndefinedLiteral(RelocInfo::kNoPosition), | |
402 RelocInfo::kNoPosition); | |
403 value = factory()->NewConditional(is_undefined, initializer, | |
404 factory()->NewVariableProxy(temp), | |
405 RelocInfo::kNoPosition); | |
406 } | |
407 | |
408 PatternContext old_context = SetAssignmentContextIfNeeded(initializer); | |
409 if (node->is_destructuring_assignment() && IsAssignmentContext(old_context)) { | |
410 int pos = node->position(); | |
411 Block* old_block = block_; | |
412 block_ = factory()->NewBlock(nullptr, 8, false, pos); | |
413 Variable* temp = nullptr; | |
414 Expression* pattern = node->target(); | |
415 Expression* old_value = current_value_; | |
416 current_value_ = value; | |
417 if (pattern->IsObjectLiteral()) { | |
418 VisitObjectLiteral(pattern->AsObjectLiteral(), &temp); | |
419 } else { | |
420 DCHECK(pattern->IsArrayLiteral()); | |
421 VisitArrayLiteral(pattern->AsArrayLiteral(), &temp); | |
422 } | |
423 DCHECK_NOT_NULL(temp); | |
424 current_value_ = old_value; | |
425 Expression* expr = factory()->NewDoExpression(block_, temp, pos); | |
426 node->set_destructuring_assignment(expr); | |
427 block_ = old_block; | |
428 if (block_) { | |
429 block_->statements()->Add(factory()->NewExpressionStatement(expr, pos), | |
430 zone()); | |
431 } | |
432 return set_context(old_context); | |
433 } | |
434 | |
357 DCHECK(node->op() == Token::ASSIGN); | 435 DCHECK(node->op() == Token::ASSIGN); |
358 auto temp = CreateTempVar(current_value_); | 436 if (IsBindingContext(old_context) && |
359 Expression* is_undefined = factory()->NewCompareOperation( | 437 descriptor_->declaration_kind == DeclarationDescriptor::PARAMETER && |
360 Token::EQ_STRICT, factory()->NewVariableProxy(temp), | 438 scope()->is_arrow_scope()) { |
361 factory()->NewUndefinedLiteral(RelocInfo::kNoPosition), | |
362 RelocInfo::kNoPosition); | |
363 Expression* initializer = node->value(); | |
364 if (descriptor_->declaration_kind == DeclarationDescriptor::PARAMETER && | |
365 descriptor_->scope->is_arrow_scope()) { | |
366 // TODO(adamk): Only call this if necessary. | 439 // TODO(adamk): Only call this if necessary. |
367 RewriteParameterInitializerScope( | 440 RewriteParameterInitializerScope(parser_->stack_limit(), initializer, |
368 descriptor_->parser->stack_limit(), initializer, | 441 scope()->outer_scope(), scope()); |
369 descriptor_->scope->outer_scope(), descriptor_->scope); | |
370 } | 442 } |
371 Expression* value = factory()->NewConditional( | |
372 is_undefined, initializer, factory()->NewVariableProxy(temp), | |
373 RelocInfo::kNoPosition); | |
374 RecurseIntoSubpattern(node->target(), value); | 443 RecurseIntoSubpattern(node->target(), value); |
444 set_context(old_context); | |
375 } | 445 } |
376 | 446 |
377 | 447 |
448 // =============== AssignmentPattern only ================== | |
449 | |
450 void Parser::PatternRewriter::VisitProperty(v8::internal::Property* node) { | |
451 DCHECK(IsAssignmentContext()); | |
452 auto value = current_value_; | |
453 | |
454 Assignment* assignment = | |
455 factory()->NewAssignment(Token::ASSIGN, node, value, node->position()); | |
456 | |
457 block_->statements()->Add( | |
458 factory()->NewExpressionStatement(assignment, RelocInfo::kNoPosition), | |
459 zone()); | |
460 } | |
461 | |
462 | |
378 // =============== UNREACHABLE ============================= | 463 // =============== UNREACHABLE ============================= |
379 | 464 |
380 void Parser::PatternRewriter::Visit(AstNode* node) { UNREACHABLE(); } | 465 void Parser::PatternRewriter::Visit(AstNode* node) { UNREACHABLE(); } |
381 | 466 |
382 #define NOT_A_PATTERN(Node) \ | 467 #define NOT_A_PATTERN(Node) \ |
383 void Parser::PatternRewriter::Visit##Node(v8::internal::Node*) { \ | 468 void Parser::PatternRewriter::Visit##Node(v8::internal::Node*) { \ |
384 UNREACHABLE(); \ | 469 UNREACHABLE(); \ |
385 } | 470 } |
386 | 471 |
387 NOT_A_PATTERN(BinaryOperation) | 472 NOT_A_PATTERN(BinaryOperation) |
(...skipping 17 matching lines...) Expand all Loading... | |
405 NOT_A_PATTERN(ExpressionStatement) | 490 NOT_A_PATTERN(ExpressionStatement) |
406 NOT_A_PATTERN(ForInStatement) | 491 NOT_A_PATTERN(ForInStatement) |
407 NOT_A_PATTERN(ForOfStatement) | 492 NOT_A_PATTERN(ForOfStatement) |
408 NOT_A_PATTERN(ForStatement) | 493 NOT_A_PATTERN(ForStatement) |
409 NOT_A_PATTERN(FunctionDeclaration) | 494 NOT_A_PATTERN(FunctionDeclaration) |
410 NOT_A_PATTERN(FunctionLiteral) | 495 NOT_A_PATTERN(FunctionLiteral) |
411 NOT_A_PATTERN(IfStatement) | 496 NOT_A_PATTERN(IfStatement) |
412 NOT_A_PATTERN(ImportDeclaration) | 497 NOT_A_PATTERN(ImportDeclaration) |
413 NOT_A_PATTERN(Literal) | 498 NOT_A_PATTERN(Literal) |
414 NOT_A_PATTERN(NativeFunctionLiteral) | 499 NOT_A_PATTERN(NativeFunctionLiteral) |
415 NOT_A_PATTERN(Property) | |
416 NOT_A_PATTERN(RegExpLiteral) | 500 NOT_A_PATTERN(RegExpLiteral) |
417 NOT_A_PATTERN(ReturnStatement) | 501 NOT_A_PATTERN(ReturnStatement) |
418 NOT_A_PATTERN(SloppyBlockFunctionStatement) | 502 NOT_A_PATTERN(SloppyBlockFunctionStatement) |
419 NOT_A_PATTERN(Spread) | 503 NOT_A_PATTERN(Spread) |
420 NOT_A_PATTERN(SuperPropertyReference) | 504 NOT_A_PATTERN(SuperPropertyReference) |
421 NOT_A_PATTERN(SuperCallReference) | 505 NOT_A_PATTERN(SuperCallReference) |
422 NOT_A_PATTERN(SwitchStatement) | 506 NOT_A_PATTERN(SwitchStatement) |
423 NOT_A_PATTERN(ThisFunction) | 507 NOT_A_PATTERN(ThisFunction) |
424 NOT_A_PATTERN(Throw) | 508 NOT_A_PATTERN(Throw) |
425 NOT_A_PATTERN(TryCatchStatement) | 509 NOT_A_PATTERN(TryCatchStatement) |
426 NOT_A_PATTERN(TryFinallyStatement) | 510 NOT_A_PATTERN(TryFinallyStatement) |
427 NOT_A_PATTERN(UnaryOperation) | 511 NOT_A_PATTERN(UnaryOperation) |
428 NOT_A_PATTERN(VariableDeclaration) | 512 NOT_A_PATTERN(VariableDeclaration) |
429 NOT_A_PATTERN(WhileStatement) | 513 NOT_A_PATTERN(WhileStatement) |
430 NOT_A_PATTERN(WithStatement) | 514 NOT_A_PATTERN(WithStatement) |
431 NOT_A_PATTERN(Yield) | 515 NOT_A_PATTERN(Yield) |
432 | 516 |
433 #undef NOT_A_PATTERN | 517 #undef NOT_A_PATTERN |
434 } // namespace internal | 518 } // namespace internal |
435 } // namespace v8 | 519 } // namespace v8 |
OLD | NEW |