Skip to content

Commit

Permalink
Revert string interp (flutter#49602)
Browse files Browse the repository at this point in the history
  • Loading branch information
dnfield authored Jan 28, 2020
1 parent bc5ea0a commit fabeb2a
Show file tree
Hide file tree
Showing 57 changed files with 88 additions and 80 deletions.
2 changes: 1 addition & 1 deletion dev/bots/unpublish_package.dart
Original file line number Diff line number Diff line change
Expand Up @@ -391,7 +391,7 @@ void _printBanner(String message) {
final String banner = '*** $message ***';
print('\n');
print('*' * banner.length);
print(banner);
print('$banner');
print('*' * banner.length);
print('\n');
}
Expand Down
2 changes: 1 addition & 1 deletion dev/customer_testing/run_tests.dart
Original file line number Diff line number Diff line change
Expand Up @@ -272,7 +272,7 @@ Future<bool> shell(String command, Directory directory, { bool verbose = false,
print('>> $command');
Process process;
if (Platform.isWindows) {
process = await Process.start('CMD.EXE', <String>['/S', '/C', command], workingDirectory: directory.path);
process = await Process.start('CMD.EXE', <String>['/S', '/C', '$command'], workingDirectory: directory.path);
} else {
final List<String> segments = command.trim().split(_spaces);
process = await Process.start(segments.first, segments.skip(1).toList(), workingDirectory: directory.path);
Expand Down
2 changes: 1 addition & 1 deletion dev/devicelab/bin/tasks/named_isolates_test.dart
Original file line number Diff line number Diff line change
Expand Up @@ -51,7 +51,7 @@ void main() {
print('Extracted observatory port: $observatoryUri');
final Process attachProcess =
await _run(device: device, command: <String>['attach', '--debug-uri',
observatoryUri, '--isolate-filter', _kSecondIsolateName], stdoutListener: (String line) {
observatoryUri, '--isolate-filter', '$_kSecondIsolateName'], stdoutListener: (String line) {
if (line.contains(_kFirstIsolateName)) {
firstNameFound.complete();
} else if (line.contains(_kSecondIsolateName)) {
Expand Down
12 changes: 11 additions & 1 deletion dev/integration_tests/release_smoke_test/lib/main.dart
Original file line number Diff line number Diff line change
Expand Up @@ -2,18 +2,28 @@
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.

import 'dart:convert' show utf8;

import 'package:flutter/foundation.dart';
import 'package:flutter/widgets.dart';

void main() {
Future<void> main() async {
const Text text = Text('Hello, world!', textDirection: TextDirection.ltr);
// These calls must not result in an error. They behave differently in
// release mode compared to debug or profile.
// The test will grep logcat for any errors emitted by Flutter.
print(text.toDiagnosticsNode());
print(text.toStringDeep());
// regression test for https://github.com/flutter/flutter/issues/49601
final List<int> computed = await compute(_utf8Encode, 'test', debugLabel: null);
print(computed);
runApp(
const Center(
child: text,
),
);
}

List<int> _utf8Encode(String data) {
return utf8.encode(data);
}
10 changes: 5 additions & 5 deletions dev/manual_tests/lib/density.dart
Original file line number Diff line number Diff line change
Expand Up @@ -246,7 +246,7 @@ class _OptionsState extends State<Options> {
),
),
Text(
widget.model.size.toStringAsFixed(3),
'${widget.model.size.toStringAsFixed(3)}',
style: TextStyle(color: Colors.grey[50]),
),
],
Expand All @@ -261,7 +261,7 @@ class _OptionsState extends State<Options> {
child: SliderTheme(
data: controlTheme,
child: Slider(
label: widget.model.density.horizontal.toStringAsFixed(1),
label: '${widget.model.density.horizontal.toStringAsFixed(1)}',
min: VisualDensity.minimumDensity,
max: VisualDensity.maximumDensity,
onChanged: (double value) {
Expand All @@ -272,7 +272,7 @@ class _OptionsState extends State<Options> {
),
),
Text(
widget.model.density.horizontal.toStringAsFixed(3),
'${widget.model.density.horizontal.toStringAsFixed(3)}',
style: TextStyle(color: Colors.grey[50]),
),
],
Expand All @@ -287,7 +287,7 @@ class _OptionsState extends State<Options> {
child: SliderTheme(
data: controlTheme,
child: Slider(
label: widget.model.density.vertical.toStringAsFixed(1),
label: '${widget.model.density.vertical.toStringAsFixed(1)}',
min: VisualDensity.minimumDensity,
max: VisualDensity.maximumDensity,
onChanged: (double value) {
Expand All @@ -298,7 +298,7 @@ class _OptionsState extends State<Options> {
),
),
Text(
widget.model.density.vertical.toStringAsFixed(3),
'${widget.model.density.vertical.toStringAsFixed(3)}',
style: TextStyle(color: Colors.grey[50]),
),
],
Expand Down
2 changes: 1 addition & 1 deletion dev/tools/gen_keycodes/lib/code_gen.dart
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ class CodeGenerator {
currentLine += ' $word';
} else {
result.writeln('$prefix$currentLine');
currentLine = word;
currentLine = '$word';
}
}
if (currentLine.isNotEmpty) {
Expand Down
2 changes: 1 addition & 1 deletion dev/tools/localization/localizations_utils.dart
Original file line number Diff line number Diff line change
Expand Up @@ -339,7 +339,7 @@ String describeLocale(String tag) {
assert(subtags.isNotEmpty);
assert(_languages.containsKey(subtags[0]));
final String language = _languages[subtags[0]];
String output = language;
String output = '$language';
String region;
String script;
if (subtags.length == 2) {
Expand Down
2 changes: 1 addition & 1 deletion examples/catalog/bin/sample_page.dart
Original file line number Diff line number Diff line change
Expand Up @@ -202,7 +202,7 @@ void generate(String commit) {
outputFile('${className}_index.md'),
inputFile('bin', 'class_index.md.template').readAsStringSync(),
<String, String>{
'class': className,
'class': '$className',
'entries': entries.join('\n'),
'link': '${className}_index',
},
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -113,11 +113,11 @@ class DessertDataSource extends DataTableSource {
}
},
cells: <DataCell>[
DataCell(Text(dessert.name)),
DataCell(Text('${dessert.name}')),
DataCell(Text('${dessert.calories}')),
DataCell(Text(dessert.fat.toStringAsFixed(1))),
DataCell(Text('${dessert.fat.toStringAsFixed(1)}')),
DataCell(Text('${dessert.carbs}')),
DataCell(Text(dessert.protein.toStringAsFixed(1))),
DataCell(Text('${dessert.protein.toStringAsFixed(1)}')),
DataCell(Text('${dessert.sodium}')),
DataCell(Text('${dessert.calcium}%')),
DataCell(Text('${dessert.iron}%')),
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -83,7 +83,7 @@ class DateTimeItem extends StatelessWidget {
},
child: Row(
children: <Widget>[
Text(time.format(context)),
Text('${time.format(context)}'),
const Icon(Icons.arrow_drop_down, color: Colors.black54),
],
),
Expand Down
2 changes: 1 addition & 1 deletion examples/flutter_gallery/lib/demo/material/tabs_demo.dart
Original file line number Diff line number Diff line change
Expand Up @@ -113,7 +113,7 @@ class _CardDataItem extends StatelessWidget {
alignment: page.id == 'H'
? Alignment.centerLeft
: Alignment.centerRight,
child: CircleAvatar(child: Text(page.id)),
child: CircleAvatar(child: Text('${page.id}')),
),
SizedBox(
width: 144.0,
Expand Down
8 changes: 4 additions & 4 deletions examples/flutter_gallery/lib/gallery/options.dart
Original file line number Diff line number Diff line change
Expand Up @@ -231,7 +231,7 @@ class _ThemeModeItem extends StatelessWidget {
children: <Widget>[
const Text('Theme'),
Text(
modeLabels[options.themeMode],
'${modeLabels[options.themeMode]}',
style: Theme.of(context).primaryTextTheme.bodyText2,
),
],
Expand Down Expand Up @@ -278,7 +278,7 @@ class _TextScaleFactorItem extends StatelessWidget {
children: <Widget>[
const Text('Text size'),
Text(
options.textScaleFactor.label,
'${options.textScaleFactor.label}',
style: Theme.of(context).primaryTextTheme.bodyText2,
),
],
Expand Down Expand Up @@ -324,7 +324,7 @@ class _VisualDensityItem extends StatelessWidget {
children: <Widget>[
const Text('Visual density'),
Text(
options.visualDensity.label,
'${options.visualDensity.label}',
style: Theme.of(context).primaryTextTheme.bodyText2,
),
],
Expand Down Expand Up @@ -431,7 +431,7 @@ class _PlatformItem extends StatelessWidget {
children: <Widget>[
const Text('Platform mechanics'),
Text(
_platformLabel(options.platform),
'${_platformLabel(options.platform)}',
style: Theme.of(context).primaryTextTheme.bodyText2,
),
],
Expand Down
4 changes: 2 additions & 2 deletions examples/stocks/lib/stock_symbol_viewer.dart
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ class _StockSymbolView extends StatelessWidget {
Row(
children: <Widget>[
Text(
stock.symbol,
'${stock.symbol}',
key: ValueKey<String>('${stock.symbol}_symbol_name'),
style: Theme.of(context).textTheme.headline3,
),
Expand All @@ -43,7 +43,7 @@ class _StockSymbolView extends StatelessWidget {
height: 8.0
),
Text('Market Cap', style: headings),
Text(stock.marketCap),
Text('${stock.marketCap}'),
Container(
height: 8.0
),
Expand Down
2 changes: 1 addition & 1 deletion packages/flutter/lib/src/animation/animation.dart
Original file line number Diff line number Diff line change
Expand Up @@ -207,6 +207,6 @@ abstract class Animation<T> extends Listenable implements ValueListenable<T> {
break;
}
assert(icon != null);
return icon;
return '$icon';
}
}
2 changes: 1 addition & 1 deletion packages/flutter/lib/src/animation/curves.dart
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,7 @@ abstract class ParametricCurve<T> {
}

@override
String toString() => objectRuntimeType(this, 'ParametricCurve');
String toString() => '${objectRuntimeType(this, 'ParametricCurve')}';
}

/// An parametric animation easing curve, i.e. a mapping of the unit interval to
Expand Down
2 changes: 1 addition & 1 deletion packages/flutter/lib/src/foundation/_isolates_io.dart
Original file line number Diff line number Diff line change
Expand Up @@ -80,7 +80,7 @@ class _IsolateConfiguration<Q, R> {
Future<void> _spawn<Q, R>(_IsolateConfiguration<Q, FutureOr<R>> configuration) async {
R result;
await Timeline.timeSync(
configuration.debugLabel,
'${configuration.debugLabel}',
() async {
final FutureOr<R> applicationResult = await configuration.apply();
result = await applicationResult;
Expand Down
4 changes: 2 additions & 2 deletions packages/flutter/lib/src/foundation/assertions.dart
Original file line number Diff line number Diff line change
Expand Up @@ -381,7 +381,7 @@ class FlutterErrorDetails extends Diagnosticable {
debugFillProperties(builder);
summary = builder.properties.firstWhere((DiagnosticsNode node) => node.level == DiagnosticLevel.summary, orElse: () => null);
}
return summary ?? ErrorSummary(formatException());
return summary ?? ErrorSummary('${formatException()}');
}

@override
Expand Down Expand Up @@ -415,7 +415,7 @@ class FlutterErrorDetails extends Diagnosticable {
String message = exceptionAsString();
if (message.startsWith(prefix))
message = message.substring(prefix.length);
properties.add(ErrorSummary(message));
properties.add(ErrorSummary('$message'));
}
}

Expand Down
4 changes: 2 additions & 2 deletions packages/flutter/lib/src/foundation/diagnostics.dart
Original file line number Diff line number Diff line change
Expand Up @@ -1277,7 +1277,7 @@ class TextTreeRenderer {
// with cases where a single line properties output may not have single
// linebreak.
final String propertyRender = render(property,
prefixLineOne: propertyStyle.prefixLineOne,
prefixLineOne: '${propertyStyle.prefixLineOne}',
prefixOtherLines: '${propertyStyle.childLinkSpace}${propertyStyle.prefixOtherLines}',
parentConfiguration: config,
);
Expand Down Expand Up @@ -1306,7 +1306,7 @@ class TextTreeRenderer {
if (!config.lineBreakProperties)
builder.write(config.lineBreak);

final String prefixChildren = config.bodyIndent;
final String prefixChildren = '${config.bodyIndent}';
final String prefixChildrenRaw = '$prefixOtherLines$prefixChildren';
if (children.isEmpty &&
config.addBlankLineIfNoChildren &&
Expand Down
2 changes: 1 addition & 1 deletion packages/flutter/lib/src/gestures/mouse_tracking.dart
Original file line number Diff line number Diff line change
Expand Up @@ -174,7 +174,7 @@ class _MouseState {
@override
String toString() {
String describeEvent(PointerEvent event) {
return event == null ? 'null' : describeIdentity(event);
return event == null ? 'null' : '${describeIdentity(event)}';
}
final String describeLatestEvent = 'latestEvent: ${describeEvent(latestEvent)}';
final String describeAnnotations = 'annotations: [list of ${annotations.length}]';
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -122,7 +122,7 @@ abstract class FloatingActionButtonLocation {
Offset getOffset(ScaffoldPrelayoutGeometry scaffoldGeometry);

@override
String toString() => objectRuntimeType(this, 'FloatingActionButtonLocation');
String toString() => '${objectRuntimeType(this, 'FloatingActionButtonLocation')}';
}

double _leftOffset(ScaffoldPrelayoutGeometry scaffoldGeometry, { double offset = 0.0 }) {
Expand Down Expand Up @@ -407,7 +407,7 @@ abstract class FloatingActionButtonAnimator {
double getAnimationRestart(double previousValue) => 0.0;

@override
String toString() => objectRuntimeType(this, 'FloatingActionButtonAnimator');
String toString() => '${objectRuntimeType(this, 'FloatingActionButtonAnimator')}';
}

class _ScalingFabMotionAnimator extends FloatingActionButtonAnimator {
Expand Down
2 changes: 1 addition & 1 deletion packages/flutter/lib/src/painting/decoration.dart
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ abstract class Decoration extends Diagnosticable {
const Decoration();

@override
String toStringShort() => objectRuntimeType(this, 'Decoration');
String toStringShort() => '${objectRuntimeType(this, 'Decoration')}';

/// In checked mode, throws an exception if the object is not in a
/// valid configuration. Otherwise, returns true.
Expand Down
2 changes: 1 addition & 1 deletion packages/flutter/lib/src/painting/strut_style.dart
Original file line number Diff line number Diff line change
Expand Up @@ -571,7 +571,7 @@ class StrutStyle extends Diagnosticable {
}

@override
String toStringShort() => objectRuntimeType(this, 'StrutStyle');
String toStringShort() => '${objectRuntimeType(this, 'StrutStyle')}';

/// Adds all properties prefixing property names with the optional `prefix`.
@override
Expand Down
2 changes: 1 addition & 1 deletion packages/flutter/lib/src/painting/text_span.dart
Original file line number Diff line number Diff line change
Expand Up @@ -440,7 +440,7 @@ class TextSpan extends InlineSpan {
);

@override
String toStringShort() => objectRuntimeType(this, 'TextSpan');
String toStringShort() => '${objectRuntimeType(this, 'TextSpan')}';

@override
void debugFillProperties(DiagnosticPropertiesBuilder properties) {
Expand Down
2 changes: 1 addition & 1 deletion packages/flutter/lib/src/painting/text_style.dart
Original file line number Diff line number Diff line change
Expand Up @@ -1195,7 +1195,7 @@ class TextStyle extends Diagnosticable {
}

@override
String toStringShort() => objectRuntimeType(this, 'TextStyle');
String toStringShort() => '${objectRuntimeType(this, 'TextStyle')}';

/// Adds all properties prefixing property names with the optional `prefix`.
@override
Expand Down
2 changes: 1 addition & 1 deletion packages/flutter/lib/src/physics/simulation.dart
Original file line number Diff line number Diff line change
Expand Up @@ -54,5 +54,5 @@ abstract class Simulation {
Tolerance tolerance;

@override
String toString() => objectRuntimeType(this, 'Simulation');
String toString() => '${objectRuntimeType(this, 'Simulation')}';
}
2 changes: 1 addition & 1 deletion packages/flutter/lib/src/rendering/custom_layout.dart
Original file line number Diff line number Diff line change
Expand Up @@ -294,7 +294,7 @@ abstract class MultiChildLayoutDelegate {
///
/// By default, returns the [runtimeType] of the class.
@override
String toString() => objectRuntimeType(this, 'MultiChildLayoutDelegate');
String toString() => '${objectRuntimeType(this, 'MultiChildLayoutDelegate')}';
}

/// Defers the layout of multiple children to a delegate.
Expand Down
2 changes: 1 addition & 1 deletion packages/flutter/lib/src/rendering/flow.dart
Original file line number Diff line number Diff line change
Expand Up @@ -132,7 +132,7 @@ abstract class FlowDelegate {
///
/// By default, returns the [runtimeType] of the class.
@override
String toString() => objectRuntimeType(this, 'FlowDelegate');
String toString() => '${objectRuntimeType(this, 'FlowDelegate')}';
}

/// Parent data for use with [RenderFlow].
Expand Down
2 changes: 1 addition & 1 deletion packages/flutter/lib/src/rendering/proxy_box.dart
Original file line number Diff line number Diff line change
Expand Up @@ -1138,7 +1138,7 @@ abstract class CustomClipper<T> {
bool shouldReclip(covariant CustomClipper<T> oldClipper);

@override
String toString() => objectRuntimeType(this, 'CustomClipper');
String toString() => '${objectRuntimeType(this, 'CustomClipper')}';
}

/// A [CustomClipper] that clips to the outer path of a [ShapeBorder].
Expand Down
2 changes: 1 addition & 1 deletion packages/flutter/lib/src/rendering/sliver.dart
Original file line number Diff line number Diff line change
Expand Up @@ -759,7 +759,7 @@ class SliverGeometry extends Diagnosticable {
}

@override
String toStringShort() => objectRuntimeType(this, 'SliverGeometry');
String toStringShort() => '${objectRuntimeType(this, 'SliverGeometry')}';

@override
void debugFillProperties(DiagnosticPropertiesBuilder properties) {
Expand Down
2 changes: 1 addition & 1 deletion packages/flutter/lib/src/rendering/table.dart
Original file line number Diff line number Diff line change
Expand Up @@ -76,7 +76,7 @@ abstract class TableColumnWidth {
double flex(Iterable<RenderBox> cells) => null;

@override
String toString() => objectRuntimeType(this, 'TableColumnWidth');
String toString() => '${objectRuntimeType(this, 'TableColumnWidth')}';
}

/// Sizes the column according to the intrinsic dimensions of all the
Expand Down
Loading

0 comments on commit fabeb2a

Please sign in to comment.