| OLD | NEW |
| 1 // Copyright (c) 2014, the Dart project authors. Please see the AUTHORS file | 1 // Copyright (c) 2014, 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 library tree_ir_nodes; | 5 library tree_ir_nodes; |
| 6 | 6 |
| 7 import '../constants/values.dart' as values; | 7 import '../constants/values.dart' as values; |
| 8 import '../dart_types.dart' show DartType, InterfaceType, TypeVariableType; | 8 import '../dart_types.dart' show DartType, InterfaceType, TypeVariableType; |
| 9 import '../elements/elements.dart'; | 9 import '../elements/elements.dart'; |
| 10 import '../io/source_information.dart' show SourceInformation; | 10 import '../io/source_information.dart' show SourceInformation; |
| (...skipping 294 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 305 final List<Expression> values; | 305 final List<Expression> values; |
| 306 | 306 |
| 307 LiteralList(this.type, this.values); | 307 LiteralList(this.type, this.values); |
| 308 | 308 |
| 309 accept(ExpressionVisitor visitor) => visitor.visitLiteralList(this); | 309 accept(ExpressionVisitor visitor) => visitor.visitLiteralList(this); |
| 310 accept1(ExpressionVisitor1 visitor, arg) { | 310 accept1(ExpressionVisitor1 visitor, arg) { |
| 311 return visitor.visitLiteralList(this, arg); | 311 return visitor.visitLiteralList(this, arg); |
| 312 } | 312 } |
| 313 } | 313 } |
| 314 | 314 |
| 315 class LiteralMapEntry { | |
| 316 Expression key; | |
| 317 Expression value; | |
| 318 | |
| 319 LiteralMapEntry(this.key, this.value); | |
| 320 } | |
| 321 | |
| 322 class LiteralMap extends Expression { | |
| 323 final InterfaceType type; | |
| 324 final List<LiteralMapEntry> entries; | |
| 325 | |
| 326 LiteralMap(this.type, this.entries); | |
| 327 | |
| 328 accept(ExpressionVisitor visitor) => visitor.visitLiteralMap(this); | |
| 329 accept1(ExpressionVisitor1 visitor, arg) { | |
| 330 return visitor.visitLiteralMap(this, arg); | |
| 331 } | |
| 332 } | |
| 333 | |
| 334 /// Type test or type cast. | 315 /// Type test or type cast. |
| 335 /// | 316 /// |
| 336 /// Note that if this is a type test, then [type] cannot be `Object`, `dynamic`, | 317 /// Note that if this is a type test, then [type] cannot be `Object`, `dynamic`, |
| 337 /// or the `Null` type. These cases are compiled to other node types. | 318 /// or the `Null` type. These cases are compiled to other node types. |
| 338 class TypeOperator extends Expression { | 319 class TypeOperator extends Expression { |
| 339 Expression value; | 320 Expression value; |
| 340 final DartType type; | 321 final DartType type; |
| 341 final List<Expression> typeArguments; | 322 final List<Expression> typeArguments; |
| 342 final bool isTypeTest; | 323 final bool isTypeTest; |
| 343 | 324 |
| (...skipping 648 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 992 E visitInvokeMethod(InvokeMethod node); | 973 E visitInvokeMethod(InvokeMethod node); |
| 993 E visitInvokeMethodDirectly(InvokeMethodDirectly node); | 974 E visitInvokeMethodDirectly(InvokeMethodDirectly node); |
| 994 E visitInvokeConstructor(InvokeConstructor node); | 975 E visitInvokeConstructor(InvokeConstructor node); |
| 995 E visitOneShotInterceptor(OneShotInterceptor node); | 976 E visitOneShotInterceptor(OneShotInterceptor node); |
| 996 E visitConstant(Constant node); | 977 E visitConstant(Constant node); |
| 997 E visitThis(This node); | 978 E visitThis(This node); |
| 998 E visitConditional(Conditional node); | 979 E visitConditional(Conditional node); |
| 999 E visitLogicalOperator(LogicalOperator node); | 980 E visitLogicalOperator(LogicalOperator node); |
| 1000 E visitNot(Not node); | 981 E visitNot(Not node); |
| 1001 E visitLiteralList(LiteralList node); | 982 E visitLiteralList(LiteralList node); |
| 1002 E visitLiteralMap(LiteralMap node); | |
| 1003 E visitTypeOperator(TypeOperator node); | 983 E visitTypeOperator(TypeOperator node); |
| 1004 E visitGetField(GetField node); | 984 E visitGetField(GetField node); |
| 1005 E visitSetField(SetField node); | 985 E visitSetField(SetField node); |
| 1006 E visitGetStatic(GetStatic node); | 986 E visitGetStatic(GetStatic node); |
| 1007 E visitSetStatic(SetStatic node); | 987 E visitSetStatic(SetStatic node); |
| 1008 E visitGetTypeTestProperty(GetTypeTestProperty node); | 988 E visitGetTypeTestProperty(GetTypeTestProperty node); |
| 1009 E visitCreateBox(CreateBox node); | 989 E visitCreateBox(CreateBox node); |
| 1010 E visitCreateInstance(CreateInstance node); | 990 E visitCreateInstance(CreateInstance node); |
| 1011 E visitReifyRuntimeType(ReifyRuntimeType node); | 991 E visitReifyRuntimeType(ReifyRuntimeType node); |
| 1012 E visitReadTypeVariable(ReadTypeVariable node); | 992 E visitReadTypeVariable(ReadTypeVariable node); |
| (...skipping 17 matching lines...) Expand all Loading... |
| 1030 E visitInvokeMethod(InvokeMethod node, A arg); | 1010 E visitInvokeMethod(InvokeMethod node, A arg); |
| 1031 E visitInvokeMethodDirectly(InvokeMethodDirectly node, A arg); | 1011 E visitInvokeMethodDirectly(InvokeMethodDirectly node, A arg); |
| 1032 E visitInvokeConstructor(InvokeConstructor node, A arg); | 1012 E visitInvokeConstructor(InvokeConstructor node, A arg); |
| 1033 E visitOneShotInterceptor(OneShotInterceptor node, A arg); | 1013 E visitOneShotInterceptor(OneShotInterceptor node, A arg); |
| 1034 E visitConstant(Constant node, A arg); | 1014 E visitConstant(Constant node, A arg); |
| 1035 E visitThis(This node, A arg); | 1015 E visitThis(This node, A arg); |
| 1036 E visitConditional(Conditional node, A arg); | 1016 E visitConditional(Conditional node, A arg); |
| 1037 E visitLogicalOperator(LogicalOperator node, A arg); | 1017 E visitLogicalOperator(LogicalOperator node, A arg); |
| 1038 E visitNot(Not node, A arg); | 1018 E visitNot(Not node, A arg); |
| 1039 E visitLiteralList(LiteralList node, A arg); | 1019 E visitLiteralList(LiteralList node, A arg); |
| 1040 E visitLiteralMap(LiteralMap node, A arg); | |
| 1041 E visitTypeOperator(TypeOperator node, A arg); | 1020 E visitTypeOperator(TypeOperator node, A arg); |
| 1042 E visitGetField(GetField node, A arg); | 1021 E visitGetField(GetField node, A arg); |
| 1043 E visitSetField(SetField node, A arg); | 1022 E visitSetField(SetField node, A arg); |
| 1044 E visitGetStatic(GetStatic node, A arg); | 1023 E visitGetStatic(GetStatic node, A arg); |
| 1045 E visitSetStatic(SetStatic node, A arg); | 1024 E visitSetStatic(SetStatic node, A arg); |
| 1046 E visitGetTypeTestProperty(GetTypeTestProperty node, A arg); | 1025 E visitGetTypeTestProperty(GetTypeTestProperty node, A arg); |
| 1047 E visitCreateBox(CreateBox node, A arg); | 1026 E visitCreateBox(CreateBox node, A arg); |
| 1048 E visitCreateInstance(CreateInstance node, A arg); | 1027 E visitCreateInstance(CreateInstance node, A arg); |
| 1049 E visitReifyRuntimeType(ReifyRuntimeType node, A arg); | 1028 E visitReifyRuntimeType(ReifyRuntimeType node, A arg); |
| 1050 E visitReadTypeVariable(ReadTypeVariable node, A arg); | 1029 E visitReadTypeVariable(ReadTypeVariable node, A arg); |
| (...skipping 98 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1149 } | 1128 } |
| 1150 | 1129 |
| 1151 visitNot(Not node) { | 1130 visitNot(Not node) { |
| 1152 visitExpression(node.operand); | 1131 visitExpression(node.operand); |
| 1153 } | 1132 } |
| 1154 | 1133 |
| 1155 visitLiteralList(LiteralList node) { | 1134 visitLiteralList(LiteralList node) { |
| 1156 node.values.forEach(visitExpression); | 1135 node.values.forEach(visitExpression); |
| 1157 } | 1136 } |
| 1158 | 1137 |
| 1159 visitLiteralMap(LiteralMap node) { | |
| 1160 node.entries.forEach((LiteralMapEntry entry) { | |
| 1161 visitExpression(entry.key); | |
| 1162 visitExpression(entry.value); | |
| 1163 }); | |
| 1164 } | |
| 1165 | |
| 1166 visitTypeOperator(TypeOperator node) { | 1138 visitTypeOperator(TypeOperator node) { |
| 1167 visitExpression(node.value); | 1139 visitExpression(node.value); |
| 1168 node.typeArguments.forEach(visitExpression); | 1140 node.typeArguments.forEach(visitExpression); |
| 1169 } | 1141 } |
| 1170 | 1142 |
| 1171 visitLabeledStatement(LabeledStatement node) { | 1143 visitLabeledStatement(LabeledStatement node) { |
| 1172 visitStatement(node.body); | 1144 visitStatement(node.body); |
| 1173 visitStatement(node.next); | 1145 visitStatement(node.next); |
| 1174 } | 1146 } |
| 1175 | 1147 |
| (...skipping 207 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1383 visitNot(Not node) { | 1355 visitNot(Not node) { |
| 1384 node.operand = visitExpression(node.operand); | 1356 node.operand = visitExpression(node.operand); |
| 1385 return node; | 1357 return node; |
| 1386 } | 1358 } |
| 1387 | 1359 |
| 1388 visitLiteralList(LiteralList node) { | 1360 visitLiteralList(LiteralList node) { |
| 1389 _replaceExpressions(node.values); | 1361 _replaceExpressions(node.values); |
| 1390 return node; | 1362 return node; |
| 1391 } | 1363 } |
| 1392 | 1364 |
| 1393 visitLiteralMap(LiteralMap node) { | |
| 1394 node.entries.forEach((LiteralMapEntry entry) { | |
| 1395 entry.key = visitExpression(entry.key); | |
| 1396 entry.value = visitExpression(entry.value); | |
| 1397 }); | |
| 1398 return node; | |
| 1399 } | |
| 1400 | |
| 1401 visitTypeOperator(TypeOperator node) { | 1365 visitTypeOperator(TypeOperator node) { |
| 1402 node.value = visitExpression(node.value); | 1366 node.value = visitExpression(node.value); |
| 1403 _replaceExpressions(node.typeArguments); | 1367 _replaceExpressions(node.typeArguments); |
| 1404 return node; | 1368 return node; |
| 1405 } | 1369 } |
| 1406 | 1370 |
| 1407 visitLabeledStatement(LabeledStatement node) { | 1371 visitLabeledStatement(LabeledStatement node) { |
| 1408 node.body = visitStatement(node.body); | 1372 node.body = visitStatement(node.body); |
| 1409 node.next = visitStatement(node.next); | 1373 node.next = visitStatement(node.next); |
| 1410 return node; | 1374 return node; |
| (...skipping 202 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1613 | 1577 |
| 1614 /// Number of uses of the current fallthrough target. | 1578 /// Number of uses of the current fallthrough target. |
| 1615 int get useCount => _stack.last.useCount; | 1579 int get useCount => _stack.last.useCount; |
| 1616 | 1580 |
| 1617 /// Indicate that a statement will fall through to the current fallthrough | 1581 /// Indicate that a statement will fall through to the current fallthrough |
| 1618 /// target. | 1582 /// target. |
| 1619 void use() { | 1583 void use() { |
| 1620 ++_stack.last.useCount; | 1584 ++_stack.last.useCount; |
| 1621 } | 1585 } |
| 1622 } | 1586 } |
| OLD | NEW |