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 part of type_graph_inferrer; | 5 part of type_graph_inferrer; |
6 | 6 |
7 Set<String> okMapSelectorsSet = new Set.from( | 7 Set<String> okMapSelectorsSet = new Set.from( |
8 const <String>[ | 8 const <String>[ |
9 // From Object. | 9 // From Object. |
10 "==", | 10 "==", |
(...skipping 61 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
72 String selectorName = selector.name; | 72 String selectorName = selector.name; |
73 if (currentUser == info.receiver) { | 73 if (currentUser == info.receiver) { |
74 if (!okMapSelectorsSet.contains(selectorName)) { | 74 if (!okMapSelectorsSet.contains(selectorName)) { |
75 if (selector.isCall) { | 75 if (selector.isCall) { |
76 int positionalLength = info.arguments.positional.length; | 76 int positionalLength = info.arguments.positional.length; |
77 if (selectorName == 'addAll') { | 77 if (selectorName == 'addAll') { |
78 // All keys and values from the argument flow into | 78 // All keys and values from the argument flow into |
79 // the map. | 79 // the map. |
80 TypeInformation map = info.arguments.positional[0]; | 80 TypeInformation map = info.arguments.positional[0]; |
81 if (map is MapTypeInformation) { | 81 if (map is MapTypeInformation) { |
| 82 inferrer.analyzeMapAndEnqueue(map); |
82 mapAssignments.add(map); | 83 mapAssignments.add(map); |
83 } else { | 84 } else { |
84 // If we could select a component from a [TypeInformation], | 85 // If we could select a component from a [TypeInformation], |
85 // like the keytype or valuetype in this case, we could | 86 // like the keytype or valuetype in this case, we could |
86 // propagate more here. | 87 // propagate more here. |
87 // TODO(herhut): implement selection on [TypeInformation]. | 88 // TODO(herhut): implement selection on [TypeInformation]. |
88 bailout('Adding map with unknown typeinfo to current map'); | 89 bailout('Adding map with unknown typeinfo to current map'); |
89 } | 90 } |
90 } else if (selectorName == 'putIfAbsent') { | 91 } else if (selectorName == 'putIfAbsent') { |
91 // The first argument is a new key, the result type of | 92 // The first argument is a new key, the result type of |
(...skipping 22 matching lines...) Expand all Loading... |
114 return; | 115 return; |
115 } | 116 } |
116 } | 117 } |
117 } else if (selector.isCall && | 118 } else if (selector.isCall && |
118 !info.targets.every((element) => element.isFunction)) { | 119 !info.targets.every((element) => element.isFunction)) { |
119 bailout('Passed to a closure'); | 120 bailout('Passed to a closure'); |
120 return; | 121 return; |
121 } | 122 } |
122 } | 123 } |
123 } | 124 } |
OLD | NEW |