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

Unified Diff: sdk/lib/_internal/compiler/implementation/helpers/trace.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/trace.dart
diff --git a/sdk/lib/_internal/compiler/implementation/helpers/trace.dart b/sdk/lib/_internal/compiler/implementation/helpers/trace.dart
index cccf14f0c99664eb62c0768464bb0781e8205857..a6bdcf67c2b307ef405b834893223cec8822ca6f 100644
--- a/sdk/lib/_internal/compiler/implementation/helpers/trace.dart
+++ b/sdk/lib/_internal/compiler/implementation/helpers/trace.dart
@@ -4,6 +4,12 @@
part of dart2js.helpers;
+/// Function signature for [trace].
+typedef void Trace(String message,
+ {bool condition(String stackTrace),
+ int limit,
+ bool throwOnPrint});
+
/**
* Helper method for printing stack traces for debugging.
*
@@ -21,8 +27,13 @@ part of dart2js.helpers;
* unknown call-sites in tests by filtering known call-sites and throwning
* otherwise.
*/
-void trace(String message, {bool condition(String stackTrace), int limit,
- bool throwOnPrint: false}) {
+Trace get trace {
+ enableDebugMode();
+ return _trace;
+}
+
+void _trace(String message, {bool condition(String stackTrace), int limit,
+ bool throwOnPrint: false}) {
try {
throw '';
} catch (e, s) {
@@ -42,9 +53,24 @@ void trace(String message, {bool condition(String stackTrace), int limit,
}
}
-void traceAndReport(Compiler compiler, Spannable node, String message,
- {bool condition(String stackTrace), int limit,
- bool throwOnPrint: false}) {
+/// Function signature of [traceAndReport].
+typedef void TraceAndReport(Compiler compiler, Spannable node, String message,
+ {bool condition(String stackTrace), int limit,
+ bool throwOnPrint});
+
+/// Calls [reportHere] and [trace] with the same message.
+TraceAndReport get traceAndReport {
+ enableDebugMode();
+ return _traceAndReport;
+}
+
+/// Calls [reportHere] and [trace] with the same message.
+TraceAndReport get reportAndTrace => traceAndReport;
+
+/// Implementation of [traceAndReport].
+void _traceAndReport(Compiler compiler, Spannable node, String message,
+ {bool condition(String stackTrace), int limit,
+ bool throwOnPrint: false}) {
trace(message, limit: limit, throwOnPrint: throwOnPrint,
condition: (String stackTrace) {

Powered by Google App Engine
This is Rietveld 408576698