| OLD | NEW |
| 1 // Copyright (c) 2011, the Dart project authors. Please see the AUTHORS file | 1 // Copyright (c) 2011, 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 /** A dynamic member stub. */ | 5 /** A dynamic member stub. */ |
| 6 class VarMember { | 6 class VarMember { |
| 7 final String name; | 7 final String name; |
| 8 | 8 |
| 9 VarMember(this.name); | 9 VarMember(this.name); |
| 10 | 10 |
| (...skipping 179 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 190 /** Invokes members to ensure they're generated. */ | 190 /** Invokes members to ensure they're generated. */ |
| 191 _invokeMembers(MethodGenerator context, Node node) { | 191 _invokeMembers(MethodGenerator context, Node node) { |
| 192 if (_fallbackStubs != null) return; | 192 if (_fallbackStubs != null) return; |
| 193 | 193 |
| 194 var objectStub = null; | 194 var objectStub = null; |
| 195 _fallbackStubs = []; | 195 _fallbackStubs = []; |
| 196 for (var member in members) { | 196 for (var member in members) { |
| 197 // Invoke the member with the stub args (this gives us the method body), | 197 // Invoke the member with the stub args (this gives us the method body), |
| 198 // then create the stub method. | 198 // then create the stub method. |
| 199 final target = new Value(member.declaringType, 'this', node.span); | 199 final target = new Value(member.declaringType, 'this', node.span); |
| 200 var result = member.invoke(context, node, target, args); | 200 var result = member.invoke(context, node, target, args, isDynamic:true); |
| 201 var stub = new VarMethodStub(name, member, args, result); | 201 var stub = new VarMethodStub(name, member, args, result); |
| 202 | 202 |
| 203 // Put the stub on the type directly if possible. Otherwise | 203 // Put the stub on the type directly if possible. Otherwise |
| 204 // put the stub on Object.prototype. | 204 // put the stub on Object.prototype. |
| 205 var type = member.declaringType; | 205 var type = member.declaringType; |
| 206 if (type.isObject) { | 206 if (type.isObject) { |
| 207 objectStub = stub; | 207 objectStub = stub; |
| 208 } else if (type.library != world.dom) { | 208 } else if (type.library != world.dom) { |
| 209 _addVarStub(type, stub); | 209 _addVarStub(type, stub); |
| 210 } else { | 210 } else { |
| (...skipping 50 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 261 } | 261 } |
| 262 } | 262 } |
| 263 | 263 |
| 264 String _getCallStubName(String name, Arguments args) { | 264 String _getCallStubName(String name, Arguments args) { |
| 265 final nameBuilder = new StringBuffer('${name}\$${args.bareCount}'); | 265 final nameBuilder = new StringBuffer('${name}\$${args.bareCount}'); |
| 266 for (int i = args.bareCount; i < args.length; i++) { | 266 for (int i = args.bareCount; i < args.length; i++) { |
| 267 nameBuilder.add('\$').add(args.getName(i)); | 267 nameBuilder.add('\$').add(args.getName(i)); |
| 268 } | 268 } |
| 269 return nameBuilder.toString(); | 269 return nameBuilder.toString(); |
| 270 } | 270 } |
| OLD | NEW |