Index: dart/sdk/lib/_internal/compiler/samples/jsonify/jsonify.dart |
diff --git a/dart/sdk/lib/_internal/compiler/samples/jsonify/jsonify.dart b/dart/sdk/lib/_internal/compiler/samples/jsonify/jsonify.dart |
index 36596aaa2b91d4e02e92a1f87ddd0e251d239851..e639c4e52e9ef70a071500a93f9cdda7c92eff84 100644 |
--- a/dart/sdk/lib/_internal/compiler/samples/jsonify/jsonify.dart |
+++ b/dart/sdk/lib/_internal/compiler/samples/jsonify/jsonify.dart |
@@ -31,6 +31,8 @@ var handler; |
RandomAccessFile output; |
Uri outputUri; |
Uri sdkRoot; |
+const bool outputJson = |
+ const bool.fromEnvironment('outputJson', defaultValue: false); |
main(List<String> arguments) { |
handler = new FormattingDiagnosticHandler() |
@@ -77,7 +79,10 @@ jsonify(MirrorSystem mirrors) { |
} |
}); |
- output.writeStringSync(''' |
+ if (outputJson) { |
+ output.writeStringSync(JSON.encode(map)); |
+ } else { |
+ output.writeStringSync(''' |
// Copyright (c) 2013, the Dart project authors. Please see the AUTHORS file |
// for details. All rights reserved. Use of this source code is governed by a |
// BSD-style license that can be found in the LICENSE file. |
@@ -88,7 +93,8 @@ jsonify(MirrorSystem mirrors) { |
library dart.sdk_sources; |
const Map<String, String> SDK_SOURCES = const <String, String>'''); |
- output.writeStringSync(JSON.encode(map).replaceAll(r'$', r'\$')); |
- output.writeStringSync(';\n'); |
+ output.writeStringSync(JSON.encode(map).replaceAll(r'$', r'\$')); |
+ output.writeStringSync(';\n'); |
+ } |
output.closeSync(); |
} |