| OLD | NEW |
| 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 /** | 5 /** |
| 6 * A simple code analyzer for Dart. | 6 * A simple code analyzer for Dart. |
| 7 * | 7 * |
| 8 * Currently used to ensure all concrete generic types are visited. | 8 * Currently used to ensure all concrete generic types are visited. |
| 9 * Also performs all static type checks - so these don't need to be | 9 * Also performs all static type checks - so these don't need to be |
| 10 * done in later phases. | 10 * done in later phases. |
| (...skipping 757 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 768 | 768 |
| 769 Value visitSuperExpression(SuperExpression node) { | 769 Value visitSuperExpression(SuperExpression node) { |
| 770 return _frame.makeSuperValue(node); | 770 return _frame.makeSuperValue(node); |
| 771 } | 771 } |
| 772 | 772 |
| 773 Value visitLiteralExpression(LiteralExpression node) { | 773 Value visitLiteralExpression(LiteralExpression node) { |
| 774 return new PureStaticValue(node.value.type, node.span, true); | 774 return new PureStaticValue(node.value.type, node.span, true); |
| 775 } | 775 } |
| 776 | 776 |
| 777 Value visitStringConcatExpression(StringConcatExpression node) { | 777 Value visitStringConcatExpression(StringConcatExpression node) { |
| 778 node.strings.forEach(visitValue); | 778 bool isConst = true; |
| 779 return _frame._makeValue(world.stringType, node); | 779 node.strings.forEach((each) { |
| 780 if (!visitValue(each).isConst) isConst = false; |
| 781 }); |
| 782 return new PureStaticValue(world.stringType, node.span, isConst); |
| 780 } | 783 } |
| 781 | 784 |
| 782 Value visitStringInterpExpression(StringInterpExpression node) { | 785 Value visitStringInterpExpression(StringInterpExpression node) { |
| 783 node.pieces.forEach(visitValue); | 786 bool isConst = true; |
| 784 return _frame._makeValue(world.stringType, node); | 787 node.pieces.forEach((each) { |
| 785 | 788 if (!visitValue(each).isConst) isConst = false; |
| 786 // TODO(jimhug): Do we need this more elaborate analysis? | 789 }); |
| 787 /* | 790 return new PureStaticValue(world.stringType, node.span, isConst); |
| 788 var ret = Value.fromString('', node.span); | |
| 789 | |
| 790 for (var item in node.pieces) { | |
| 791 var val = visitValue(item); | |
| 792 var sval = val.invoke(_frame, 'toString', item, Arguments.EMPTY); | |
| 793 ret = ret.binop(TokenKind.ADD, sval, _frame, item); | |
| 794 } | |
| 795 return _frame._makeValue(world.stringType, node); //???ret; | |
| 796 */ | |
| 797 } | 791 } |
| 798 } | 792 } |
| 799 | 793 |
| OLD | NEW |