| 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 1350 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1361 visit(DartType type) { | 1361 visit(DartType type) { |
| 1362 type.accept(this, null); | 1362 type.accept(this, null); |
| 1363 } | 1363 } |
| 1364 | 1364 |
| 1365 visitType(DartType type, _) { | 1365 visitType(DartType type, _) { |
| 1366 sb.write(type.name); | 1366 sb.write(type.name); |
| 1367 } | 1367 } |
| 1368 | 1368 |
| 1369 visitFunctionType(FunctionType type, _) { | 1369 visitFunctionType(FunctionType type, _) { |
| 1370 if (backend.rti.isSimpleFunctionType(type)) { | 1370 if (backend.rti.isSimpleFunctionType(type)) { |
| 1371 sb.write('args${type.parameterTypes.slowLength()}'); | 1371 sb.write('args${type.parameterTypes.length}'); |
| 1372 return; | 1372 return; |
| 1373 } | 1373 } |
| 1374 visit(type.returnType); | 1374 visit(type.returnType); |
| 1375 sb.write('_'); | 1375 sb.write('_'); |
| 1376 for (Link<DartType> link = type.parameterTypes; | 1376 for (DartType parameter in type.parameterTypes) { |
| 1377 !link.isEmpty; | |
| 1378 link = link.tail) { | |
| 1379 sb.write('_'); | 1377 sb.write('_'); |
| 1380 visit(link.head); | 1378 visit(parameter); |
| 1381 } | 1379 } |
| 1382 bool first = false; | 1380 bool first = false; |
| 1383 for (Link<DartType> link = type.optionalParameterTypes; | 1381 for (DartType parameter in type.optionalParameterTypes) { |
| 1384 !link.isEmpty; | |
| 1385 link = link.tail) { | |
| 1386 if (!first) { | 1382 if (!first) { |
| 1387 sb.write('_'); | 1383 sb.write('_'); |
| 1388 } | 1384 } |
| 1389 sb.write('_'); | 1385 sb.write('_'); |
| 1390 visit(link.head); | 1386 visit(parameter); |
| 1391 first = true; | 1387 first = true; |
| 1392 } | 1388 } |
| 1393 if (!type.namedParameterTypes.isEmpty) { | 1389 if (!type.namedParameterTypes.isEmpty) { |
| 1394 first = false; | 1390 first = false; |
| 1395 for (Link<DartType> link = type.namedParameterTypes; | 1391 for (DartType parameter in type.namedParameterTypes) { |
| 1396 !link.isEmpty; | |
| 1397 link = link.tail) { | |
| 1398 if (!first) { | 1392 if (!first) { |
| 1399 sb.write('_'); | 1393 sb.write('_'); |
| 1400 } | 1394 } |
| 1401 sb.write('_'); | 1395 sb.write('_'); |
| 1402 visit(link.head); | 1396 visit(parameter); |
| 1403 first = true; | 1397 first = true; |
| 1404 } | 1398 } |
| 1405 } | 1399 } |
| 1406 } | 1400 } |
| 1407 } | 1401 } |
| OLD | NEW |