Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(995)

Side by Side Diff: sdk/lib/_internal/compiler/implementation/js_backend/namer.dart

Issue 22903036: Use predicates to check simple function types. (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: Small updates. Created 7 years, 4 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
OLDNEW
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 1222 matching lines...) Expand 10 before | Expand all | Expand 10 after
1233 1233
1234 visit(DartType type) { 1234 visit(DartType type) {
1235 type.accept(this, null); 1235 type.accept(this, null);
1236 } 1236 }
1237 1237
1238 visitType(DartType type, _) { 1238 visitType(DartType type, _) {
1239 sb.write(type.name.slowToString()); 1239 sb.write(type.name.slowToString());
1240 } 1240 }
1241 1241
1242 visitFunctionType(FunctionType type, _) { 1242 visitFunctionType(FunctionType type, _) {
1243 if (type.isSimple) {
1244 sb.write('args${type.parameterTypes.slowLength()}');
1245 return;
1246 }
1243 visit(type.returnType); 1247 visit(type.returnType);
1244 sb.write('_'); 1248 sb.write('_');
1245 for (Link<DartType> link = type.parameterTypes; 1249 for (Link<DartType> link = type.parameterTypes;
1246 !link.isEmpty; 1250 !link.isEmpty;
1247 link = link.tail) { 1251 link = link.tail) {
1248 sb.write('_'); 1252 sb.write('_');
1249 visit(link.head); 1253 visit(link.head);
1250 } 1254 }
1251 bool first = false; 1255 bool first = false;
1252 for (Link<DartType> link = type.optionalParameterTypes; 1256 for (Link<DartType> link = type.optionalParameterTypes;
(...skipping 14 matching lines...) Expand all
1267 if (!first) { 1271 if (!first) {
1268 sb.write('_'); 1272 sb.write('_');
1269 } 1273 }
1270 sb.write('_'); 1274 sb.write('_');
1271 visit(link.head); 1275 visit(link.head);
1272 first = true; 1276 first = true;
1273 } 1277 }
1274 } 1278 }
1275 } 1279 }
1276 } 1280 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698