OLD | NEW |
1 // Copyright (c) 2014, the Dart project authors. Please see the AUTHORS file | 1 // Copyright (c) 2014, 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 library dart2js_incremental.library_updater; | 5 library dart2js_incremental.library_updater; |
6 | 6 |
7 import 'dart:async' show | 7 import 'dart:async' show |
8 Future; | 8 Future; |
9 | 9 |
10 import 'dart:convert' show | 10 import 'dart:convert' show |
(...skipping 977 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
988 // appear as if it was newly enqueued. | 988 // appear as if it was newly enqueued. |
989 if (element.initializer == null) { | 989 if (element.initializer == null) { |
990 return const <jsAst.Statement>[]; | 990 return const <jsAst.Statement>[]; |
991 } else { | 991 } else { |
992 throw new StateError("Don't know how to compile $element"); | 992 throw new StateError("Don't know how to compile $element"); |
993 } | 993 } |
994 } | 994 } |
995 } | 995 } |
996 | 996 |
997 String prettyPrintJs(jsAst.Node node) { | 997 String prettyPrintJs(jsAst.Node node) { |
998 jsAst.Printer printer = new jsAst.Printer(compiler, null); | 998 jsAst.JavaScriptPrintingOptions options = |
| 999 new jsAst.JavaScriptPrintingOptions(); |
| 1000 jsAst.JavaScriptPrintingContext context = |
| 1001 new jsAst.Dart2JSJavaScriptPrintingContext(compiler, null); |
| 1002 jsAst.Printer printer = new jsAst.Printer(options, context); |
999 printer.blockOutWithoutBraces(node); | 1003 printer.blockOutWithoutBraces(node); |
1000 return printer.outBuffer.getText(); | 1004 return context.outBuffer.getText(); |
1001 } | 1005 } |
1002 | 1006 |
1003 String callNameFor(FunctionElement element) { | 1007 String callNameFor(FunctionElement element) { |
1004 // TODO(ahe): Call a method in the compiler to obtain this name. | 1008 // TODO(ahe): Call a method in the compiler to obtain this name. |
1005 String callPrefix = namer.callPrefix; | 1009 String callPrefix = namer.callPrefix; |
1006 int parameterCount = element.functionSignature.parameterCount; | 1010 int parameterCount = element.functionSignature.parameterCount; |
1007 return '$callPrefix\$$parameterCount'; | 1011 return '$callPrefix\$$parameterCount'; |
1008 } | 1012 } |
1009 | 1013 |
1010 List<String> computeFields(ClassElement cls) { | 1014 List<String> computeFields(ClassElement cls) { |
(...skipping 471 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1482 .buildFieldsHackForIncrementalCompilation(classElement); | 1486 .buildFieldsHackForIncrementalCompilation(classElement); |
1483 // TODO(ahe): Rewrite for new emitter. | 1487 // TODO(ahe): Rewrite for new emitter. |
1484 ClassBuilder builder = new ClassBuilder(classElement, namer); | 1488 ClassBuilder builder = new ClassBuilder(classElement, namer); |
1485 classEmitter.emitFields(cls, builder); | 1489 classEmitter.emitFields(cls, builder); |
1486 return builder.fields; | 1490 return builder.fields; |
1487 } | 1491 } |
1488 } | 1492 } |
1489 | 1493 |
1490 // TODO(ahe): Remove this method. | 1494 // TODO(ahe): Remove this method. |
1491 NO_WARN(x) => x; | 1495 NO_WARN(x) => x; |
OLD | NEW |