| 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 part of js_backend; | 5 part of js_backend; |
| 6 | 6 |
| 7 /** | 7 /** |
| 8 * Assigns JavaScript identifiers to Dart variables, class-names and members. | 8 * Assigns JavaScript identifiers to Dart variables, class-names and members. |
| 9 */ | 9 */ |
| 10 class Namer implements ClosureNamer { | 10 class Namer implements ClosureNamer { |
| (...skipping 1338 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1349 visit(DartType type) { | 1349 visit(DartType type) { |
| 1350 type.accept(this, null); | 1350 type.accept(this, null); |
| 1351 } | 1351 } |
| 1352 | 1352 |
| 1353 visitType(DartType type, _) { | 1353 visitType(DartType type, _) { |
| 1354 sb.write(type.name); | 1354 sb.write(type.name); |
| 1355 } | 1355 } |
| 1356 | 1356 |
| 1357 visitFunctionType(FunctionType type, _) { | 1357 visitFunctionType(FunctionType type, _) { |
| 1358 if (backend.rti.isSimpleFunctionType(type)) { | 1358 if (backend.rti.isSimpleFunctionType(type)) { |
| 1359 sb.write('args${type.parameterTypes.slowLength()}'); | 1359 sb.write('args${type.parameterTypes.length}'); |
| 1360 return; | 1360 return; |
| 1361 } | 1361 } |
| 1362 visit(type.returnType); | 1362 visit(type.returnType); |
| 1363 sb.write('_'); | 1363 sb.write('_'); |
| 1364 for (Link<DartType> link = type.parameterTypes; | 1364 for (DartType parameter in type.parameterTypes) { |
| 1365 !link.isEmpty; | |
| 1366 link = link.tail) { | |
| 1367 sb.write('_'); | 1365 sb.write('_'); |
| 1368 visit(link.head); | 1366 visit(parameter); |
| 1369 } | 1367 } |
| 1370 bool first = false; | 1368 bool first = false; |
| 1371 for (Link<DartType> link = type.optionalParameterTypes; | 1369 for (DartType parameter in type.optionalParameterTypes) { |
| 1372 !link.isEmpty; | |
| 1373 link = link.tail) { | |
| 1374 if (!first) { | 1370 if (!first) { |
| 1375 sb.write('_'); | 1371 sb.write('_'); |
| 1376 } | 1372 } |
| 1377 sb.write('_'); | 1373 sb.write('_'); |
| 1378 visit(link.head); | 1374 visit(parameter); |
| 1379 first = true; | 1375 first = true; |
| 1380 } | 1376 } |
| 1381 if (!type.namedParameterTypes.isEmpty) { | 1377 if (!type.namedParameterTypes.isEmpty) { |
| 1382 first = false; | 1378 first = false; |
| 1383 for (Link<DartType> link = type.namedParameterTypes; | 1379 for (DartType parameter in type.namedParameterTypes) { |
| 1384 !link.isEmpty; | |
| 1385 link = link.tail) { | |
| 1386 if (!first) { | 1380 if (!first) { |
| 1387 sb.write('_'); | 1381 sb.write('_'); |
| 1388 } | 1382 } |
| 1389 sb.write('_'); | 1383 sb.write('_'); |
| 1390 visit(link.head); | 1384 visit(parameter); |
| 1391 first = true; | 1385 first = true; |
| 1392 } | 1386 } |
| 1393 } | 1387 } |
| 1394 } | 1388 } |
| 1395 } | 1389 } |
| OLD | NEW |