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

Side by Side Diff: lib/src/js/printer.dart

Issue 1045323002: emit interfaces before use (Closed) Base URL: git@github.com:dart-lang/dev_compiler.git@master
Patch Set: Created 5 years, 8 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
« no previous file with comments | « lib/src/codegen/js_codegen.dart ('k') | test/codegen/expect/constructors.js » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright (c) 2012, the Dart project authors. Please see the AUTHORS file 1 // Copyright (c) 2012, 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_ast; 5 part of js_ast;
6 6
7 7
8 class JavaScriptPrintingOptions { 8 class JavaScriptPrintingOptions {
9 final bool shouldCompressOutput; 9 final bool shouldCompressOutput;
10 final bool minifyLocalVariables; 10 final bool minifyLocalVariables;
(...skipping 944 matching lines...) Expand 10 before | Expand all | Expand 10 after
955 } 955 }
956 956
957 visitClassExpression(ClassExpression node) { 957 visitClassExpression(ClassExpression node) {
958 out('class '); 958 out('class ');
959 visit(node.name); 959 visit(node.name);
960 if (node.heritage != null) { 960 if (node.heritage != null) {
961 out(' extends '); 961 out(' extends ');
962 visit(node.heritage); 962 visit(node.heritage);
963 } 963 }
964 spaceOut(); 964 spaceOut();
965 out('{'); 965 if (node.methods.isNotEmpty) {
966 lineOut(); 966 out('{');
967 indentMore(); 967 lineOut();
968 for (var method in node.methods) { 968 indentMore();
969 for (var method in node.methods) {
970 indent();
971 visit(method);
972 lineOut();
973 }
974 indentLess();
969 indent(); 975 indent();
970 visit(method); 976 out('}');
971 lineOut(); 977 } else {
978 out('{}');
972 } 979 }
973 indentLess();
974 indent();
975 out('}');
976 } 980 }
977 981
978 visitMethod(Method node) { 982 visitMethod(Method node) {
979 if (node.isStatic) { 983 if (node.isStatic) {
980 out('static '); 984 out('static ');
981 } 985 }
982 if (node.isGetter) { 986 if (node.isGetter) {
983 out('get '); 987 out('get ');
984 } else if (node.isSetter) { 988 } else if (node.isSetter) {
985 out('set '); 989 out('set ');
(...skipping 379 matching lines...) Expand 10 before | Expand all | Expand 10 after
1365 codes.add(nthLetter((n ~/ nameSpaceSize) % LETTERS)); 1369 codes.add(nthLetter((n ~/ nameSpaceSize) % LETTERS));
1366 } 1370 }
1367 codes.add(charCodes.$0 + digit); 1371 codes.add(charCodes.$0 + digit);
1368 newName = new String.fromCharCodes(codes); 1372 newName = new String.fromCharCodes(codes);
1369 } 1373 }
1370 assert(new RegExp(r'[a-zA-Z][a-zA-Z0-9]*').hasMatch(newName)); 1374 assert(new RegExp(r'[a-zA-Z][a-zA-Z0-9]*').hasMatch(newName));
1371 maps.last[oldName] = newName; 1375 maps.last[oldName] = newName;
1372 return newName; 1376 return newName;
1373 } 1377 }
1374 } 1378 }
OLDNEW
« no previous file with comments | « lib/src/codegen/js_codegen.dart ('k') | test/codegen/expect/constructors.js » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698