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

Unified Diff: sdk/lib/_internal/compiler/implementation/helpers/helpers.dart

Issue 574683002: Use ConstExp for storing constants. (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: Fixes and further implementation. Created 6 years, 3 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 side-by-side diff with in-line comments
Download patch
Index: sdk/lib/_internal/compiler/implementation/helpers/helpers.dart
diff --git a/sdk/lib/_internal/compiler/implementation/helpers/helpers.dart b/sdk/lib/_internal/compiler/implementation/helpers/helpers.dart
index c280bdae4f96c57a191e5fb5ae683a8085e15fae..a52705c32e5062ad07cb280b1c59b8d4097c5634 100644
--- a/sdk/lib/_internal/compiler/implementation/helpers/helpers.dart
+++ b/sdk/lib/_internal/compiler/implementation/helpers/helpers.dart
@@ -27,21 +27,46 @@ part 'track_map.dart';
/// printouts.
const bool DEBUG_PRINT_ENABLED = true;
+/// Enables debug mode.
karlklose 2014/09/25 08:43:25 Why do we need this mode? We already test that th
Johnni Winther 2014/09/29 08:24:44 See comment on Constant.toString()
+///
+/// Sets the [DEBUG_MODE] to `true`.
+void enableDebugMode() {
+ DEBUG_MODE = true;
+}
+
class _DebugIndentation extends Indentation {
final String indentationUnit = " ";
}
_DebugIndentation _indentation = new _DebugIndentation();
+/// Function signature of [debugPrint].
+typedef DebugPrint(s);
+
/// If [DEBUG_PRINT_ENABLED] is `true` print [s] using the current identation.
-debugPrint(s) {
+DebugPrint get debugPrint {
+ enableDebugMode();
+ return _debugPrint;
+}
+
+/// Implementation of [debugPrint].
+_debugPrint(s) {
if (DEBUG_PRINT_ENABLED) print('${_indentation.indentation}$s');
}
+/// Function signature of [debugWrapPrint].
+typedef DebugWrapPrint(s, f());
+
/// Wraps the call to [f] with a print of 'start:$s' and 'end:$s' incrementing
/// the current indentation used by [debugPrint] during the execution of [f].
///
/// Use this to get a tree-like debug printout for nested calls.
-debugWrapPrint(s, f()) {
+DebugWrapPrint get debugWrapPrint {
+ enableDebugMode();
+ return _debugWrapPrint;
+}
+
+/// Implementation of [debugWrapPrint].
+DebugWrapPrint _debugWrapPrint(s, f()) {
debugPrint('start:$s');
var result = _indentation.indentBlock(f);
debugPrint('end:$s');
@@ -49,10 +74,21 @@ debugWrapPrint(s, f()) {
}
/// Dummy method to mark breakpoints.
-debugBreak() {}
+debugBreak() {
+ enableDebugMode();
+}
+
+/// Function signature of [reportHere].
+typedef ReportHere(Compiler compiler, Spannable node, String debugMessage);
/// Print a message with a source location.
-reportHere(Compiler compiler, Spannable node, String debugMessage) {
+ReportHere get reportHere {
+ enableDebugMode();
sigurdm 2014/09/25 08:44:56 Maybe ensure that debug mode is disabled after deb
Johnni Winther 2014/09/29 08:24:44 TODO added.
+ return _reportHere;
+}
+
+/// Implementation of [reportHere]
+_reportHere(Compiler compiler, Spannable node, String debugMessage) {
compiler.reportInfo(node,
MessageKind.GENERIC, {'text': 'HERE: $debugMessage'});
}

Powered by Google App Engine
This is Rietveld 408576698