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

+3-3
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

+3-3
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

+1-1
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

+7-7
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

+2-2
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

+4-4
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

+2-2
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

+1-1
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

+2-2
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

+1-1
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
}

pkg/compiler/lib/src/old_to_new_api.dart

+2-2
Original file line numberDiff line numberDiff line change
@@ -22,10 +22,10 @@ class LegacyCompilerInput implements CompilerInput {
2222
LegacyCompilerInput(this._inputProvider);
2323

2424
@override
25-
Future<Input> readFromUri(Uri uri, {InputKind inputKind: InputKind.utf8}) {
25+
Future<Input> readFromUri(Uri uri, {InputKind inputKind: InputKind.UTF8}) {
2626
return _inputProvider(uri).then((/*String|List<int>*/ data) {
2727
switch (inputKind) {
28-
case InputKind.utf8:
28+
case InputKind.UTF8:
2929
SourceFile sourceFile;
3030
if (data is List<int>) {
3131
sourceFile = new Utf8BytesSourceFile(uri, data);

pkg/compiler/lib/src/source_file_provider.dart

+8-8
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,7 @@ abstract class SourceFileProvider implements CompilerInput {
2828
Future<api.Input> readBytesFromUri(Uri resourceUri, api.InputKind inputKind) {
2929
api.Input input;
3030
switch (inputKind) {
31-
case api.InputKind.utf8:
31+
case api.InputKind.UTF8:
3232
input = utf8SourceFiles[resourceUri];
3333
break;
3434
case api.InputKind.binary:
@@ -51,7 +51,7 @@ abstract class SourceFileProvider implements CompilerInput {
5151
List<int> source;
5252
try {
5353
source = readAll(resourceUri.toFilePath(),
54-
zeroTerminated: inputKind == api.InputKind.utf8);
54+
zeroTerminated: inputKind == api.InputKind.UTF8);
5555
} on FileSystemException catch (ex) {
5656
String message = ex.osError?.message;
5757
String detail = message != null ? ' ($message)' : '';
@@ -60,7 +60,7 @@ abstract class SourceFileProvider implements CompilerInput {
6060
dartCharactersRead += source.length;
6161
api.Input input;
6262
switch (inputKind) {
63-
case api.InputKind.utf8:
63+
case api.InputKind.UTF8:
6464
input = utf8SourceFiles[resourceUri] = new CachingUtf8BytesSourceFile(
6565
resourceUri, relativizeUri(resourceUri), source);
6666
break;
@@ -76,7 +76,7 @@ abstract class SourceFileProvider implements CompilerInput {
7676
/// returned.
7777
api.Input autoReadFromFile(Uri resourceUri) {
7878
try {
79-
return _readFromFileSync(resourceUri, InputKind.utf8);
79+
return _readFromFileSync(resourceUri, InputKind.UTF8);
8080
} catch (e) {
8181
// Silence the error. The [resourceUri] was not requested by the user and
8282
// was only needed to give better error messages.
@@ -120,7 +120,7 @@ abstract class SourceFileProvider implements CompilerInput {
120120
dartCharactersRead += totalLength;
121121
api.Input input;
122122
switch (inputKind) {
123-
case api.InputKind.utf8:
123+
case api.InputKind.UTF8:
124124
input = utf8SourceFiles[resourceUri] = new CachingUtf8BytesSourceFile(
125125
resourceUri, resourceUri.toString(), result);
126126
break;
@@ -175,7 +175,7 @@ class CompilerSourceFileProvider extends SourceFileProvider {
175175

176176
@override
177177
Future<api.Input<List<int>>> readFromUri(Uri uri,
178-
{InputKind inputKind: InputKind.utf8}) =>
178+
{InputKind inputKind: InputKind.UTF8}) =>
179179
readBytesFromUri(uri, inputKind);
180180
}
181181

@@ -466,7 +466,7 @@ class BazelInputProvider extends SourceFileProvider {
466466

467467
@override
468468
Future<api.Input> readFromUri(Uri uri,
469-
{InputKind inputKind: InputKind.utf8}) async {
469+
{InputKind inputKind: InputKind.UTF8}) async {
470470
var resolvedUri = uri;
471471
var path = uri.path;
472472
if (path.startsWith('/bazel-root')) {
@@ -481,7 +481,7 @@ class BazelInputProvider extends SourceFileProvider {
481481
}
482482
api.Input result = await readBytesFromUri(resolvedUri, inputKind);
483483
switch (inputKind) {
484-
case InputKind.utf8:
484+
case InputKind.UTF8:
485485
utf8SourceFiles[uri] = utf8SourceFiles[resolvedUri];
486486
break;
487487
case InputKind.binary:

pkg/compiler/tool/track_memory.dart

+2-2
Original file line numberDiff line numberDiff line change
@@ -66,7 +66,7 @@ _resumeMainIsolateIfPaused() async {
6666
Future _sendMessage(String method, [Map args = const {}]) {
6767
var id = _requestId++;
6868
_pendingResponses[id] = new Completer();
69-
socket.add(JSON.encode({
69+
socket.add(jsonEncode({
7070
'jsonrpc': '2.0',
7171
'id': '$id',
7272
'method': '$method',
@@ -77,7 +77,7 @@ Future _sendMessage(String method, [Map args = const {}]) {
7777

7878
/// Handle all responses
7979
void _handleResponse(Object s) {
80-
var json = JSON.decode(s);
80+
var json = jsonDecode(s);
8181
if (json['method'] != 'streamNotify') {
8282
var id = json['id'];
8383
if (id is String) id = int.parse(id);

pkg/dart_messages/bin/publish.dart

+1-1
Original file line numberDiff line numberDiff line change
@@ -47,7 +47,7 @@ void emitJson() {
4747
///
4848
/// The parameter [str] may be `null` in which case the result is "null".
4949
String escapeString(String str) {
50-
return JSON.encode(str);
50+
return jsonEncode(str);
5151
}
5252

5353
/// Emits the messages in dart2js format.

pkg/dev_compiler/tool/input_sdk/patch/core_patch.dart

+1-1
Original file line numberDiff line numberDiff line change
@@ -2603,7 +2603,7 @@ class _BigIntImpl implements BigInt {
26032603
var resultBits = new Uint8List(8);
26042604

26052605
var length = _digitBits * (_used - 1) + _digits[_used - 1].bitLength;
2606-
if (length - 53 > maxDoubleExponent) return double.INFINITY;
2606+
if (length - 53 > maxDoubleExponent) return double.infinity;
26072607

26082608
// The most significant bit is for the sign.
26092609
if (_isNegative) resultBits[7] = 0x80;

0 commit comments

Comments
 (0)