| 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/parser.h" | 7 #include "src/parser.h" |
| 8 | 8 |
| 9 namespace v8 { | 9 namespace v8 { |
| 10 | 10 |
| (...skipping 206 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 217 | 217 |
| 218 block_->AddStatement( | 218 block_->AddStatement( |
| 219 factory()->NewExpressionStatement(assignment, RelocInfo::kNoPosition), | 219 factory()->NewExpressionStatement(assignment, RelocInfo::kNoPosition), |
| 220 zone()); | 220 zone()); |
| 221 return temp; | 221 return temp; |
| 222 } | 222 } |
| 223 | 223 |
| 224 | 224 |
| 225 void Parser::PatternRewriter::VisitObjectLiteral(ObjectLiteral* pattern) { | 225 void Parser::PatternRewriter::VisitObjectLiteral(ObjectLiteral* pattern) { |
| 226 auto temp = CreateTempVar(current_value_); | 226 auto temp = CreateTempVar(current_value_); |
| 227 if (pattern->properties()->length() == 0) { | 227 |
| 228 block_->AddStatement(descriptor_->parser->BuildAssertIsCoercible(temp), | 228 block_->AddStatement(descriptor_->parser->BuildAssertIsCoercible(temp), |
| 229 zone()); | 229 zone()); |
| 230 } | |
| 231 | 230 |
| 232 for (ObjectLiteralProperty* property : *pattern->properties()) { | 231 for (ObjectLiteralProperty* property : *pattern->properties()) { |
| 233 // TODO(dslomov): computed property names. | |
| 234 RecurseIntoSubpattern( | 232 RecurseIntoSubpattern( |
| 235 property->value(), | 233 property->value(), |
| 236 factory()->NewProperty(factory()->NewVariableProxy(temp), | 234 factory()->NewProperty(factory()->NewVariableProxy(temp), |
| 237 property->key(), RelocInfo::kNoPosition)); | 235 property->key(), RelocInfo::kNoPosition)); |
| 238 } | 236 } |
| 239 } | 237 } |
| 240 | 238 |
| 241 | 239 |
| 242 void Parser::PatternRewriter::VisitArrayLiteral(ArrayLiteral* node) { | 240 void Parser::PatternRewriter::VisitArrayLiteral(ArrayLiteral* node) { |
| 243 // TODO(dslomov): implement. | 241 // TODO(dslomov): implement. |
| (...skipping 69 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 313 NOT_A_PATTERN(TryFinallyStatement) | 311 NOT_A_PATTERN(TryFinallyStatement) |
| 314 NOT_A_PATTERN(UnaryOperation) | 312 NOT_A_PATTERN(UnaryOperation) |
| 315 NOT_A_PATTERN(VariableDeclaration) | 313 NOT_A_PATTERN(VariableDeclaration) |
| 316 NOT_A_PATTERN(WhileStatement) | 314 NOT_A_PATTERN(WhileStatement) |
| 317 NOT_A_PATTERN(WithStatement) | 315 NOT_A_PATTERN(WithStatement) |
| 318 NOT_A_PATTERN(Yield) | 316 NOT_A_PATTERN(Yield) |
| 319 | 317 |
| 320 #undef NOT_A_PATTERN | 318 #undef NOT_A_PATTERN |
| 321 } | 319 } |
| 322 } // namespace v8::internal | 320 } // namespace v8::internal |
| OLD | NEW |