| 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 interface CallingContext { | 6 interface CallingContext { |
| 7 MemberSet findMembers(String name); | 7 MemberSet findMembers(String name); |
| 8 CounterLog get counters(); | 8 CounterLog get counters(); |
| 9 Library get library(); | 9 Library get library(); |
| 10 bool get isStatic(); | 10 bool get isStatic(); |
| (...skipping 57 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 68 | 68 |
| 69 var member = getMem(context, name, node); | 69 var member = getMem(context, name, node); |
| 70 if (member != null) { | 70 if (member != null) { |
| 71 member._set(context, node, this, value); | 71 member._set(context, node, this, value); |
| 72 } | 72 } |
| 73 return new PureStaticValue(value.type, node.span); | 73 return new PureStaticValue(value.type, node.span); |
| 74 } | 74 } |
| 75 | 75 |
| 76 Value setIndex(CallingContext context, Value index, Node node, Value value, | 76 Value setIndex(CallingContext context, Value index, Node node, Value value, |
| 77 [int kind=0, int returnKind=ReturnKind.IGNORE]) { | 77 [int kind=0, int returnKind=ReturnKind.IGNORE]) { |
| 78 return invoke(context, ':setindex', node, | 78 var tmp = invoke(context, ':setindex', node, |
| 79 new Arguments(null, [index, value])); | 79 new Arguments(null, [index, value])); |
| 80 return new PureStaticValue(value.type, node.span); |
| 80 } | 81 } |
| 81 | 82 |
| 82 Value unop(int kind, CallingContext context, var node) { | 83 Value unop(int kind, CallingContext context, var node) { |
| 83 switch (kind) { | 84 switch (kind) { |
| 84 case TokenKind.NOT: | 85 case TokenKind.NOT: |
| 85 // TODO(jimhug): Issue #359 seeks to clarify this behavior. | 86 // TODO(jimhug): Issue #359 seeks to clarify this behavior. |
| 86 // ?var newVal = convertTo(context, world.nonNullBool); | 87 // ?var newVal = convertTo(context, world.nonNullBool); |
| 87 return new PureStaticValue(world.boolType, node.span); | 88 return new PureStaticValue(world.boolType, node.span); |
| 88 case TokenKind.ADD: | 89 case TokenKind.ADD: |
| 89 if (!isConst && !type.isNum) { | 90 if (!isConst && !type.isNum) { |
| (...skipping 712 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 802 if (!world.objectType.varStubs.containsKey(checkName)) { | 803 if (!world.objectType.varStubs.containsKey(checkName)) { |
| 803 world.objectType.varStubs[checkName] = | 804 world.objectType.varStubs[checkName] = |
| 804 new VarMethodStub(checkName, null, Arguments.EMPTY, 'return false'); | 805 new VarMethodStub(checkName, null, Arguments.EMPTY, 'return false'); |
| 805 } | 806 } |
| 806 } | 807 } |
| 807 return new Value(world.nonNullBool, testCode, span); | 808 return new Value(world.nonNullBool, testCode, span); |
| 808 } | 809 } |
| 809 | 810 |
| 810 void convertWarning(Type toType) { | 811 void convertWarning(Type toType) { |
| 811 // TODO(jmesserly): better error messages for type conversion failures | 812 // TODO(jmesserly): better error messages for type conversion failures |
| 812 world.warning('type "${type.name}" is not assignable to "${toType.name}"', | 813 world.warning( |
| 814 'type "${type.fullname}" is not assignable to "${toType.fullname}"', |
| 813 span); | 815 span); |
| 814 } | 816 } |
| 815 | 817 |
| 816 Value invokeNoSuchMethod(CallingContext context, String name, Node node, | 818 Value invokeNoSuchMethod(CallingContext context, String name, Node node, |
| 817 [Arguments args]) { | 819 [Arguments args]) { |
| 818 if (isType) { | 820 if (isType) { |
| 819 world.error('member lookup failed for "$name"', node.span); | 821 world.error('member lookup failed for "$name"', node.span); |
| 820 } | 822 } |
| 821 | 823 |
| 822 var pos = ''; | 824 var pos = ''; |
| (...skipping 785 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1608 } | 1610 } |
| 1609 return super.unop(kind, context, node); | 1611 return super.unop(kind, context, node); |
| 1610 } | 1612 } |
| 1611 Value binop(int kind, var other, CallingContext context, var node) { | 1613 Value binop(int kind, var other, CallingContext context, var node) { |
| 1612 if (value != null) { | 1614 if (value != null) { |
| 1613 return replaceValue(value.binop(kind, _unwrap(other), context, node)); | 1615 return replaceValue(value.binop(kind, _unwrap(other), context, node)); |
| 1614 } | 1616 } |
| 1615 return super.binop(kind, other, context, node); | 1617 return super.binop(kind, other, context, node); |
| 1616 } | 1618 } |
| 1617 } | 1619 } |
| OLD | NEW |