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

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: Add test for opt compiler 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_; }
1440 bool is_conditional() const { return is_conditional_; }
1438 1441
1439 virtual void VisitChildren(AstNodeVisitor* visitor) const { 1442 virtual void VisitChildren(AstNodeVisitor* visitor) const {
1440 receiver()->Visit(visitor); 1443 receiver()->Visit(visitor);
1441 arguments()->Visit(visitor); 1444 arguments()->Visit(visitor);
1442 } 1445 }
1443 1446
1444 DECLARE_COMMON_NODE_FUNCTIONS(InstanceCallNode); 1447 DECLARE_COMMON_NODE_FUNCTIONS(InstanceCallNode);
1445 1448
1446 private: 1449 private:
1447 AstNode* receiver_; 1450 AstNode* receiver_;
1448 const String& function_name_; 1451 const String& function_name_;
1449 ArgumentListNode* arguments_; 1452 ArgumentListNode* arguments_;
1453 bool is_conditional_;
srdjan 2015/06/17 23:16:37 const (also all below)
hausner 2015/06/18 17:55:37 Done.
1450 1454
1451 DISALLOW_IMPLICIT_CONSTRUCTORS(InstanceCallNode); 1455 DISALLOW_IMPLICIT_CONSTRUCTORS(InstanceCallNode);
1452 }; 1456 };
1453 1457
1454 1458
1455 class InstanceGetterNode : public AstNode { 1459 class InstanceGetterNode : public AstNode {
1456 public: 1460 public:
1457 InstanceGetterNode(intptr_t token_pos, 1461 InstanceGetterNode(intptr_t token_pos,
1458 AstNode* receiver, 1462 AstNode* receiver,
1459 const String& field_name) 1463 const String& field_name,
1464 bool is_conditional = false)
1460 : AstNode(token_pos), 1465 : AstNode(token_pos),
1461 receiver_(receiver), 1466 receiver_(receiver),
1462 field_name_(field_name) { 1467 field_name_(field_name),
1468 is_conditional_(is_conditional) {
1463 ASSERT(receiver_ != NULL); 1469 ASSERT(receiver_ != NULL);
1464 ASSERT(field_name_.IsNotTemporaryScopedHandle()); 1470 ASSERT(field_name_.IsNotTemporaryScopedHandle());
1465 ASSERT(field_name_.IsSymbol()); 1471 ASSERT(field_name_.IsSymbol());
1466 } 1472 }
1467 1473
1468 AstNode* receiver() const { return receiver_; } 1474 AstNode* receiver() const { return receiver_; }
1469 const String& field_name() const { return field_name_; } 1475 const String& field_name() const { return field_name_; }
1476 bool is_conditional() const { return is_conditional_; }
1470 1477
1471 virtual void VisitChildren(AstNodeVisitor* visitor) const { 1478 virtual void VisitChildren(AstNodeVisitor* visitor) const {
1472 receiver()->Visit(visitor); 1479 receiver()->Visit(visitor);
1473 } 1480 }
1474 1481
1475 virtual AstNode* MakeAssignmentNode(AstNode* rhs); 1482 virtual AstNode* MakeAssignmentNode(AstNode* rhs);
1476 1483
1477 virtual bool IsPotentiallyConst() const; 1484 virtual bool IsPotentiallyConst() const;
1478 virtual const Instance* EvalConstExpr() const; 1485 virtual const Instance* EvalConstExpr() const;
1479 1486
1480 DECLARE_COMMON_NODE_FUNCTIONS(InstanceGetterNode); 1487 DECLARE_COMMON_NODE_FUNCTIONS(InstanceGetterNode);
1481 1488
1482 private: 1489 private:
1483 AstNode* receiver_; 1490 AstNode* receiver_;
1484 const String& field_name_; 1491 const String& field_name_;
1492 bool is_conditional_;
1485 1493
1486 DISALLOW_IMPLICIT_CONSTRUCTORS(InstanceGetterNode); 1494 DISALLOW_IMPLICIT_CONSTRUCTORS(InstanceGetterNode);
1487 }; 1495 };
1488 1496
1489 1497
1490 class InstanceSetterNode : public AstNode { 1498 class InstanceSetterNode : public AstNode {
1491 public: 1499 public:
1492 InstanceSetterNode(intptr_t token_pos, 1500 InstanceSetterNode(intptr_t token_pos,
1493 AstNode* receiver, 1501 AstNode* receiver,
1494 const String& field_name, 1502 const String& field_name,
1495 AstNode* value) 1503 AstNode* value,
1504 bool is_conditional = false)
1496 : AstNode(token_pos), 1505 : AstNode(token_pos),
1497 receiver_(receiver), 1506 receiver_(receiver),
1498 field_name_(field_name), 1507 field_name_(field_name),
1499 value_(value) { 1508 value_(value),
1509 is_conditional_(is_conditional) {
1500 ASSERT(receiver_ != NULL); 1510 ASSERT(receiver_ != NULL);
1501 ASSERT(value_ != NULL); 1511 ASSERT(value_ != NULL);
1502 ASSERT(field_name_.IsZoneHandle()); 1512 ASSERT(field_name_.IsZoneHandle());
1503 ASSERT(field_name_.IsSymbol()); 1513 ASSERT(field_name_.IsSymbol());
1504 } 1514 }
1505 1515
1506 AstNode* receiver() const { return receiver_; } 1516 AstNode* receiver() const { return receiver_; }
1507 const String& field_name() const { return field_name_; } 1517 const String& field_name() const { return field_name_; }
1508 AstNode* value() const { return value_; } 1518 AstNode* value() const { return value_; }
1519 bool is_conditional() const { return is_conditional_; }
1509 1520
1510 virtual void VisitChildren(AstNodeVisitor* visitor) const { 1521 virtual void VisitChildren(AstNodeVisitor* visitor) const {
1511 receiver()->Visit(visitor); 1522 receiver()->Visit(visitor);
1512 value()->Visit(visitor); 1523 value()->Visit(visitor);
1513 } 1524 }
1514 1525
1515 DECLARE_COMMON_NODE_FUNCTIONS(InstanceSetterNode); 1526 DECLARE_COMMON_NODE_FUNCTIONS(InstanceSetterNode);
1516 1527
1517 private: 1528 private:
1518 AstNode* receiver_; 1529 AstNode* receiver_;
1519 const String& field_name_; 1530 const String& field_name_;
1520 AstNode* value_; 1531 AstNode* value_;
1532 bool is_conditional_;
1521 1533
1522 DISALLOW_IMPLICIT_CONSTRUCTORS(InstanceSetterNode); 1534 DISALLOW_IMPLICIT_CONSTRUCTORS(InstanceSetterNode);
1523 }; 1535 };
1524 1536
1525 1537
1526 class InitStaticFieldNode : public AstNode { 1538 class InitStaticFieldNode : public AstNode {
1527 public: 1539 public:
1528 InitStaticFieldNode(intptr_t token_pos, const Field& field) 1540 InitStaticFieldNode(intptr_t token_pos, const Field& field)
1529 : AstNode(token_pos), field_(field) { 1541 : AstNode(token_pos), field_(field) {
1530 ASSERT(field_.IsZoneHandle()); 1542 ASSERT(field_.IsZoneHandle());
(...skipping 468 matching lines...) Expand 10 before | Expand all | Expand 10 after
1999 const intptr_t try_index_; 2011 const intptr_t try_index_;
2000 2012
2001 DISALLOW_IMPLICIT_CONSTRUCTORS(InlinedFinallyNode); 2013 DISALLOW_IMPLICIT_CONSTRUCTORS(InlinedFinallyNode);
2002 }; 2014 };
2003 2015
2004 } // namespace dart 2016 } // namespace dart
2005 2017
2006 #undef DECLARE_COMMON_NODE_FUNCTIONS 2018 #undef DECLARE_COMMON_NODE_FUNCTIONS
2007 2019
2008 #endif // VM_AST_H_ 2020 #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