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

Unified Diff: pkg/compiler/lib/src/helpers/trace.dart

Issue 2439573003: Experiment with new function-type syntax.
Patch Set: Change a few more typedefs. Created 4 years, 2 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: pkg/compiler/lib/src/helpers/trace.dart
diff --git a/pkg/compiler/lib/src/helpers/trace.dart b/pkg/compiler/lib/src/helpers/trace.dart
index 021ba97fd92e01bb96972ed913243e42df47960d..024e9506b3093ec76ef493001f3c9fd81be84ab4 100644
--- a/pkg/compiler/lib/src/helpers/trace.dart
+++ b/pkg/compiler/lib/src/helpers/trace.dart
@@ -5,10 +5,6 @@
import '../common.dart';
import '../util/util.dart';
-/// 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.
*
@@ -26,13 +22,16 @@ typedef void Trace(String message,
* unknown call-sites in tests by filtering known call-sites and throwning
* otherwise.
*/
-Trace get trace {
+(String message, {(String stackTrace) -> bool condition, int limit,
+ bool throwOnPrint}) -> void
+get trace {
enableDebugMode();
return _trace;
}
void _trace(String message,
- {bool condition(String stackTrace), int limit, bool throwOnPrint: false}) {
+ {(String stackTrace) -> bool condition, int limit,
+ bool throwOnPrint: false}) {
try {
throw '';
} catch (e, s) {
@@ -59,9 +58,10 @@ traceExceptions(List<String> exceptions) {
}
/// Function signature of [traceAndReport].
-typedef void TraceAndReport(
- DiagnosticReporter reporter, Spannable node, String message,
- {bool condition(String stackTrace), int limit, bool throwOnPrint});
+typedef TraceAndReport = (
+ DiagnosticReporter, Spannable node, String message,
+ {(String stackTrace) -> bool condition, int limit, bool throwOnPrint})
+ -> void;
/// Calls [reportHere] and [trace] with the same message.
TraceAndReport get traceAndReport {
@@ -75,7 +75,8 @@ TraceAndReport get reportAndTrace => traceAndReport;
/// Implementation of [traceAndReport].
void _traceAndReport(
DiagnosticReporter reporter, Spannable node, String message,
- {bool condition(String stackTrace), int limit, bool throwOnPrint: false}) {
+ {(String stackTrace) -> bool condition, int limit,
+ bool throwOnPrint: false}) {
trace(message, limit: limit, throwOnPrint: throwOnPrint,
condition: (String stackTrace) {
bool result = condition != null ? condition(stackTrace) : true;

Powered by Google App Engine
This is Rietveld 408576698