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

Side by Side Diff: runtime/vm/ast.h

Issue 1180903002: null-aware operators in the VM (Closed) Base URL: https://github.com/dart-lang/sdk.git@master
Patch Set: Implement remainder of null-aware operators Created 5 years, 6 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 | runtime/vm/ast.cc » ('j') | runtime/vm/flow_graph_builder.cc » ('J')
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright (c) 2012, the Dart project authors. Please see the AUTHORS file 1 // Copyright (c) 2012, the Dart project authors. Please see the AUTHORS file
2 // for details. All rights reserved. Use of this source code is governed by a 2 // for details. All rights reserved. Use of this source code is governed by a
3 // BSD-style license that can be found in the LICENSE file. 3 // BSD-style license that can be found in the LICENSE file.
4 4
5 #ifndef VM_AST_H_ 5 #ifndef VM_AST_H_
6 #define VM_AST_H_ 6 #define VM_AST_H_
7 7
8 #include "platform/assert.h" 8 #include "platform/assert.h"
9 #include "vm/allocation.h" 9 #include "vm/allocation.h"
10 #include "vm/growable_array.h" 10 #include "vm/growable_array.h"
(...skipping 1403 matching lines...) Expand 10 before | Expand all | Expand 10 after
1414 const Class& super_class_; 1414 const Class& super_class_;
1415 DISALLOW_IMPLICIT_CONSTRUCTORS(StoreIndexedNode); 1415 DISALLOW_IMPLICIT_CONSTRUCTORS(StoreIndexedNode);
1416 }; 1416 };
1417 1417
1418 1418
1419 class InstanceCallNode : public AstNode { 1419 class InstanceCallNode : public AstNode {
1420 public: 1420 public:
1421 InstanceCallNode(intptr_t token_pos, 1421 InstanceCallNode(intptr_t token_pos,
1422 AstNode* receiver, 1422 AstNode* receiver,
1423 const String& function_name, 1423 const String& function_name,
1424 ArgumentListNode* arguments) 1424 ArgumentListNode* arguments,
1425 bool is_conditional = false)
1425 : AstNode(token_pos), 1426 : AstNode(token_pos),
1426 receiver_(receiver), 1427 receiver_(receiver),
1427 function_name_(function_name), 1428 function_name_(function_name),
1428 arguments_(arguments) { 1429 arguments_(arguments),
1430 is_conditional_(is_conditional) {
1429 ASSERT(receiver_ != NULL); 1431 ASSERT(receiver_ != NULL);
1430 ASSERT(function_name_.IsNotTemporaryScopedHandle()); 1432 ASSERT(function_name_.IsNotTemporaryScopedHandle());
1431 ASSERT(function_name_.IsSymbol()); 1433 ASSERT(function_name_.IsSymbol());
1432 ASSERT(arguments_ != NULL); 1434 ASSERT(arguments_ != NULL);
1433 } 1435 }
1434 1436
1435 AstNode* receiver() const { return receiver_; } 1437 AstNode* receiver() const { return receiver_; }
1436 const String& function_name() const { return function_name_; } 1438 const String& function_name() const { return function_name_; }
1437 ArgumentListNode* arguments() const { return arguments_; } 1439 ArgumentListNode* arguments() const { return arguments_; }
1438 1440
1441 bool is_conditional() const { return is_conditional_; }
1442 void set_is_conditional(bool value) {
1443 is_conditional_ = value;
1444 }
1445
1439 virtual void VisitChildren(AstNodeVisitor* visitor) const { 1446 virtual void VisitChildren(AstNodeVisitor* visitor) const {
1440 receiver()->Visit(visitor); 1447 receiver()->Visit(visitor);
1441 arguments()->Visit(visitor); 1448 arguments()->Visit(visitor);
1442 } 1449 }
1443 1450
1444 DECLARE_COMMON_NODE_FUNCTIONS(InstanceCallNode); 1451 DECLARE_COMMON_NODE_FUNCTIONS(InstanceCallNode);
1445 1452
1446 private: 1453 private:
1447 AstNode* receiver_; 1454 AstNode* receiver_;
1448 const String& function_name_; 1455 const String& function_name_;
1449 ArgumentListNode* arguments_; 1456 ArgumentListNode* arguments_;
1457 bool is_conditional_;
1450 1458
1451 DISALLOW_IMPLICIT_CONSTRUCTORS(InstanceCallNode); 1459 DISALLOW_IMPLICIT_CONSTRUCTORS(InstanceCallNode);
1452 }; 1460 };
1453 1461
1454 1462
1455 class InstanceGetterNode : public AstNode { 1463 class InstanceGetterNode : public AstNode {
1456 public: 1464 public:
1457 InstanceGetterNode(intptr_t token_pos, 1465 InstanceGetterNode(intptr_t token_pos,
1458 AstNode* receiver, 1466 AstNode* receiver,
1459 const String& field_name) 1467 const String& field_name)
1460 : AstNode(token_pos), 1468 : AstNode(token_pos),
1461 receiver_(receiver), 1469 receiver_(receiver),
1462 field_name_(field_name) { 1470 field_name_(field_name),
1471 is_conditional_(false) {
1463 ASSERT(receiver_ != NULL); 1472 ASSERT(receiver_ != NULL);
1464 ASSERT(field_name_.IsNotTemporaryScopedHandle()); 1473 ASSERT(field_name_.IsNotTemporaryScopedHandle());
1465 ASSERT(field_name_.IsSymbol()); 1474 ASSERT(field_name_.IsSymbol());
1475 }
1476
1477 InstanceGetterNode(intptr_t token_pos,
1478 AstNode* receiver,
1479 const String& field_name,
1480 bool is_conditional)
srdjan 2015/06/17 18:15:36 use default value as in InstanceCall (consistency)
hausner 2015/06/17 22:24:57 Done.
1481 : AstNode(token_pos),
1482 receiver_(receiver),
1483 field_name_(field_name),
1484 is_conditional_(is_conditional) {
1485 ASSERT(receiver_ != NULL);
1486 ASSERT(field_name_.IsNotTemporaryScopedHandle());
1487 ASSERT(field_name_.IsSymbol());
1466 } 1488 }
1467 1489
1468 AstNode* receiver() const { return receiver_; } 1490 AstNode* receiver() const { return receiver_; }
1469 const String& field_name() const { return field_name_; } 1491 const String& field_name() const { return field_name_; }
1470 1492
1493 bool is_conditional() const { return is_conditional_; }
1494 void set_is_conditional(bool value) {
1495 is_conditional_ = value;
1496 }
1497
1471 virtual void VisitChildren(AstNodeVisitor* visitor) const { 1498 virtual void VisitChildren(AstNodeVisitor* visitor) const {
1472 receiver()->Visit(visitor); 1499 receiver()->Visit(visitor);
1473 } 1500 }
1474 1501
1475 virtual AstNode* MakeAssignmentNode(AstNode* rhs); 1502 virtual AstNode* MakeAssignmentNode(AstNode* rhs);
1476 1503
1477 virtual bool IsPotentiallyConst() const; 1504 virtual bool IsPotentiallyConst() const;
1478 virtual const Instance* EvalConstExpr() const; 1505 virtual const Instance* EvalConstExpr() const;
1479 1506
1480 DECLARE_COMMON_NODE_FUNCTIONS(InstanceGetterNode); 1507 DECLARE_COMMON_NODE_FUNCTIONS(InstanceGetterNode);
1481 1508
1482 private: 1509 private:
1483 AstNode* receiver_; 1510 AstNode* receiver_;
1484 const String& field_name_; 1511 const String& field_name_;
1512 bool is_conditional_;
1485 1513
1486 DISALLOW_IMPLICIT_CONSTRUCTORS(InstanceGetterNode); 1514 DISALLOW_IMPLICIT_CONSTRUCTORS(InstanceGetterNode);
1487 }; 1515 };
1488 1516
1489 1517
1490 class InstanceSetterNode : public AstNode { 1518 class InstanceSetterNode : public AstNode {
1491 public: 1519 public:
1492 InstanceSetterNode(intptr_t token_pos, 1520 InstanceSetterNode(intptr_t token_pos,
1493 AstNode* receiver, 1521 AstNode* receiver,
1494 const String& field_name, 1522 const String& field_name,
1495 AstNode* value) 1523 AstNode* value)
1496 : AstNode(token_pos), 1524 : AstNode(token_pos),
1497 receiver_(receiver), 1525 receiver_(receiver),
1498 field_name_(field_name), 1526 field_name_(field_name),
1499 value_(value) { 1527 value_(value),
1528 is_conditional_(false) {
1500 ASSERT(receiver_ != NULL); 1529 ASSERT(receiver_ != NULL);
1501 ASSERT(value_ != NULL); 1530 ASSERT(value_ != NULL);
1502 ASSERT(field_name_.IsZoneHandle()); 1531 ASSERT(field_name_.IsZoneHandle());
1532 ASSERT(field_name_.IsSymbol());
1533 }
1534
1535 InstanceSetterNode(intptr_t token_pos,
1536 AstNode* receiver,
1537 const String& field_name,
1538 AstNode* value,
1539 bool is_conditional)
1540 : AstNode(token_pos),
1541 receiver_(receiver),
1542 field_name_(field_name),
1543 value_(value),
1544 is_conditional_(is_conditional) {
1545 ASSERT(receiver_ != NULL);
1546 ASSERT(value_ != NULL);
1547 ASSERT(field_name_.IsZoneHandle());
1503 ASSERT(field_name_.IsSymbol()); 1548 ASSERT(field_name_.IsSymbol());
1504 } 1549 }
1505 1550
1506 AstNode* receiver() const { return receiver_; } 1551 AstNode* receiver() const { return receiver_; }
1507 const String& field_name() const { return field_name_; } 1552 const String& field_name() const { return field_name_; }
1508 AstNode* value() const { return value_; } 1553 AstNode* value() const { return value_; }
1509 1554
1555 bool is_conditional() const { return is_conditional_; }
1556 void set_is_conditional(bool value) {
1557 is_conditional_ = value;
1558 }
1559
1510 virtual void VisitChildren(AstNodeVisitor* visitor) const { 1560 virtual void VisitChildren(AstNodeVisitor* visitor) const {
1511 receiver()->Visit(visitor); 1561 receiver()->Visit(visitor);
1512 value()->Visit(visitor); 1562 value()->Visit(visitor);
1513 } 1563 }
1514 1564
1515 DECLARE_COMMON_NODE_FUNCTIONS(InstanceSetterNode); 1565 DECLARE_COMMON_NODE_FUNCTIONS(InstanceSetterNode);
1516 1566
1517 private: 1567 private:
1518 AstNode* receiver_; 1568 AstNode* receiver_;
1519 const String& field_name_; 1569 const String& field_name_;
1520 AstNode* value_; 1570 AstNode* value_;
1571 bool is_conditional_;
1521 1572
1522 DISALLOW_IMPLICIT_CONSTRUCTORS(InstanceSetterNode); 1573 DISALLOW_IMPLICIT_CONSTRUCTORS(InstanceSetterNode);
1523 }; 1574 };
1524 1575
1525 1576
1526 class InitStaticFieldNode : public AstNode { 1577 class InitStaticFieldNode : public AstNode {
1527 public: 1578 public:
1528 InitStaticFieldNode(intptr_t token_pos, const Field& field) 1579 InitStaticFieldNode(intptr_t token_pos, const Field& field)
1529 : AstNode(token_pos), field_(field) { 1580 : AstNode(token_pos), field_(field) {
1530 ASSERT(field_.IsZoneHandle()); 1581 ASSERT(field_.IsZoneHandle());
(...skipping 468 matching lines...) Expand 10 before | Expand all | Expand 10 after
1999 const intptr_t try_index_; 2050 const intptr_t try_index_;
2000 2051
2001 DISALLOW_IMPLICIT_CONSTRUCTORS(InlinedFinallyNode); 2052 DISALLOW_IMPLICIT_CONSTRUCTORS(InlinedFinallyNode);
2002 }; 2053 };
2003 2054
2004 } // namespace dart 2055 } // namespace dart
2005 2056
2006 #undef DECLARE_COMMON_NODE_FUNCTIONS 2057 #undef DECLARE_COMMON_NODE_FUNCTIONS
2007 2058
2008 #endif // VM_AST_H_ 2059 #endif // VM_AST_H_
OLDNEW
« no previous file with comments | « no previous file | runtime/vm/ast.cc » ('j') | runtime/vm/flow_graph_builder.cc » ('J')

Powered by Google App Engine
This is Rietveld 408576698