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

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

Issue 416643002: Support typedefs in function signatures. (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: Recognize typedefs and function mirrors in typeMirrorFromRuntimeTypeRepresentation. Created 6 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 803 matching lines...) Expand 10 before | Expand all | Expand 10 after
814 /// of the other objects in [reservedGlobalObjectNames]. 814 /// of the other objects in [reservedGlobalObjectNames].
815 bool isPropertyOfCurrentIsolate(Element element) { 815 bool isPropertyOfCurrentIsolate(Element element) {
816 // TODO(ahe): Make sure this method's documentation is always true and 816 // TODO(ahe): Make sure this method's documentation is always true and
817 // remove the word "intend". 817 // remove the word "intend".
818 return 818 return
819 // TODO(ahe): Re-write these tests to be positive (so it only returns 819 // TODO(ahe): Re-write these tests to be positive (so it only returns
820 // true for static/top-level mutable fields). Right now, a number of 820 // true for static/top-level mutable fields). Right now, a number of
821 // other elements, such as bound closures also live in [currentIsolate]. 821 // other elements, such as bound closures also live in [currentIsolate].
822 !element.isAccessor && 822 !element.isAccessor &&
823 !element.isClass && 823 !element.isClass &&
824 !element.isTypedef &&
824 !element.isConstructor && 825 !element.isConstructor &&
825 !element.isFunction && 826 !element.isFunction &&
826 !element.isLibrary; 827 !element.isLibrary;
827 } 828 }
828 829
829 /// Returns [currentIsolate] or one of [reservedGlobalObjectNames]. 830 /// Returns [currentIsolate] or one of [reservedGlobalObjectNames].
830 String globalObjectFor(Element element) { 831 String globalObjectFor(Element element) {
831 if (isPropertyOfCurrentIsolate(element)) return currentIsolate; 832 if (isPropertyOfCurrentIsolate(element)) return currentIsolate;
832 LibraryElement library = element.library; 833 LibraryElement library = element.library;
833 if (library == backend.interceptorsLibrary) return 'J'; 834 if (library == backend.interceptorsLibrary) return 'J';
(...skipping 41 matching lines...) Expand 10 before | Expand all | Expand 10 after
875 } 876 }
876 877
877 String globalObjectForConstant(Constant constant) => 'C'; 878 String globalObjectForConstant(Constant constant) => 'C';
878 879
879 String operatorIsPrefix() => r'$is'; 880 String operatorIsPrefix() => r'$is';
880 881
881 String operatorAsPrefix() => r'$as'; 882 String operatorAsPrefix() => r'$as';
882 883
883 String operatorSignature() => r'$signature'; 884 String operatorSignature() => r'$signature';
884 885
886 String typedefTag() => r'typedef';
887
885 String functionTypeTag() => r'func'; 888 String functionTypeTag() => r'func';
886 889
887 String functionTypeVoidReturnTag() => r'void'; 890 String functionTypeVoidReturnTag() => r'void';
888 891
889 String functionTypeReturnTypeTag() => r'ret'; 892 String functionTypeReturnTypeTag() => r'ret';
890 893
891 String functionTypeRequiredParametersTag() => r'args'; 894 String functionTypeRequiredParametersTag() => r'args';
892 895
893 String functionTypeOptionalParametersTag() => r'opt'; 896 String functionTypeOptionalParametersTag() => r'opt';
894 897
(...skipping 475 matching lines...) Expand 10 before | Expand all | Expand 10 after
1370 if (!first) { 1373 if (!first) {
1371 sb.write('_'); 1374 sb.write('_');
1372 } 1375 }
1373 sb.write('_'); 1376 sb.write('_');
1374 visit(parameter); 1377 visit(parameter);
1375 first = true; 1378 first = true;
1376 } 1379 }
1377 } 1380 }
1378 } 1381 }
1379 } 1382 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698