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 class MemberSet { | 5 class MemberSet { |
6 final String name; | 6 final String name; |
7 final List<Member> members; | 7 final List<Member> members; |
8 final String jsname; | 8 final String jsname; |
9 final bool isVar; | 9 final bool isVar; |
10 | 10 |
(...skipping 246 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
257 void addMembers(List<Member> members, CallingContext context, Value target, | 257 void addMembers(List<Member> members, CallingContext context, Value target, |
258 Arguments args) { | 258 Arguments args) { |
259 // TODO(jimhug): In checked mode include parameter types to determine | 259 // TODO(jimhug): In checked mode include parameter types to determine |
260 // need for varCall. | 260 // need for varCall. |
261 for (var member in members) { | 261 for (var member in members) { |
262 // check that this is a "perfect" match - or require a var call | 262 // check that this is a "perfect" match - or require a var call |
263 // TODO(jimhug): Add support of "perfect matches" even with names | 263 // TODO(jimhug): Add support of "perfect matches" even with names |
264 if (!(member.parameters.length == bareArgs && namedArgs == null)) { | 264 if (!(member.parameters.length == bareArgs && namedArgs == null)) { |
265 needsVarCall = true; | 265 needsVarCall = true; |
266 } | 266 } |
| 267 // TODO(jimhug): Egregious hack for isolates + DOM - see |
| 268 // Value._maybeWrapFunction for more details. |
| 269 if (member.library == world.dom) { |
| 270 for (var p in member.parameters) { |
| 271 if (p.type.getCallMethod() != null) { |
| 272 needsVarCall = true; |
| 273 } |
| 274 } |
| 275 } |
| 276 |
267 // TODO(jimhug): Should create a less specific version of args. | 277 // TODO(jimhug): Should create a less specific version of args. |
268 if (member.canInvoke(context, args)) { | 278 if (member.canInvoke(context, args)) { |
269 if (member.isMethod) { | 279 if (member.isMethod) { |
270 returnType = MemberSet.unionTypes(returnType, member.returnType); | 280 returnType = MemberSet.unionTypes(returnType, member.returnType); |
271 member.declaringType.genMethod(member); | 281 member.declaringType.genMethod(member); |
272 } else { | 282 } else { |
273 needsVarCall = true; | 283 needsVarCall = true; |
274 returnType = world.varType; | 284 returnType = world.varType; |
275 } | 285 } |
276 } | 286 } |
277 } | 287 } |
278 if (returnType == null) { | 288 if (returnType == null) { |
279 // TODO(jimhug): Warning here for no match anywhere in the world? | 289 // TODO(jimhug): Warning here for no match anywhere in the world? |
280 returnType = world.varType; | 290 returnType = world.varType; |
281 } | 291 } |
282 } | 292 } |
283 } | 293 } |
OLD | NEW |