| 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/expressions.dart'; | 7 import '../constants/expressions.dart'; |
| 8 import '../constants/values.dart' as values; | 8 import '../constants/values.dart' as values; |
| 9 import '../dart_types.dart' show DartType, GenericType, InterfaceType, TypeVaria
bleType; | 9 import '../dart_types.dart' show DartType, GenericType, InterfaceType, TypeVaria
bleType; |
| 10 import '../elements/elements.dart'; | 10 import '../elements/elements.dart'; |
| (...skipping 314 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 325 LiteralMap(this.type, this.entries); | 325 LiteralMap(this.type, this.entries); |
| 326 | 326 |
| 327 accept(ExpressionVisitor visitor) => visitor.visitLiteralMap(this); | 327 accept(ExpressionVisitor visitor) => visitor.visitLiteralMap(this); |
| 328 accept1(ExpressionVisitor1 visitor, arg) { | 328 accept1(ExpressionVisitor1 visitor, arg) { |
| 329 return visitor.visitLiteralMap(this, arg); | 329 return visitor.visitLiteralMap(this, arg); |
| 330 } | 330 } |
| 331 } | 331 } |
| 332 | 332 |
| 333 /// Given the interceptor for a value, test the value against a type. | 333 /// Given the interceptor for a value, test the value against a type. |
| 334 class TypeOperator extends Expression { | 334 class TypeOperator extends Expression { |
| 335 Expression receiver; | 335 Expression value; |
| 336 final DartType type; | 336 final DartType type; |
| 337 final List<Expression> typeArguments; |
| 337 final bool isTypeTest; | 338 final bool isTypeTest; |
| 338 | 339 |
| 339 TypeOperator(this.receiver, this.type, {bool this.isTypeTest}); | 340 TypeOperator(this.value, this.type, this.typeArguments, |
| 341 {bool this.isTypeTest}); |
| 340 | 342 |
| 341 accept(ExpressionVisitor visitor) => visitor.visitTypeOperator(this); | 343 accept(ExpressionVisitor visitor) => visitor.visitTypeOperator(this); |
| 342 accept1(ExpressionVisitor1 visitor, arg) { | 344 accept1(ExpressionVisitor1 visitor, arg) { |
| 343 return visitor.visitTypeOperator(this, arg); | 345 return visitor.visitTypeOperator(this, arg); |
| 344 } | 346 } |
| 345 | 347 |
| 346 String get operator => isTypeTest ? 'is' : 'as'; | 348 String get operator => isTypeTest ? 'is' : 'as'; |
| 347 } | 349 } |
| 348 | 350 |
| 349 /// A conditional expression. | 351 /// A conditional expression. |
| (...skipping 800 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1150 } | 1152 } |
| 1151 | 1153 |
| 1152 visitLiteralMap(LiteralMap node) { | 1154 visitLiteralMap(LiteralMap node) { |
| 1153 node.entries.forEach((LiteralMapEntry entry) { | 1155 node.entries.forEach((LiteralMapEntry entry) { |
| 1154 visitExpression(entry.key); | 1156 visitExpression(entry.key); |
| 1155 visitExpression(entry.value); | 1157 visitExpression(entry.value); |
| 1156 }); | 1158 }); |
| 1157 } | 1159 } |
| 1158 | 1160 |
| 1159 visitTypeOperator(TypeOperator node) { | 1161 visitTypeOperator(TypeOperator node) { |
| 1160 visitExpression(node.receiver); | 1162 visitExpression(node.value); |
| 1163 node.typeArguments.forEach(visitExpression); |
| 1161 } | 1164 } |
| 1162 | 1165 |
| 1163 visitFunctionExpression(FunctionExpression node) { | 1166 visitFunctionExpression(FunctionExpression node) { |
| 1164 visitInnerFunction(node.definition); | 1167 visitInnerFunction(node.definition); |
| 1165 } | 1168 } |
| 1166 | 1169 |
| 1167 visitLabeledStatement(LabeledStatement node) { | 1170 visitLabeledStatement(LabeledStatement node) { |
| 1168 visitStatement(node.body); | 1171 visitStatement(node.body); |
| 1169 visitStatement(node.next); | 1172 visitStatement(node.next); |
| 1170 } | 1173 } |
| (...skipping 171 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1342 | 1345 |
| 1343 visitLiteralMap(LiteralMap node) { | 1346 visitLiteralMap(LiteralMap node) { |
| 1344 node.entries.forEach((LiteralMapEntry entry) { | 1347 node.entries.forEach((LiteralMapEntry entry) { |
| 1345 entry.key = visitExpression(entry.key); | 1348 entry.key = visitExpression(entry.key); |
| 1346 entry.value = visitExpression(entry.value); | 1349 entry.value = visitExpression(entry.value); |
| 1347 }); | 1350 }); |
| 1348 return node; | 1351 return node; |
| 1349 } | 1352 } |
| 1350 | 1353 |
| 1351 visitTypeOperator(TypeOperator node) { | 1354 visitTypeOperator(TypeOperator node) { |
| 1352 node.receiver = visitExpression(node.receiver); | 1355 node.value = visitExpression(node.value); |
| 1356 _replaceExpressions(node.typeArguments); |
| 1353 return node; | 1357 return node; |
| 1354 } | 1358 } |
| 1355 | 1359 |
| 1356 visitFunctionExpression(FunctionExpression node) { | 1360 visitFunctionExpression(FunctionExpression node) { |
| 1357 visitInnerFunction(node.definition); | 1361 visitInnerFunction(node.definition); |
| 1358 return node; | 1362 return node; |
| 1359 } | 1363 } |
| 1360 | 1364 |
| 1361 visitLabeledStatement(LabeledStatement node) { | 1365 visitLabeledStatement(LabeledStatement node) { |
| 1362 node.body = visitStatement(node.body); | 1366 node.body = visitStatement(node.body); |
| (...skipping 92 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1455 visitTypeExpression(TypeExpression node) { | 1459 visitTypeExpression(TypeExpression node) { |
| 1456 _replaceExpressions(node.arguments); | 1460 _replaceExpressions(node.arguments); |
| 1457 return node; | 1461 return node; |
| 1458 } | 1462 } |
| 1459 | 1463 |
| 1460 visitCreateInvocationMirror(CreateInvocationMirror node) { | 1464 visitCreateInvocationMirror(CreateInvocationMirror node) { |
| 1461 _replaceExpressions(node.arguments); | 1465 _replaceExpressions(node.arguments); |
| 1462 return node; | 1466 return node; |
| 1463 } | 1467 } |
| 1464 } | 1468 } |
| OLD | NEW |