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

Side by Side Diff: src/ast.h

Issue 1168643005: [es6] parse destructuring assignment (Closed) Base URL: https://chromium.googlesource.com/v8/v8.git@master
Patch Set: WIP #1 Created 5 years, 4 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
« no previous file with comments | « no previous file | src/expression-classifier.h » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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_AST_H_ 5 #ifndef V8_AST_H_
6 #define V8_AST_H_ 6 #define V8_AST_H_
7 7
8 #include "src/assembler.h" 8 #include "src/assembler.h"
9 #include "src/ast-value-factory.h" 9 #include "src/ast-value-factory.h"
10 #include "src/bailout-reason.h" 10 #include "src/bailout-reason.h"
(...skipping 350 matching lines...) Expand 10 before | Expand all | Expand 10 after
361 361
362 // True iff the expression is the null literal. 362 // True iff the expression is the null literal.
363 bool IsNullLiteral() const; 363 bool IsNullLiteral() const;
364 364
365 // True if we can prove that the expression is the undefined literal. 365 // True if we can prove that the expression is the undefined literal.
366 bool IsUndefinedLiteral(Isolate* isolate) const; 366 bool IsUndefinedLiteral(Isolate* isolate) const;
367 367
368 // True iff the expression is a valid target for an assignment. 368 // True iff the expression is a valid target for an assignment.
369 bool IsValidReferenceExpressionOrThis() const; 369 bool IsValidReferenceExpressionOrThis() const;
370 370
371 bool IsPatternOrLiteral() const {
372 return IsObjectLiteral() || IsArrayLiteral();
373 }
374
371 // Expression type bounds 375 // Expression type bounds
372 Bounds bounds() const { return bounds_; } 376 Bounds bounds() const { return bounds_; }
373 void set_bounds(Bounds bounds) { bounds_ = bounds; } 377 void set_bounds(Bounds bounds) { bounds_ = bounds; }
374 378
375 // Type feedback information for assignments and properties. 379 // Type feedback information for assignments and properties.
376 virtual bool IsMonomorphic() { 380 virtual bool IsMonomorphic() {
377 UNREACHABLE(); 381 UNREACHABLE();
378 return false; 382 return false;
379 } 383 }
380 virtual SmallMapList* GetReceiverTypes() { 384 virtual SmallMapList* GetReceiverTypes() {
(...skipping 1968 matching lines...) Expand 10 before | Expand all | Expand 10 after
2349 Token::Value binary_op() const; 2353 Token::Value binary_op() const;
2350 2354
2351 Token::Value op() const { return TokenField::decode(bit_field_); } 2355 Token::Value op() const { return TokenField::decode(bit_field_); }
2352 Expression* target() const { return target_; } 2356 Expression* target() const { return target_; }
2353 Expression* value() const { return value_; } 2357 Expression* value() const { return value_; }
2354 BinaryOperation* binary_operation() const { return binary_operation_; } 2358 BinaryOperation* binary_operation() const { return binary_operation_; }
2355 2359
2356 // This check relies on the definition order of token in token.h. 2360 // This check relies on the definition order of token in token.h.
2357 bool is_compound() const { return op() > Token::ASSIGN; } 2361 bool is_compound() const { return op() > Token::ASSIGN; }
2358 2362
2363 // Returns true if op is `=` and LHS is might be a pattern
2364 bool IsDestructuring() const {
2365 return op() == Token::ASSIGN && target()->IsPatternOrLiteral();
2366 }
2367
2359 static int num_ids() { return parent_num_ids() + 2; } 2368 static int num_ids() { return parent_num_ids() + 2; }
2360 BailoutId AssignmentId() const { return BailoutId(local_id(0)); } 2369 BailoutId AssignmentId() const { return BailoutId(local_id(0)); }
2361 2370
2362 // Type feedback information. 2371 // Type feedback information.
2363 TypeFeedbackId AssignmentFeedbackId() { return TypeFeedbackId(local_id(1)); } 2372 TypeFeedbackId AssignmentFeedbackId() { return TypeFeedbackId(local_id(1)); }
2364 bool IsMonomorphic() override { return receiver_types_.length() == 1; } 2373 bool IsMonomorphic() override { return receiver_types_.length() == 1; }
2365 bool IsUninitialized() const { 2374 bool IsUninitialized() const {
2366 return IsUninitializedField::decode(bit_field_); 2375 return IsUninitializedField::decode(bit_field_);
2367 } 2376 }
2368 bool HasNoTypeInformation() { 2377 bool HasNoTypeInformation() {
(...skipping 1266 matching lines...) Expand 10 before | Expand all | Expand 10 after
3635 3644
3636 private: 3645 private:
3637 Zone* zone_; 3646 Zone* zone_;
3638 AstValueFactory* ast_value_factory_; 3647 AstValueFactory* ast_value_factory_;
3639 }; 3648 };
3640 3649
3641 3650
3642 } } // namespace v8::internal 3651 } } // namespace v8::internal
3643 3652
3644 #endif // V8_AST_H_ 3653 #endif // V8_AST_H_
OLDNEW
« no previous file with comments | « no previous file | src/expression-classifier.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698