Chromium Code Reviews| 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 bool isGenerated = false; | 8 bool isGenerated = false; |
| 9 | 9 |
| 10 VarMember(this.name); | 10 VarMember(this.name); |
| (...skipping 227 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 238 world.objectType.varStubs[stub.name] = stub; | 238 world.objectType.varStubs[stub.name] = stub; |
| 239 } | 239 } |
| 240 } | 240 } |
| 241 | 241 |
| 242 // TODO(jmesserly): get rid of this as it's unused now | 242 // TODO(jmesserly): get rid of this as it's unused now |
| 243 void generate(CodeWriter code) {} | 243 void generate(CodeWriter code) {} |
| 244 } | 244 } |
| 245 | 245 |
| 246 String _getCallStubName(String name, Arguments args) { | 246 String _getCallStubName(String name, Arguments args) { |
| 247 // TODO: This code needs global knowledge to ensure the stub name does not | 247 // TODO: This code needs global knowledge to ensure the stub name does not |
| 248 // collide with any other name. | 248 // collide with any other name. E.g. it is unlikely but possible for the user |
| 249 // to have methods called 'foo' and 'foo$0'. | |
|
Jennifer Messerly
2011/12/14 22:07:08
if the user had a method called foo$0, it would ge
| |
| 249 final nameBuilder = new StringBuffer('${name}\$${args.bareCount}'); | 250 final nameBuilder = new StringBuffer('${name}\$${args.bareCount}'); |
| 250 for (int i = args.bareCount; i < args.length; i++) { | 251 for (int i = args.bareCount; i < args.length; i++) { |
| 251 var name = args.getName(i); | 252 var name = args.getName(i); |
| 252 nameBuilder.add('\$'); | 253 nameBuilder.add('\$'); |
| 253 if (name.contains('\$')) { | 254 if (name.contains('\$')) { |
| 254 // Disambiguate "a:b:" from "a$b:" | 255 // Disambiguate "a:b:" from "a$b:". Using the length works well because |
| 256 // the names can't start with digits. | |
| 255 nameBuilder.add('${name.length}'); | 257 nameBuilder.add('${name.length}'); |
| 256 } | 258 } |
| 257 nameBuilder.add(name); | 259 nameBuilder.add(name); |
| 258 } | 260 } |
| 259 return nameBuilder.toString(); | 261 return nameBuilder.toString(); |
| 260 } | 262 } |
| OLD | NEW |