| 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 part of universe; | 5 part of universe; |
| 6 | 6 |
| 7 // TODO(kasperl): This actually holds getters and setters just fine | 7 // TODO(kasperl): This actually holds getters and setters just fine |
| 8 // too and stricly they aren't functions. Maybe this needs a better | 8 // too and stricly they aren't functions. Maybe this needs a better |
| 9 // name -- something like ElementSet seems a bit too generic. | 9 // name -- something like ElementSet seems a bit too generic. |
| 10 class FunctionSet { | 10 class FunctionSet { |
| (...skipping 146 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 157 functions = new Set<Element>(); | 157 functions = new Set<Element>(); |
| 158 } | 158 } |
| 159 functions.add(element); | 159 functions.add(element); |
| 160 } | 160 } |
| 161 } | 161 } |
| 162 | 162 |
| 163 TypeMask mask = getNonNullTypeMaskOfSelector(selector, compiler); | 163 TypeMask mask = getNonNullTypeMaskOfSelector(selector, compiler); |
| 164 // If we cannot ensure a method will be found at runtime, we also | 164 // If we cannot ensure a method will be found at runtime, we also |
| 165 // add [noSuchMethod] implementations that apply to [mask] as | 165 // add [noSuchMethod] implementations that apply to [mask] as |
| 166 // potential targets. | 166 // potential targets. |
| 167 if (noSuchMethods != null && !mask.willHit(selector, compiler)) { | 167 if (noSuchMethods != null |
| 168 && mask.needsNoSuchMethodHandling(selector, compiler)) { |
| 168 FunctionSetQuery noSuchMethodQuery = noSuchMethods.query( | 169 FunctionSetQuery noSuchMethodQuery = noSuchMethods.query( |
| 169 new TypedSelector(mask, compiler.noSuchMethodSelector), | 170 new TypedSelector(mask, compiler.noSuchMethodSelector), |
| 170 compiler, | 171 compiler, |
| 171 null); | 172 null); |
| 172 if (!noSuchMethodQuery.functions.isEmpty) { | 173 if (!noSuchMethodQuery.functions.isEmpty) { |
| 173 if (functions == null) { | 174 if (functions == null) { |
| 174 functions = new Set<Element>.from(noSuchMethodQuery.functions); | 175 functions = new Set<Element>.from(noSuchMethodQuery.functions); |
| 175 } else { | 176 } else { |
| 176 functions.addAll(noSuchMethodQuery.functions); | 177 functions.addAll(noSuchMethodQuery.functions); |
| 177 } | 178 } |
| 178 } | 179 } |
| 179 } | 180 } |
| 180 cache[selector] = result = (functions != null) | 181 cache[selector] = result = (functions != null) |
| 181 ? newQuery(functions, selector, compiler) | 182 ? newQuery(functions, selector, compiler) |
| 182 : const FunctionSetQuery(const <Element>[]); | 183 : const FunctionSetQuery(const <Element>[]); |
| 183 return result; | 184 return result; |
| 184 } | 185 } |
| 185 | 186 |
| 186 FunctionSetQuery newQuery(Iterable<Element> functions, | 187 FunctionSetQuery newQuery(Iterable<Element> functions, |
| 187 Selector selector, | 188 Selector selector, |
| 188 Compiler compiler) { | 189 Compiler compiler) { |
| 189 return new FunctionSetQuery(functions); | 190 return new FunctionSetQuery(functions); |
| 190 } | 191 } |
| 191 } | 192 } |
| 192 | 193 |
| 193 class FunctionSetQuery { | 194 class FunctionSetQuery { |
| 194 final Iterable<Element> functions; | 195 final Iterable<Element> functions; |
| 195 const FunctionSetQuery(this.functions); | 196 const FunctionSetQuery(this.functions); |
| 196 } | 197 } |
| OLD | NEW |