Skip to content

Commit 973a1a0

Browse files
lrhncommit-bot@chromium.org
authored andcommitted
Remove uses of upper-case constants in remaining SDK code.
This includes Fasta, tools and observatory, so the checked-in SDK must have the lower-case constants. Change-Id: I8380ad041ad058f7d02ae19caccfecd434d13d75 Reviewed-on: https://dart-review.googlesource.com/50201 Commit-Queue: Lasse R.H. Nielsen <[email protected]> Reviewed-by: Leaf Petersen <[email protected]>
1 parent b3595d5 commit 973a1a0

File tree

114 files changed

+541
-560
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

114 files changed

+541
-560
lines changed

pkg/compiler/lib/compiler_new.dart

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,7 @@ export 'compiler.dart' show Diagnostic, PackagesDiscoveryProvider;
2525
enum InputKind {
2626
/// Data is read as UTF8 either as a [String] or a zero-terminated
2727
/// `List<int>`.
28-
utf8,
28+
UTF8,
2929

3030
/// Data is read as bytes in a `List<int>`.
3131
binary,
@@ -49,7 +49,7 @@ abstract class CompilerInput {
4949
/// Returns a future that completes to the source corresponding to [uri].
5050
/// If an exception occurs, the future completes with this exception.
5151
///
52-
/// If [inputKind] is `InputKind.utf8` the source can be represented either as
52+
/// If [inputKind] is `InputKind.UTF8` the source can be represented either as
5353
/// a zero-terminated `List<int>` of UTF-8 bytes or as a [String]. If
5454
/// [inputKind] is `InputKind.binary` the source is a read a `List<int>`.
5555
///
@@ -59,7 +59,7 @@ abstract class CompilerInput {
5959
/// scanner is more efficient in this case. In either case, the data structure
6060
/// is expected to hold a zero element at the last position. If this is not
6161
/// the case, the entire data structure is copied before scanning.
62-
Future<Input> readFromUri(Uri uri, {InputKind inputKind: InputKind.utf8});
62+
Future<Input> readFromUri(Uri uri, {InputKind inputKind: InputKind.UTF8});
6363
}
6464

6565
/// Output types used in `CompilerOutput.createOutputSink`.

pkg/compiler/lib/src/apiimpl.dart

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -116,7 +116,7 @@ class CompilerImpl extends Compiler {
116116
// [Future] to ensure that we never execute an asynchronous action without
117117
// setting up the current element of the compiler.
118118
return new Future.sync(
119-
() => callUserProvider(resourceUri, api.InputKind.utf8))
119+
() => callUserProvider(resourceUri, api.InputKind.UTF8))
120120
.then((api.Input sourceFile) {
121121
// We use [readableUri] as the URI for the script since need to preserve
122122
// the scheme in the script because [Script.uri] is used for resolving
@@ -265,11 +265,11 @@ class CompilerImpl extends Compiler {
265265
timings.writeln("Timings:");
266266
Duration totalDuration = measurer.wallClock.elapsed;
267267
Duration asyncDuration = measurer.asyncWallClock.elapsed;
268-
Duration cumulatedDuration = Duration.ZERO;
268+
Duration cumulatedDuration = Duration.zero;
269269
for (final task in tasks) {
270270
String running = task.isRunning ? "*" : "";
271271
Duration duration = task.duration;
272-
if (duration != Duration.ZERO) {
272+
if (duration != Duration.zero) {
273273
cumulatedDuration += duration;
274274
timings.writeln(' $running${task.name} took'
275275
' ${duration.inMilliseconds}msec');

pkg/compiler/lib/src/common/tasks.dart

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -49,7 +49,7 @@ abstract class CompilerTask {
4949
}
5050

5151
Duration get duration {
52-
if (_isDisabled) return Duration.ZERO;
52+
if (_isDisabled) return Duration.zero;
5353
Duration total = _watch.elapsed;
5454
for (GenericTask subtask in _subtasks.values) {
5555
total += subtask.duration;

pkg/compiler/lib/src/constants/values.dart

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -278,11 +278,11 @@ class DoubleConstantValue extends NumConstantValue {
278278

279279
factory DoubleConstantValue(double value) {
280280
if (value.isNaN) {
281-
return const DoubleConstantValue._internal(double.NAN);
282-
} else if (value == double.INFINITY) {
283-
return const DoubleConstantValue._internal(double.INFINITY);
284-
} else if (value == -double.INFINITY) {
285-
return const DoubleConstantValue._internal(-double.INFINITY);
281+
return const DoubleConstantValue._internal(double.nan);
282+
} else if (value == double.infinity) {
283+
return const DoubleConstantValue._internal(double.infinity);
284+
} else if (value == -double.infinity) {
285+
return const DoubleConstantValue._internal(-double.infinity);
286286
} else if (value == 0.0 && !value.isNegative) {
287287
return const DoubleConstantValue._internal(0.0);
288288
} else if (value == 1.0) {
@@ -305,9 +305,9 @@ class DoubleConstantValue extends NumConstantValue {
305305

306306
bool get isOne => doubleValue == 1.0;
307307

308-
bool get isPositiveInfinity => doubleValue == double.INFINITY;
308+
bool get isPositiveInfinity => doubleValue == double.infinity;
309309

310-
bool get isNegativeInfinity => doubleValue == -double.INFINITY;
310+
bool get isNegativeInfinity => doubleValue == -double.infinity;
311311

312312
DartType getType(CommonElements types) => types.doubleType;
313313

pkg/compiler/lib/src/dart2js.dart

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@
55
library dart2js.cmdline;
66

77
import 'dart:async' show Future;
8-
import 'dart:convert' show UTF8, LineSplitter;
8+
import 'dart:convert' show utf8, LineSplitter;
99
import 'dart:io' show exit, File, FileMode, Platform, stdin, stderr;
1010

1111
import 'package:front_end/src/api_unstable/dart2js.dart' as fe;
@@ -829,7 +829,7 @@ void batchMain(List<String> batchArguments) {
829829
throw _EXIT_SIGNAL;
830830
};
831831

832-
var stream = stdin.transform(UTF8.decoder).transform(new LineSplitter());
832+
var stream = stdin.transform(utf8.decoder).transform(new LineSplitter());
833833
var subscription;
834834
fe.InitializedCompilerState kernelInitializedCompilerState;
835835
subscription = stream.listen((line) {

pkg/compiler/lib/src/io/source_file.dart

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@
44

55
library dart2js.io.source_file;
66

7-
import 'dart:convert' show UTF8;
7+
import 'dart:convert' show utf8;
88
import 'dart:math';
99
import 'dart:typed_data' show Uint8List;
1010

@@ -19,7 +19,7 @@ abstract class SourceFile<T> implements Input<T>, LocationProvider {
1919
/// The absolute URI of the source file.
2020
Uri get uri;
2121

22-
InputKind get inputKind => InputKind.utf8;
22+
InputKind get inputKind => InputKind.UTF8;
2323

2424
kernel.Source cachedKernelSource;
2525

@@ -188,7 +188,7 @@ class Utf8BytesSourceFile extends SourceFile<List<int>> {
188188

189189
String slowText() {
190190
// Don't convert the trailing zero byte.
191-
return UTF8.decoder
191+
return utf8.decoder
192192
.convert(zeroTerminatedContent, 0, zeroTerminatedContent.length - 1);
193193
}
194194

@@ -248,7 +248,7 @@ class StringSourceFile extends SourceFile<String> {
248248
String slowText() => text;
249249

250250
List<int> slowUtf8ZeroTerminatedBytes() {
251-
return _zeroTerminateIfNecessary(UTF8.encode(text));
251+
return _zeroTerminateIfNecessary(utf8.encode(text));
252252
}
253253

254254
String slowSubstring(int start, int end) => text.substring(start, end);

pkg/compiler/lib/src/js_backend/constant_emitter.dart

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -146,9 +146,9 @@ class ConstantEmitter implements ConstantValueVisitor<jsAst.Expression, Null> {
146146
double value = constant.doubleValue;
147147
if (value.isNaN) {
148148
return js("0/0");
149-
} else if (value == double.INFINITY) {
149+
} else if (value == double.infinity) {
150150
return js("1/0");
151-
} else if (value == -double.INFINITY) {
151+
} else if (value == -double.infinity) {
152152
return js("-1/0");
153153
} else {
154154
String shortened = _shortenExponentialRepresentation("$value");

pkg/compiler/lib/src/js_backend/constant_system_javascript.dart

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -203,7 +203,7 @@ class JavaScriptRoundOperation implements UnaryOperation {
203203
if (constant.isInt) {
204204
IntConstantValue intConstant = constant;
205205
int value = intConstant.intValue;
206-
if (value >= -double.MAX_FINITE && value <= double.MAX_FINITE) {
206+
if (value >= -double.maxFinite && value <= double.maxFinite) {
207207
return tryToRound(value);
208208
}
209209
}

pkg/compiler/lib/src/js_emitter/program_builder/program_builder.dart

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@
55
library dart2js.js_emitter.program_builder;
66

77
import 'dart:io';
8-
import 'dart:convert' show JSON;
8+
import 'dart:convert' show jsonDecode;
99

1010
import '../../closure.dart' show ClosureConversionTask, ClosureFieldElement;
1111
import '../../common.dart';
@@ -315,7 +315,7 @@ class ProgramBuilder {
315315
}
316316

317317
String data = new File(allocatedClassesPath).readAsStringSync();
318-
Set<String> allocatedClassesKeys = JSON.decode(data).keys.toSet();
318+
Set<String> allocatedClassesKeys = jsonDecode(data).keys.toSet();
319319
Set<ClassEntity> allocatedClasses = new Set<ClassEntity>();
320320

321321
// Collects all super and mixin classes of a class.

pkg/compiler/lib/src/kernel/front_end_adapter.dart

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -37,7 +37,7 @@ class _CompilerFileSystemEntity implements fe.FileSystemEntity {
3737
api.Input input;
3838
try {
3939
input = await fs.inputProvider
40-
.readFromUri(uri, inputKind: api.InputKind.utf8);
40+
.readFromUri(uri, inputKind: api.InputKind.UTF8);
4141
} catch (e) {
4242
throw new fe.FileSystemException(uri, '$e');
4343
}

0 commit comments

Comments
 (0)