Clean up usage of deprecated constants

Change-Id: I9005ba6e94529e15d8f7b21322591f4a9dabec47
Reviewed-on: https://dart-review.googlesource.com/45763
Commit-Queue: William Hesse <whesse@google.com>
Reviewed-by: Konstantin Shcheglov <scheglov@google.com>
This commit is contained in:
Brian Wilkerson 2018-03-09 01:02:49 +00:00 committed by commit-bot@chromium.org
parent 5c94ec7b43
commit 602a8c2a7b
66 changed files with 434 additions and 435 deletions

View file

@ -128,7 +128,7 @@ class RunCommand extends Command {
time.stop();
print('Finished in ${time.elapsed.inSeconds} seconds.\n');
Map m = {'benchmark': benchmarkId, 'result': result.toJson()};
print(JSON.encode(m));
print(json.encode(m));
} catch (error, st) {
print('$benchmarkId threw exception: $error');
print(st);

View file

@ -195,7 +195,7 @@ abstract class CommonInputConverter extends Converter<String, Operation> {
var result = exception;
if (exception is UnimplementedError) {
if (exception.message.startsWith(ERROR_PREFIX)) {
result = JSON.decode(exception.message.substring(ERROR_PREFIX.length));
result = json.decode(exception.message.substring(ERROR_PREFIX.length));
}
}
processResponseResult(id, result);

View file

@ -94,7 +94,7 @@ class InstrumentationInputConverter extends CommonInputConverter {
Map<String, dynamic> decodeJson(String line, String text) {
try {
return asMap(JSON.decode(text));
return asMap(json.decode(text));
} catch (e, s) {
throw new AnalysisException(
'Failed to decode JSON: $text\n$line', new CaughtException(e, s));

View file

@ -30,16 +30,16 @@ class LogFileInputConverter extends CommonInputConverter {
String timeStampString = _parseTimeStamp(line);
String data = line.substring(timeStampString.length);
if (data.startsWith(RECEIVED_FRAGMENT)) {
Map<String, dynamic> json = asMap(JSON.decode(data.substring(4)));
if (json.containsKey('event')) {
return convertNotification(json);
Map<String, dynamic> jsonData = asMap(json.decode(data.substring(4)));
if (jsonData.containsKey('event')) {
return convertNotification(jsonData);
} else {
return convertResponse(json);
return convertResponse(jsonData);
}
} else if (data.startsWith(SENT_FRAGMENT)) {
Map<String, dynamic> json = asMap(JSON.decode(data.substring(4)));
if (json.containsKey('method')) {
return convertRequest(json);
Map<String, dynamic> jsonData = asMap(json.decode(data.substring(4)));
if (jsonData.containsKey('method')) {
return convertRequest(jsonData);
}
return null;
}

View file

@ -43,8 +43,8 @@ class AnalysisServerMemoryUsageTest
} else {
result = _run('curl', <String>[vmService]);
}
Map json = JSON.decode(result.stdout);
Map heaps = json['result']['heaps'];
Map jsonData = json.decode(result.stdout);
Map heaps = jsonData['result']['heaps'];
int newSpace = heaps['new']['used'];
int oldSpace = heaps['old']['used'];
return newSpace + oldSpace;
@ -105,7 +105,7 @@ class AnalysisServerMemoryUsageTest
*/
ProcessResult _run(String executable, List<String> arguments) {
return Process.runSync(executable, arguments,
stderrEncoding: UTF8, stdoutEncoding: UTF8);
stderrEncoding: utf8, stdoutEncoding: utf8);
}
/**

View file

@ -207,7 +207,7 @@ class Request {
*/
factory Request.fromString(String data) {
try {
var result = JSON.decode(data);
var result = json.decode(data);
if (result is Map) {
return new Request.fromJson(result as Map<String, dynamic>);
}

View file

@ -80,7 +80,7 @@ class AnalysisAnalyzedFilesParams implements HasToJson {
}
@override
String toString() => JSON.encode(toJson());
String toString() => json.encode(toJson());
@override
bool operator ==(other) {
@ -206,7 +206,7 @@ class AnalysisClosingLabelsParams implements HasToJson {
}
@override
String toString() => JSON.encode(toJson());
String toString() => json.encode(toJson());
@override
bool operator ==(other) {
@ -316,7 +316,7 @@ class AnalysisErrorFixes implements HasToJson {
}
@override
String toString() => JSON.encode(toJson());
String toString() => json.encode(toJson());
@override
bool operator ==(other) {
@ -430,7 +430,7 @@ class AnalysisErrorsParams implements HasToJson {
}
@override
String toString() => JSON.encode(toJson());
String toString() => json.encode(toJson());
@override
bool operator ==(other) {
@ -518,7 +518,7 @@ class AnalysisFlushResultsParams implements HasToJson {
}
@override
String toString() => JSON.encode(toJson());
String toString() => json.encode(toJson());
@override
bool operator ==(other) {
@ -629,7 +629,7 @@ class AnalysisFoldingParams implements HasToJson {
}
@override
String toString() => JSON.encode(toJson());
String toString() => json.encode(toJson());
@override
bool operator ==(other) {
@ -715,7 +715,7 @@ class AnalysisGetErrorsParams implements RequestParams {
}
@override
String toString() => JSON.encode(toJson());
String toString() => json.encode(toJson());
@override
bool operator ==(other) {
@ -805,7 +805,7 @@ class AnalysisGetErrorsResult implements ResponseResult {
}
@override
String toString() => JSON.encode(toJson());
String toString() => json.encode(toJson());
@override
bool operator ==(other) {
@ -913,7 +913,7 @@ class AnalysisGetHoverParams implements RequestParams {
}
@override
String toString() => JSON.encode(toJson());
String toString() => json.encode(toJson());
@override
bool operator ==(other) {
@ -1012,7 +1012,7 @@ class AnalysisGetHoverResult implements ResponseResult {
}
@override
String toString() => JSON.encode(toJson());
String toString() => json.encode(toJson());
@override
bool operator ==(other) {
@ -1145,7 +1145,7 @@ class AnalysisGetImportedElementsParams implements RequestParams {
}
@override
String toString() => JSON.encode(toJson());
String toString() => json.encode(toJson());
@override
bool operator ==(other) {
@ -1242,7 +1242,7 @@ class AnalysisGetImportedElementsResult implements ResponseResult {
}
@override
String toString() => JSON.encode(toJson());
String toString() => json.encode(toJson());
@override
bool operator ==(other) {
@ -1392,7 +1392,7 @@ class AnalysisGetLibraryDependenciesResult implements ResponseResult {
}
@override
String toString() => JSON.encode(toJson());
String toString() => json.encode(toJson());
@override
bool operator ==(other) {
@ -1539,7 +1539,7 @@ class AnalysisGetNavigationParams implements RequestParams {
}
@override
String toString() => JSON.encode(toJson());
String toString() => json.encode(toJson());
@override
bool operator ==(other) {
@ -1693,7 +1693,7 @@ class AnalysisGetNavigationResult implements ResponseResult {
}
@override
String toString() => JSON.encode(toJson());
String toString() => json.encode(toJson());
@override
bool operator ==(other) {
@ -1783,7 +1783,7 @@ class AnalysisGetReachableSourcesParams implements RequestParams {
}
@override
String toString() => JSON.encode(toJson());
String toString() => json.encode(toJson());
@override
bool operator ==(other) {
@ -1881,7 +1881,7 @@ class AnalysisGetReachableSourcesResult implements ResponseResult {
}
@override
String toString() => JSON.encode(toJson());
String toString() => json.encode(toJson());
@override
bool operator ==(other) {
@ -2004,7 +2004,7 @@ class AnalysisHighlightsParams implements HasToJson {
}
@override
String toString() => JSON.encode(toJson());
String toString() => json.encode(toJson());
@override
bool operator ==(other) {
@ -2149,7 +2149,7 @@ class AnalysisImplementedParams implements HasToJson {
}
@override
String toString() => JSON.encode(toJson());
String toString() => json.encode(toJson());
@override
bool operator ==(other) {
@ -2313,7 +2313,7 @@ class AnalysisInvalidateParams implements HasToJson {
}
@override
String toString() => JSON.encode(toJson());
String toString() => json.encode(toJson());
@override
bool operator ==(other) {
@ -2501,7 +2501,7 @@ class AnalysisNavigationParams implements HasToJson {
}
@override
String toString() => JSON.encode(toJson());
String toString() => json.encode(toJson());
@override
bool operator ==(other) {
@ -2621,7 +2621,7 @@ class AnalysisOccurrencesParams implements HasToJson {
}
@override
String toString() => JSON.encode(toJson());
String toString() => json.encode(toJson());
@override
bool operator ==(other) {
@ -2910,7 +2910,7 @@ class AnalysisOptions implements HasToJson {
}
@override
String toString() => JSON.encode(toJson());
String toString() => json.encode(toJson());
@override
bool operator ==(other) {
@ -3090,7 +3090,7 @@ class AnalysisOutlineParams implements HasToJson {
}
@override
String toString() => JSON.encode(toJson());
String toString() => json.encode(toJson());
@override
bool operator ==(other) {
@ -3207,7 +3207,7 @@ class AnalysisOverridesParams implements HasToJson {
}
@override
String toString() => JSON.encode(toJson());
String toString() => json.encode(toJson());
@override
bool operator ==(other) {
@ -3293,7 +3293,7 @@ class AnalysisReanalyzeParams implements RequestParams {
}
@override
String toString() => JSON.encode(toJson());
String toString() => json.encode(toJson());
@override
bool operator ==(other) {
@ -3604,7 +3604,7 @@ class AnalysisSetAnalysisRootsParams implements RequestParams {
}
@override
String toString() => JSON.encode(toJson());
String toString() => json.encode(toJson());
@override
bool operator ==(other) {
@ -3730,7 +3730,7 @@ class AnalysisSetGeneralSubscriptionsParams implements RequestParams {
}
@override
String toString() => JSON.encode(toJson());
String toString() => json.encode(toJson());
@override
bool operator ==(other) {
@ -3844,7 +3844,7 @@ class AnalysisSetPriorityFilesParams implements RequestParams {
}
@override
String toString() => JSON.encode(toJson());
String toString() => json.encode(toJson());
@override
bool operator ==(other) {
@ -3965,7 +3965,7 @@ class AnalysisSetSubscriptionsParams implements RequestParams {
}
@override
String toString() => JSON.encode(toJson());
String toString() => json.encode(toJson());
@override
bool operator ==(other) {
@ -4097,7 +4097,7 @@ class AnalysisStatus implements HasToJson {
}
@override
String toString() => JSON.encode(toJson());
String toString() => json.encode(toJson());
@override
bool operator ==(other) {
@ -4198,7 +4198,7 @@ class AnalysisUpdateContentParams implements RequestParams {
}
@override
String toString() => JSON.encode(toJson());
String toString() => json.encode(toJson());
@override
bool operator ==(other) {
@ -4259,7 +4259,7 @@ class AnalysisUpdateContentResult implements ResponseResult {
}
@override
String toString() => JSON.encode(toJson());
String toString() => json.encode(toJson());
@override
bool operator ==(other) {
@ -4343,7 +4343,7 @@ class AnalysisUpdateOptionsParams implements RequestParams {
}
@override
String toString() => JSON.encode(toJson());
String toString() => json.encode(toJson());
@override
bool operator ==(other) {
@ -4454,7 +4454,7 @@ class AnalyticsEnableParams implements RequestParams {
}
@override
String toString() => JSON.encode(toJson());
String toString() => json.encode(toJson());
@override
bool operator ==(other) {
@ -4596,7 +4596,7 @@ class AnalyticsIsEnabledResult implements ResponseResult {
}
@override
String toString() => JSON.encode(toJson());
String toString() => json.encode(toJson());
@override
bool operator ==(other) {
@ -4679,7 +4679,7 @@ class AnalyticsSendEventParams implements RequestParams {
}
@override
String toString() => JSON.encode(toJson());
String toString() => json.encode(toJson());
@override
bool operator ==(other) {
@ -4814,7 +4814,7 @@ class AnalyticsSendTimingParams implements RequestParams {
}
@override
String toString() => JSON.encode(toJson());
String toString() => json.encode(toJson());
@override
bool operator ==(other) {
@ -4964,7 +4964,7 @@ class ClosingLabel implements HasToJson {
}
@override
String toString() => JSON.encode(toJson());
String toString() => json.encode(toJson());
@override
bool operator ==(other) {
@ -5076,7 +5076,7 @@ class CompletionGetSuggestionsParams implements RequestParams {
}
@override
String toString() => JSON.encode(toJson());
String toString() => json.encode(toJson());
@override
bool operator ==(other) {
@ -5163,7 +5163,7 @@ class CompletionGetSuggestionsResult implements ResponseResult {
}
@override
String toString() => JSON.encode(toJson());
String toString() => json.encode(toJson());
@override
bool operator ==(other) {
@ -5370,7 +5370,7 @@ class CompletionResultsParams implements HasToJson {
}
@override
String toString() => JSON.encode(toJson());
String toString() => json.encode(toJson());
@override
bool operator ==(other) {
@ -5556,7 +5556,7 @@ class ContextData implements HasToJson {
}
@override
String toString() => JSON.encode(toJson());
String toString() => json.encode(toJson());
@override
bool operator ==(other) {
@ -5768,7 +5768,7 @@ class DiagnosticGetDiagnosticsResult implements ResponseResult {
}
@override
String toString() => JSON.encode(toJson());
String toString() => json.encode(toJson());
@override
bool operator ==(other) {
@ -5883,7 +5883,7 @@ class DiagnosticGetServerPortResult implements ResponseResult {
}
@override
String toString() => JSON.encode(toJson());
String toString() => json.encode(toJson());
@override
bool operator ==(other) {
@ -6042,7 +6042,7 @@ class EditFormatParams implements RequestParams {
}
@override
String toString() => JSON.encode(toJson());
String toString() => json.encode(toJson());
@override
bool operator ==(other) {
@ -6190,7 +6190,7 @@ class EditFormatResult implements ResponseResult {
}
@override
String toString() => JSON.encode(toJson());
String toString() => json.encode(toJson());
@override
bool operator ==(other) {
@ -6326,7 +6326,7 @@ class EditGetAssistsParams implements RequestParams {
}
@override
String toString() => JSON.encode(toJson());
String toString() => json.encode(toJson());
@override
bool operator ==(other) {
@ -6420,7 +6420,7 @@ class EditGetAssistsResult implements ResponseResult {
}
@override
String toString() => JSON.encode(toJson());
String toString() => json.encode(toJson());
@override
bool operator ==(other) {
@ -6553,7 +6553,7 @@ class EditGetAvailableRefactoringsParams implements RequestParams {
}
@override
String toString() => JSON.encode(toJson());
String toString() => json.encode(toJson());
@override
bool operator ==(other) {
@ -6648,7 +6648,7 @@ class EditGetAvailableRefactoringsResult implements ResponseResult {
}
@override
String toString() => JSON.encode(toJson());
String toString() => json.encode(toJson());
@override
bool operator ==(other) {
@ -6756,7 +6756,7 @@ class EditGetFixesParams implements RequestParams {
}
@override
String toString() => JSON.encode(toJson());
String toString() => json.encode(toJson());
@override
bool operator ==(other) {
@ -6847,7 +6847,7 @@ class EditGetFixesResult implements ResponseResult {
}
@override
String toString() => JSON.encode(toJson());
String toString() => json.encode(toJson());
@override
bool operator ==(other) {
@ -6982,7 +6982,7 @@ class EditGetPostfixCompletionParams implements RequestParams {
}
@override
String toString() => JSON.encode(toJson());
String toString() => json.encode(toJson());
@override
bool operator ==(other) {
@ -7071,7 +7071,7 @@ class EditGetPostfixCompletionResult implements ResponseResult {
}
@override
String toString() => JSON.encode(toJson());
String toString() => json.encode(toJson());
@override
bool operator ==(other) {
@ -7292,7 +7292,7 @@ class EditGetRefactoringParams implements RequestParams {
}
@override
String toString() => JSON.encode(toJson());
String toString() => json.encode(toJson());
@override
bool operator ==(other) {
@ -7567,7 +7567,7 @@ class EditGetRefactoringResult implements ResponseResult {
}
@override
String toString() => JSON.encode(toJson());
String toString() => json.encode(toJson());
@override
bool operator ==(other) {
@ -7689,7 +7689,7 @@ class EditGetStatementCompletionParams implements RequestParams {
}
@override
String toString() => JSON.encode(toJson());
String toString() => json.encode(toJson());
@override
bool operator ==(other) {
@ -7804,7 +7804,7 @@ class EditGetStatementCompletionResult implements ResponseResult {
}
@override
String toString() => JSON.encode(toJson());
String toString() => json.encode(toJson());
@override
bool operator ==(other) {
@ -7917,7 +7917,7 @@ class EditImportElementsParams implements RequestParams {
}
@override
String toString() => JSON.encode(toJson());
String toString() => json.encode(toJson());
@override
bool operator ==(other) {
@ -8014,7 +8014,7 @@ class EditImportElementsResult implements ResponseResult {
}
@override
String toString() => JSON.encode(toJson());
String toString() => json.encode(toJson());
@override
bool operator ==(other) {
@ -8148,7 +8148,7 @@ class EditIsPostfixCompletionApplicableParams implements RequestParams {
}
@override
String toString() => JSON.encode(toJson());
String toString() => json.encode(toJson());
@override
bool operator ==(other) {
@ -8237,7 +8237,7 @@ class EditIsPostfixCompletionApplicableResult implements ResponseResult {
}
@override
String toString() => JSON.encode(toJson());
String toString() => json.encode(toJson());
@override
bool operator ==(other) {
@ -8360,7 +8360,7 @@ class EditListPostfixCompletionTemplatesResult implements ResponseResult {
}
@override
String toString() => JSON.encode(toJson());
String toString() => json.encode(toJson());
@override
bool operator ==(other) {
@ -8445,7 +8445,7 @@ class EditOrganizeDirectivesParams implements RequestParams {
}
@override
String toString() => JSON.encode(toJson());
String toString() => json.encode(toJson());
@override
bool operator ==(other) {
@ -8534,7 +8534,7 @@ class EditOrganizeDirectivesResult implements ResponseResult {
}
@override
String toString() => JSON.encode(toJson());
String toString() => json.encode(toJson());
@override
bool operator ==(other) {
@ -8617,7 +8617,7 @@ class EditSortMembersParams implements RequestParams {
}
@override
String toString() => JSON.encode(toJson());
String toString() => json.encode(toJson());
@override
bool operator ==(other) {
@ -8705,7 +8705,7 @@ class EditSortMembersResult implements ResponseResult {
}
@override
String toString() => JSON.encode(toJson());
String toString() => json.encode(toJson());
@override
bool operator ==(other) {
@ -9014,7 +9014,7 @@ class ElementDeclaration implements HasToJson {
}
@override
String toString() => JSON.encode(toJson());
String toString() => json.encode(toJson());
@override
bool operator ==(other) {
@ -9130,7 +9130,7 @@ class ExecutableFile implements HasToJson {
}
@override
String toString() => JSON.encode(toJson());
String toString() => json.encode(toJson());
@override
bool operator ==(other) {
@ -9287,7 +9287,7 @@ class ExecutionCreateContextParams implements RequestParams {
}
@override
String toString() => JSON.encode(toJson());
String toString() => json.encode(toJson());
@override
bool operator ==(other) {
@ -9373,7 +9373,7 @@ class ExecutionCreateContextResult implements ResponseResult {
}
@override
String toString() => JSON.encode(toJson());
String toString() => json.encode(toJson());
@override
bool operator ==(other) {
@ -9457,7 +9457,7 @@ class ExecutionDeleteContextParams implements RequestParams {
}
@override
String toString() => JSON.encode(toJson());
String toString() => json.encode(toJson());
@override
bool operator ==(other) {
@ -9624,7 +9624,7 @@ class ExecutionLaunchDataParams implements HasToJson {
}
@override
String toString() => JSON.encode(toJson());
String toString() => json.encode(toJson());
@override
bool operator ==(other) {
@ -9758,7 +9758,7 @@ class ExecutionMapUriParams implements RequestParams {
}
@override
String toString() => JSON.encode(toJson());
String toString() => json.encode(toJson());
@override
bool operator ==(other) {
@ -9871,7 +9871,7 @@ class ExecutionMapUriResult implements ResponseResult {
}
@override
String toString() => JSON.encode(toJson());
String toString() => json.encode(toJson());
@override
bool operator ==(other) {
@ -10012,7 +10012,7 @@ class ExecutionSetSubscriptionsParams implements RequestParams {
}
@override
String toString() => JSON.encode(toJson());
String toString() => json.encode(toJson());
@override
bool operator ==(other) {
@ -10235,7 +10235,7 @@ class ExtractLocalVariableFeedback extends RefactoringFeedback {
}
@override
String toString() => JSON.encode(toJson());
String toString() => json.encode(toJson());
@override
bool operator ==(other) {
@ -10356,7 +10356,7 @@ class ExtractLocalVariableOptions extends RefactoringOptions {
}
@override
String toString() => JSON.encode(toJson());
String toString() => json.encode(toJson());
@override
bool operator ==(other) {
@ -10633,7 +10633,7 @@ class ExtractMethodFeedback extends RefactoringFeedback {
}
@override
String toString() => JSON.encode(toJson());
String toString() => json.encode(toJson());
@override
bool operator ==(other) {
@ -10862,7 +10862,7 @@ class ExtractMethodOptions extends RefactoringOptions {
}
@override
String toString() => JSON.encode(toJson());
String toString() => json.encode(toJson());
@override
bool operator ==(other) {
@ -11382,7 +11382,7 @@ class FlutterOutline implements HasToJson {
}
@override
String toString() => JSON.encode(toJson());
String toString() => json.encode(toJson());
@override
bool operator ==(other) {
@ -11596,7 +11596,7 @@ class FlutterOutlineAttribute implements HasToJson {
}
@override
String toString() => JSON.encode(toJson());
String toString() => json.encode(toJson());
@override
bool operator ==(other) {
@ -11849,7 +11849,7 @@ class FlutterOutlineParams implements HasToJson {
}
@override
String toString() => JSON.encode(toJson());
String toString() => json.encode(toJson());
@override
bool operator ==(other) {
@ -11994,7 +11994,7 @@ class FlutterSetSubscriptionsParams implements RequestParams {
}
@override
String toString() => JSON.encode(toJson());
String toString() => json.encode(toJson());
@override
bool operator ==(other) {
@ -12472,7 +12472,7 @@ class HoverInformation implements HasToJson {
}
@override
String toString() => JSON.encode(toJson());
String toString() => json.encode(toJson());
@override
bool operator ==(other) {
@ -12591,7 +12591,7 @@ class ImplementedClass implements HasToJson {
}
@override
String toString() => JSON.encode(toJson());
String toString() => json.encode(toJson());
@override
bool operator ==(other) {
@ -12689,7 +12689,7 @@ class ImplementedMember implements HasToJson {
}
@override
String toString() => JSON.encode(toJson());
String toString() => json.encode(toJson());
@override
bool operator ==(other) {
@ -12814,7 +12814,7 @@ class ImportedElements implements HasToJson {
}
@override
String toString() => JSON.encode(toJson());
String toString() => json.encode(toJson());
@override
bool operator ==(other) {
@ -12917,7 +12917,7 @@ class InlineLocalVariableFeedback extends RefactoringFeedback {
}
@override
String toString() => JSON.encode(toJson());
String toString() => json.encode(toJson());
@override
bool operator ==(other) {
@ -13068,7 +13068,7 @@ class InlineMethodFeedback extends RefactoringFeedback {
}
@override
String toString() => JSON.encode(toJson());
String toString() => json.encode(toJson());
@override
bool operator ==(other) {
@ -13181,7 +13181,7 @@ class InlineMethodOptions extends RefactoringOptions {
}
@override
String toString() => JSON.encode(toJson());
String toString() => json.encode(toJson());
@override
bool operator ==(other) {
@ -13268,7 +13268,7 @@ class KytheGetKytheEntriesParams implements RequestParams {
}
@override
String toString() => JSON.encode(toJson());
String toString() => json.encode(toJson());
@override
bool operator ==(other) {
@ -13390,7 +13390,7 @@ class KytheGetKytheEntriesResult implements ResponseResult {
}
@override
String toString() => JSON.encode(toJson());
String toString() => json.encode(toJson());
@override
bool operator ==(other) {
@ -13493,7 +13493,7 @@ class MoveFileOptions extends RefactoringOptions {
}
@override
String toString() => JSON.encode(toJson());
String toString() => json.encode(toJson());
@override
bool operator ==(other) {
@ -13592,7 +13592,7 @@ class OverriddenMember implements HasToJson {
}
@override
String toString() => JSON.encode(toJson());
String toString() => json.encode(toJson());
@override
bool operator ==(other) {
@ -13755,7 +13755,7 @@ class Override implements HasToJson {
}
@override
String toString() => JSON.encode(toJson());
String toString() => json.encode(toJson());
@override
bool operator ==(other) {
@ -13886,7 +13886,7 @@ class PostfixTemplateDescriptor implements HasToJson {
}
@override
String toString() => JSON.encode(toJson());
String toString() => json.encode(toJson());
@override
bool operator ==(other) {
@ -13964,7 +13964,7 @@ class PubStatus implements HasToJson {
}
@override
String toString() => JSON.encode(toJson());
String toString() => json.encode(toJson());
@override
bool operator ==(other) {
@ -14006,7 +14006,7 @@ class RefactoringFeedback implements HasToJson {
}
@override
String toString() => JSON.encode(toJson());
String toString() => json.encode(toJson());
@override
bool operator ==(other) {
@ -14046,7 +14046,7 @@ class RefactoringOptions implements HasToJson {
}
@override
String toString() => JSON.encode(toJson());
String toString() => json.encode(toJson());
@override
bool operator ==(other) {
@ -14195,7 +14195,7 @@ class RenameFeedback extends RefactoringFeedback {
}
@override
String toString() => JSON.encode(toJson());
String toString() => json.encode(toJson());
@override
bool operator ==(other) {
@ -14281,7 +14281,7 @@ class RenameOptions extends RefactoringOptions {
}
@override
String toString() => JSON.encode(toJson());
String toString() => json.encode(toJson());
@override
bool operator ==(other) {
@ -14406,7 +14406,7 @@ class RequestError implements HasToJson {
}
@override
String toString() => JSON.encode(toJson());
String toString() => json.encode(toJson());
@override
bool operator ==(other) {
@ -14896,7 +14896,7 @@ class SearchFindElementReferencesParams implements RequestParams {
}
@override
String toString() => JSON.encode(toJson());
String toString() => json.encode(toJson());
@override
bool operator ==(other) {
@ -15021,7 +15021,7 @@ class SearchFindElementReferencesResult implements ResponseResult {
}
@override
String toString() => JSON.encode(toJson());
String toString() => json.encode(toJson());
@override
bool operator ==(other) {
@ -15106,7 +15106,7 @@ class SearchFindMemberDeclarationsParams implements RequestParams {
}
@override
String toString() => JSON.encode(toJson());
String toString() => json.encode(toJson());
@override
bool operator ==(other) {
@ -15192,7 +15192,7 @@ class SearchFindMemberDeclarationsResult implements ResponseResult {
}
@override
String toString() => JSON.encode(toJson());
String toString() => json.encode(toJson());
@override
bool operator ==(other) {
@ -15276,7 +15276,7 @@ class SearchFindMemberReferencesParams implements RequestParams {
}
@override
String toString() => JSON.encode(toJson());
String toString() => json.encode(toJson());
@override
bool operator ==(other) {
@ -15362,7 +15362,7 @@ class SearchFindMemberReferencesResult implements ResponseResult {
}
@override
String toString() => JSON.encode(toJson());
String toString() => json.encode(toJson());
@override
bool operator ==(other) {
@ -15449,7 +15449,7 @@ class SearchFindTopLevelDeclarationsParams implements RequestParams {
}
@override
String toString() => JSON.encode(toJson());
String toString() => json.encode(toJson());
@override
bool operator ==(other) {
@ -15535,7 +15535,7 @@ class SearchFindTopLevelDeclarationsResult implements ResponseResult {
}
@override
String toString() => JSON.encode(toJson());
String toString() => json.encode(toJson());
@override
bool operator ==(other) {
@ -15674,7 +15674,7 @@ class SearchGetElementDeclarationsParams implements RequestParams {
}
@override
String toString() => JSON.encode(toJson());
String toString() => json.encode(toJson());
@override
bool operator ==(other) {
@ -15795,7 +15795,7 @@ class SearchGetElementDeclarationsResult implements ResponseResult {
}
@override
String toString() => JSON.encode(toJson());
String toString() => json.encode(toJson());
@override
bool operator ==(other) {
@ -15935,7 +15935,7 @@ class SearchGetTypeHierarchyParams implements RequestParams {
}
@override
String toString() => JSON.encode(toJson());
String toString() => json.encode(toJson());
@override
bool operator ==(other) {
@ -16046,7 +16046,7 @@ class SearchGetTypeHierarchyResult implements ResponseResult {
}
@override
String toString() => JSON.encode(toJson());
String toString() => json.encode(toJson());
@override
bool operator ==(other) {
@ -16210,7 +16210,7 @@ class SearchResult implements HasToJson {
}
@override
String toString() => JSON.encode(toJson());
String toString() => json.encode(toJson());
@override
bool operator ==(other) {
@ -16465,7 +16465,7 @@ class SearchResultsParams implements HasToJson {
}
@override
String toString() => JSON.encode(toJson());
String toString() => json.encode(toJson());
@override
bool operator ==(other) {
@ -16601,7 +16601,7 @@ class ServerConnectedParams implements HasToJson {
}
@override
String toString() => JSON.encode(toJson());
String toString() => json.encode(toJson());
@override
bool operator ==(other) {
@ -16742,7 +16742,7 @@ class ServerErrorParams implements HasToJson {
}
@override
String toString() => JSON.encode(toJson());
String toString() => json.encode(toJson());
@override
bool operator ==(other) {
@ -16860,7 +16860,7 @@ class ServerGetVersionResult implements ResponseResult {
}
@override
String toString() => JSON.encode(toJson());
String toString() => json.encode(toJson());
@override
bool operator ==(other) {
@ -16997,7 +16997,7 @@ class ServerSetSubscriptionsParams implements RequestParams {
}
@override
String toString() => JSON.encode(toJson());
String toString() => json.encode(toJson());
@override
bool operator ==(other) {
@ -17192,7 +17192,7 @@ class ServerStatusParams implements HasToJson {
}
@override
String toString() => JSON.encode(toJson());
String toString() => json.encode(toJson());
@override
bool operator ==(other) {
@ -17460,7 +17460,7 @@ class TypeHierarchyItem implements HasToJson {
}
@override
String toString() => JSON.encode(toJson());
String toString() => json.encode(toJson());
@override
bool operator ==(other) {

View file

@ -51,7 +51,7 @@ class ByteStreamClientChannel implements ClientCommunicationChannel {
@override
Future<Response> sendRequest(Request request) async {
String id = request.id;
output.write(JSON.encode(request.toJson()) + '\n');
output.write(json.encode(request.toJson()) + '\n');
return await responseStream
.firstWhere((Response response) => response.id == id);
}
@ -120,7 +120,7 @@ class ByteStreamServerChannel implements ServerCommunicationChannel {
return;
}
ServerPerformanceStatistics.serverChannel.makeCurrentWhile(() {
String jsonEncoding = JSON.encode(notification.toJson());
String jsonEncoding = json.encode(notification.toJson());
_outputLine(jsonEncoding);
_instrumentationService.logNotification(jsonEncoding);
});
@ -134,7 +134,7 @@ class ByteStreamServerChannel implements ServerCommunicationChannel {
return;
}
ServerPerformanceStatistics.serverChannel.makeCurrentWhile(() {
String jsonEncoding = JSON.encode(response.toJson());
String jsonEncoding = json.encode(response.toJson());
_outputLine(jsonEncoding);
_instrumentationService.logResponse(jsonEncoding);
});

View file

@ -85,7 +85,7 @@ abstract class ClientCommunicationChannel {
*/
class JsonStreamDecoder extends Converter<String, Map> {
@override
Map convert(String text) => JSON.decode(text);
Map convert(String text) => json.decode(text);
@override
ChunkedConversionSink<String> startChunkedConversion(Sink<Map> sink) =>

View file

@ -1590,7 +1590,7 @@ class ContextManagerImpl implements ContextManager {
try {
String contents = specFile.readAsStringSync();
Map<String, Uri> map =
pkgfile.parse(UTF8.encode(contents), new Uri.file(specFile.path));
pkgfile.parse(utf8.encode(contents), new Uri.file(specFile.path));
return new MapPackages(map);
} catch (_) {
//TODO(pquitslund): consider creating an error for the spec file.

View file

@ -688,8 +688,8 @@ class PluginManager {
pubPath = '$pubPath.bat';
}
ProcessResult result = Process.runSync(pubPath, <String>['get'],
stderrEncoding: UTF8,
stdoutEncoding: UTF8,
stderrEncoding: utf8,
stdoutEncoding: utf8,
workingDirectory: pluginFolder.path);
if (result.exitCode != 0) {
StringBuffer buffer = new StringBuffer();

View file

@ -272,7 +272,7 @@ class RequestDecoder extends JsonDecoder {
buffer.write(expected);
if (actual != null) {
buffer.write('; found "');
buffer.write(JSON.encode(actual));
buffer.write(json.encode(actual));
buffer.write('"');
}
return new RequestFailure(
@ -282,7 +282,7 @@ class RequestDecoder extends JsonDecoder {
@override
dynamic missingKey(String jsonPath, String key) {
return new RequestFailure(new Response.invalidParameter(
_request, jsonPath, 'Expected to contain key ${JSON.encode(key)}'));
_request, jsonPath, 'Expected to contain key ${json.encode(key)}'));
}
}
@ -310,7 +310,7 @@ class ResponseDecoder extends JsonDecoder {
buffer.write(expected);
if (actual != null) {
buffer.write(' found "');
buffer.write(JSON.encode(actual));
buffer.write(json.encode(actual));
buffer.write('"');
}
buffer.write(' at ');

View file

@ -992,28 +992,6 @@ class KytheDartVisitor extends GeneralizingAstVisitor with OutputUtils {
// no children to visit
}
void _handleVariableDeclaration(
Element element, SyntacticEntity syntacticEntity,
{String subKind, DartType type}) {
// variable
var variableVName = addNodeAndFacts(schema.VARIABLE_KIND,
element: element, subKind: subKind, completeFact: schema.DEFINITION);
// anchor
addAnchorEdgesContainingEdge(
syntacticEntity: syntacticEntity,
edges: [
schema.DEFINES_BINDING_EDGE,
],
target: variableVName,
enclosingTarget: _enclosingVName);
// type
if (type != null) {
addEdge(variableVName, schema.TYPED_EDGE, _vNameFromType(type));
}
}
/// Add a "ref/imports" edge from the passed [uriNode] location to the
/// [referencedElement] [Element]. If the passed element is null, the edge is
/// not written out.
@ -1044,6 +1022,28 @@ class KytheDartVisitor extends GeneralizingAstVisitor with OutputUtils {
}
}
void _handleVariableDeclaration(
Element element, SyntacticEntity syntacticEntity,
{String subKind, DartType type}) {
// variable
var variableVName = addNodeAndFacts(schema.VARIABLE_KIND,
element: element, subKind: subKind, completeFact: schema.DEFINITION);
// anchor
addAnchorEdgesContainingEdge(
syntacticEntity: syntacticEntity,
edges: [
schema.DEFINES_BINDING_EDGE,
],
target: variableVName,
enclosingTarget: _enclosingVName);
// type
if (type != null) {
addEdge(variableVName, schema.TYPED_EDGE, _vNameFromType(type));
}
}
_handleVariableDeclarationListAnnotations(
VariableDeclarationList variableDeclarationList, KytheVName refVName) {
assert(refVName != null);
@ -1308,11 +1308,11 @@ abstract class OutputUtils {
}
List<int> _encode(String str) {
return UTF8.encode(str);
return utf8.encode(str);
}
List<int> _encodeInt(int i) {
return UTF8.encode(i.toString());
return utf8.encode(i.toString());
}
/// Given all parameters for a [KytheVName] this method creates and returns a

View file

@ -905,7 +905,7 @@ class InstrumentationPage extends DiagnosticPageWithNav {
InstrumentationServer instrumentation =
AnalysisEngine.instance.instrumentationService.instrumentationServer;
String description = instrumentation.describe;
HtmlEscape htmlEscape = new HtmlEscape(HtmlEscapeMode.ELEMENT);
HtmlEscape htmlEscape = new HtmlEscape(HtmlEscapeMode.element);
description = htmlEscape.convert(description);
// Convert http(s): references to hyperlinks.
final RegExp urlRegExp = new RegExp(r'[http|https]+:\/*(\S+)');

View file

@ -173,7 +173,7 @@ class ElementWriter extends GeneralizingElementVisitor with TreeWriter {
if (element.isSynthetic) {
buffer.write('<i>');
}
buffer.write(HTML_ESCAPE.convert(element.toString()));
buffer.write(htmlEscape.convert(element.toString()));
if (element.isSynthetic) {
buffer.write('</i>');
}

View file

@ -10,7 +10,7 @@ import 'package:intl/intl.dart';
final NumberFormat numberFormat = new NumberFormat.decimalPattern();
String escape(String text) => text == null ? '' : HTML_ESCAPE.convert(text);
String escape(String text) => text == null ? '' : htmlEscape.convert(text);
String printInteger(int value) => numberFormat.format(value);

View file

@ -113,10 +113,10 @@ abstract class TreeWriter {
String valueString = _toString(value);
if (valueString == null) {
buffer.write('<span style="color: #FF0000">');
buffer.write(HTML_ESCAPE.convert(value.runtimeType.toString()));
buffer.write(htmlEscape.convert(value.runtimeType.toString()));
buffer.write('</span>');
} else {
buffer.write(HTML_ESCAPE.convert(valueString));
buffer.write(htmlEscape.convert(valueString));
}
}
}

View file

@ -4,7 +4,6 @@
/// This tests the benchmarks in benchmark/benchmark.test, and ensures that our
/// benchmarks can run.
import 'dart:convert';
import 'dart:io';
@ -13,6 +12,12 @@ import 'package:test/test.dart';
void main() => defineTests();
String get _serverSourcePath {
String script = Platform.script.toFilePath(windows: Platform.isWindows);
String pkgPath = path.normalize(path.join(path.dirname(script), '..', '..'));
return path.join(pkgPath, 'analysis_server');
}
void defineTests() {
group('benchmarks', () {
final List<String> benchmarks = _listBenchmarks();
@ -66,13 +71,7 @@ List<String> _listBenchmarks() {
[path.join('benchmark', 'benchmarks.dart'), 'list', '--machine'],
workingDirectory: _serverSourcePath,
);
Map m = JSON.decode(result.stdout);
Map m = json.decode(result.stdout);
List benchmarks = m['benchmarks'];
return benchmarks.map((b) => b['id']).toList();
}
String get _serverSourcePath {
String script = Platform.script.toFilePath(windows: Platform.isWindows);
String pkgPath = path.normalize(path.join(path.dirname(script), '..', '..'));
return path.join(pkgPath, 'analysis_server');
}

View file

@ -91,7 +91,7 @@ class ByteStreamClientChannelTest {
test_sendRequest() {
int assertCount = 0;
Request request = new Request('72', 'foo.bar');
outputLineStream.first.then((line) => JSON.decode(line)).then((json) {
outputLineStream.first.then((line) => json.decode(line)).then((json) {
expect(json[Request.ID], equals('72'));
expect(json[Request.METHOD], equals('foo.bar'));
inputSink.writeln('{"id":"73"}');

View file

@ -32,7 +32,7 @@ class GetServerPortTest extends AbstractAnalysisServerIntegrationTest {
HttpClientRequest request = await client
.getUrl(Uri.parse('http://localhost:${result.port}/status'));
HttpClientResponse response = await request.close();
String responseBody = await UTF8.decodeStream(response);
String responseBody = await utf8.decodeStream(response);
expect(responseBody, contains('<title>Analysis Server</title>'));
}
}

View file

@ -157,6 +157,12 @@ abstract class AbstractAnalysisServerIntegrationTest
return completer.future;
}
/**
* Whether to run integration tests with the --use-cfe flag.
*/
// TODO(devoncarew): Remove this when --use-cfe goes away.
bool get useCFE => false;
/**
* Print out any messages exchanged with the server. If some messages have
* already been exchanged with the server, they are printed out immediately.
@ -252,12 +258,6 @@ abstract class AbstractAnalysisServerIntegrationTest
return Future.wait(futures);
}
/**
* Whether to run integration tests with the --use-cfe flag.
*/
// TODO(devoncarew): Remove this when --use-cfe goes away.
bool get useCFE => false;
/**
* Start [server].
*/
@ -583,7 +583,7 @@ class Server {
_recordStdio('<== $trimmedLine');
var message;
try {
message = JSON.decoder.convert(trimmedLine);
message = json.decoder.convert(trimmedLine);
} catch (exception) {
_badDataFromServer('JSON decode failure: $exception');
return;
@ -651,9 +651,9 @@ class Server {
Completer<Map<String, dynamic>> completer =
new Completer<Map<String, dynamic>>();
_pendingCommands[id] = completer;
String line = JSON.encode(command);
String line = json.encode(command);
_recordStdio('==> $line');
_process.stdin.add(UTF8.encoder.convert("$line\n"));
_process.stdin.add(utf8.encoder.convert("$line\n"));
return completer.future;
}

View file

@ -122,8 +122,8 @@ class RequestErrorTest {
class RequestTest {
void test_fromJson() {
Request original = new Request('one', 'aMethod');
String json = JSON.encode(original.toJson());
Request request = new Request.fromString(json);
String jsonData = json.encode(original.toJson());
Request request = new Request.fromString(jsonData);
expect(request.id, equals('one'));
expect(request.method, equals('aMethod'));
expect(request.clientRequestTime, isNull);
@ -154,15 +154,15 @@ class RequestTest {
Map<String, Object> map = original.toJson();
// Insert bad value - should be int but client sent string instead
map[Request.CLIENT_REQUEST_TIME] = '347';
String json = JSON.encode(map);
Request request = new Request.fromString(json);
String jsonData = json.encode(map);
Request request = new Request.fromString(jsonData);
expect(request, isNull);
}
void test_fromJson_withClientTime() {
Request original = new Request('one', 'aMethod', null, 347);
String json = JSON.encode(original.toJson());
Request request = new Request.fromString(json);
String jsonData = json.encode(original.toJson());
Request request = new Request.fromString(jsonData);
expect(request.id, equals('one'));
expect(request.method, equals('aMethod'));
expect(request.clientRequestTime, 347);
@ -170,8 +170,8 @@ class RequestTest {
void test_fromJson_withParams() {
Request original = new Request('one', 'aMethod', {'foo': 'bar'});
String json = JSON.encode(original.toJson());
Request request = new Request.fromString(json);
String jsonData = json.encode(original.toJson());
Request request = new Request.fromString(jsonData);
expect(request.id, equals('one'));
expect(request.method, equals('aMethod'));
expect(request.toJson()['params'], equals({'foo': 'bar'}));

View file

@ -100,7 +100,7 @@ class AbstractSearchDomainTest extends AbstractAnalysisTest {
results = resultSet.results;
return new Future.value();
}
return new Future.delayed(Duration.ZERO, waitForSearchResults);
return new Future.delayed(Duration.zero, waitForSearchResults);
}
}

View file

@ -557,7 +557,7 @@ abstract class DartCompletionContributorTest extends AbstractContextTest {
// would therefore not wait for microtask callbacks that are scheduled after
// invoking this method.
return new Future.delayed(
Duration.ZERO, () => performAnalysis(times - 1, completer));
Duration.zero, () => performAnalysis(times - 1, completer));
}
void resolveSource(String path, String content) {

View file

@ -1281,13 +1281,13 @@ main() {
"positions": positions.toList(),
"suggestions": suggestions.toList()
};
_assertSingleLinkedEditGroupJson(JSON.encode(expected));
_assertSingleLinkedEditGroupJson(json.encode(expected));
}
void _assertSingleLinkedEditGroupJson(String expectedJsonString) {
List<LinkedEditGroup> editGroups = refactoringChange.linkedEditGroups;
expect(editGroups, hasLength(1));
expect(editGroups.first.toJson(), JSON.decode(expectedJsonString));
expect(editGroups.first.toJson(), json.decode(expectedJsonString));
}
/**

View file

@ -464,7 +464,7 @@ class GitRepository {
ProcessResult _run(List<String> arguments) {
logger?.log('git', 'git', arguments: arguments);
return Process.runSync('git', arguments,
stderrEncoding: UTF8, stdoutEncoding: UTF8, workingDirectory: path);
stderrEncoding: utf8, stdoutEncoding: utf8, workingDirectory: path);
}
}

View file

@ -887,7 +887,7 @@ class Server {
return;
}
logger?.log(fromServer, '$trimmedLine');
Map message = asMap(JSON.decoder.convert(trimmedLine));
Map message = asMap(json.decoder.convert(trimmedLine));
if (message.containsKey('id')) {
// The message is a response.
Response response = new Response.fromJson(message);
@ -935,8 +935,8 @@ class Server {
if (params != null) {
command['params'] = params;
}
String line = JSON.encode(command);
_process.stdin.add(UTF8.encoder.convert('$line\n'));
String line = json.encode(command);
_process.stdin.add(utf8.encoder.convert('$line\n'));
logger?.log(fromClient, '$line');
return requestData;
}

View file

@ -671,7 +671,7 @@ abstract class LogEntry {
} else if (entryKind == InstrumentationService.TAG_LOG_ENTRY) {
// Fall through
} else if (entryKind == InstrumentationService.TAG_NOTIFICATION) {
Map requestData = JSON.decode(components[2]);
Map requestData = json.decode(components[2]);
return new NotificationEntry(index, timeStamp, requestData);
} else if (entryKind == InstrumentationService.TAG_PERFORMANCE) {
// Fall through
@ -682,25 +682,25 @@ abstract class LogEntry {
return new PluginExceptionEntry(index, timeStamp, entryKind,
components.sublist(2, 5), components.sublist(5));
} else if (entryKind == InstrumentationService.TAG_PLUGIN_NOTIFICATION) {
Map requestData = JSON.decode(components[2]);
Map requestData = json.decode(components[2]);
return new PluginNotificationEntry(
index, timeStamp, requestData, components.sublist(3));
} else if (entryKind == InstrumentationService.TAG_PLUGIN_REQUEST) {
Map requestData = JSON.decode(components[2]);
Map requestData = json.decode(components[2]);
return new PluginRequestEntry(
index, timeStamp, requestData, components.sublist(3));
} else if (entryKind == InstrumentationService.TAG_PLUGIN_RESPONSE) {
Map responseData = JSON.decode(components[2]);
Map responseData = json.decode(components[2]);
return new PluginResponseEntry(
index, timeStamp, responseData, components.sublist(3));
} else if (entryKind == InstrumentationService.TAG_PLUGIN_TIMEOUT) {
return new PluginErrorEntry(index, timeStamp, entryKind,
components.sublist(2, 3), components.sublist(3));
} else if (entryKind == InstrumentationService.TAG_REQUEST) {
Map requestData = JSON.decode(components[2]);
Map requestData = json.decode(components[2]);
return new RequestEntry(index, timeStamp, requestData);
} else if (entryKind == InstrumentationService.TAG_RESPONSE) {
Map responseData = JSON.decode(components[2]);
Map responseData = json.decode(components[2]);
return new ResponseEntry(index, timeStamp, responseData);
} else if (entryKind == InstrumentationService.TAG_SUBPROCESS_START) {
// Fall through

View file

@ -504,7 +504,7 @@ class CodegenProtocolVisitor extends DartCodegenVisitor with CodeGenerator {
writeln();
}
writeln('@override');
writeln('String toString() => JSON.encode(toJson());');
writeln('String toString() => json.encode(toJson());');
writeln();
emitObjectEqualsMember(type, className);
writeln();
@ -1110,7 +1110,7 @@ class CodegenProtocolVisitor extends DartCodegenVisitor with CodeGenerator {
* Create a string literal that evaluates to [s].
*/
String literalString(String s) {
return JSON.encode(s);
return json.encode(s);
}
/**

View file

@ -183,7 +183,7 @@ class CodegenInttestMethodsVisitor extends DartCodegenVisitor
writeln('$streamName = _$streamName.stream.asBroadcastStream();');
}));
notificationSwitchContents.add(collectCode(() {
writeln('case ${JSON.encode(notification.longEvent)}:');
writeln('case ${json.encode(notification.longEvent)}:');
indent(() {
String paramsValidator = camelJoin(
['is', notification.domainName, notification.event, 'params']);
@ -256,7 +256,7 @@ class CodegenInttestMethodsVisitor extends DartCodegenVisitor
args.addAll(optionalArgs);
writeln('var params = new $requestClass(${args.join(', ')}).toJson();');
}
String methodJson = JSON.encode(request.longMethod);
String methodJson = json.encode(request.longMethod);
writeln('var result = await server.send($methodJson, $paramsVar);');
if (request.result != null) {
String kind = 'null';

View file

@ -82,9 +82,9 @@ class CodegenMatchersVisitor extends HierarchicalApiVisitor with CodeGenerator {
if (commaNeeded) {
writeln(',');
}
write('${JSON.encode(field.name)}: ');
write('${json.encode(field.name)}: ');
if (field.value != null) {
write('equals(${JSON.encode(field.value)})');
write('equals(${json.encode(field.value)})');
} else {
visitTypeDecl(field.type);
}
@ -116,14 +116,14 @@ class CodegenMatchersVisitor extends HierarchicalApiVisitor with CodeGenerator {
@override
visitTypeEnum(TypeEnum typeEnum) {
writeln('new MatchesEnum(${JSON.encode(context)}, [');
writeln('new MatchesEnum(${json.encode(context)}, [');
indent(() {
bool commaNeeded = false;
for (TypeEnumValue value in typeEnum.values) {
if (commaNeeded) {
writeln(',');
}
write('${JSON.encode(value.value)}');
write('${json.encode(value.value)}');
commaNeeded = true;
}
writeln();
@ -151,7 +151,7 @@ class CodegenMatchersVisitor extends HierarchicalApiVisitor with CodeGenerator {
void visitTypeObject(TypeObject typeObject) {
writeln('new LazyMatcher(() => new MatchesJsonObject(');
indent(() {
write('${JSON.encode(context)}, ');
write('${json.encode(context)}, ');
Iterable<TypeObjectField> requiredFields =
typeObject.fields.where((TypeObjectField field) => !field.optional);
outputObjectFields(requiredFields);

View file

@ -679,7 +679,7 @@ class ToHtmlVisitor extends HierarchicalApiVisitor
write(typeObjectField.name);
}
if (typeObjectField.value != null) {
write(' = ${JSON.encode(typeObjectField.value)}');
write(' = ${json.encode(typeObjectField.value)}');
} else {
write(': ');
TypeVisitor typeVisitor = new TypeVisitor(api, short: true);
@ -789,7 +789,7 @@ class TypeVisitor extends HierarchicalApiVisitor
}
write('": ');
if (field.value != null) {
write(JSON.encode(field.value));
write(json.encode(field.value));
} else {
if (field.optional) {
gray(() {

View file

@ -33,6 +33,12 @@ class AnalysisServerClient {
return _process.stdin.flush();
}
/// Force kill the server. Returns exit code future.
Future<int> kill() {
_process.kill();
return _process.exitCode;
}
void listenToOutput({NotificationProcessor notificationProcessor}) {
_process.stdout
.transform((new Utf8Codec()).decoder)
@ -42,7 +48,7 @@ class AnalysisServerClient {
if (trimmedLine.startsWith('Observatory listening on ')) {
return;
}
final result = JSON.decoder.convert(trimmedLine) as Map;
final result = json.decoder.convert(trimmedLine) as Map;
if (result.containsKey('id')) {
final id = result['id'] as String;
final completer = _pendingCommands.remove(id);
@ -78,16 +84,10 @@ class AnalysisServerClient {
}
Completer completer = new Completer();
_pendingCommands[id] = completer;
String commandAsJson = JSON.encode(command);
_process.stdin.add(UTF8.encoder.convert('$commandAsJson\n'));
String commandAsJson = json.encode(command);
_process.stdin.add(utf8.encoder.convert('$commandAsJson\n'));
return completer.future;
}
/// Force kill the server. Returns exit code future.
Future<int> kill() {
_process.kill();
return _process.exitCode;
}
}
class ServerErrorMessage {

View file

@ -62,15 +62,6 @@ void main() {
});
}
Stream<List<int>> _goodMessage() async* {
yield UTF8.encoder.convert('Observatory listening on foo bar\n');
final sampleJson = {
'id': '0',
'result': {'foo': 'bar'}
};
yield UTF8.encoder.convert(JSON.encode(sampleJson));
}
final _badErrorMessage = {
'code': 'someErrorCode',
'message': 'something went wrong',
@ -78,18 +69,27 @@ final _badErrorMessage = {
};
Stream<List<int>> _badMessage() async* {
yield UTF8.encoder.convert('Observatory listening on foo bar\n');
yield utf8.encoder.convert('Observatory listening on foo bar\n');
final sampleJson = {'id': '0', 'error': _badErrorMessage};
yield UTF8.encoder.convert(JSON.encode(sampleJson));
yield utf8.encoder.convert(json.encode(sampleJson));
}
Stream<List<int>> _eventMessage() async* {
yield UTF8.encoder.convert('Observatory listening on foo bar\n');
yield utf8.encoder.convert('Observatory listening on foo bar\n');
final sampleJson = {
'event': 'fooEvent',
'params': {'foo': 'bar', 'baz': 'bang'}
};
yield UTF8.encoder.convert(JSON.encode(sampleJson));
yield utf8.encoder.convert(json.encode(sampleJson));
}
Stream<List<int>> _goodMessage() async* {
yield utf8.encoder.convert('Observatory listening on foo bar\n');
final sampleJson = {
'id': '0',
'result': {'foo': 'bar'}
};
yield utf8.encoder.convert(json.encode(sampleJson));
}
class MockProcess extends Mock implements Process {}

View file

@ -134,7 +134,7 @@ class MemoryResourceProvider implements ResourceProvider {
void modifyFile(String path, String content) {
_checkFileAtPath(path);
_pathToBytes[path] = UTF8.encode(content);
_pathToBytes[path] = utf8.encode(content);
_pathToTimestamp[path] = nextStamp++;
_notifyWatchers(path, ChangeType.MODIFY);
}
@ -156,7 +156,7 @@ class MemoryResourceProvider implements ResourceProvider {
File newFile(String path, String content, [int stamp]) {
path = pathContext.normalize(path);
_MemoryFile file = _newFile(path);
_pathToBytes[path] = UTF8.encode(content);
_pathToBytes[path] = utf8.encode(content);
_pathToTimestamp[path] = stamp ?? nextStamp++;
_notifyWatchers(path, ChangeType.ADD);
return file;
@ -224,7 +224,7 @@ class MemoryResourceProvider implements ResourceProvider {
newFolder(pathContext.dirname(path));
_MemoryFile file = new _MemoryFile(this, path);
_pathToResource[path] = file;
_pathToBytes[path] = UTF8.encode(content);
_pathToBytes[path] = utf8.encode(content);
_pathToTimestamp[path] = stamp ?? nextStamp++;
_notifyWatchers(path, ChangeType.MODIFY);
return file;
@ -439,7 +439,7 @@ class _MemoryFile extends _MemoryResource implements File {
if (content == null) {
throw new FileSystemException(path, 'File "$path" does not exist.');
}
return UTF8.decode(content);
return utf8.decode(content);
}
@override
@ -457,7 +457,7 @@ class _MemoryFile extends _MemoryResource implements File {
@override
void writeAsStringSync(String content) {
_provider._setFileContent(this, UTF8.encode(content));
_provider._setFileContent(this, utf8.encode(content));
}
}

View file

@ -315,8 +315,8 @@ class InstrumentationService {
TAG_SUBPROCESS_RESULT,
subprocessId.toString(),
exitCode.toString(),
JSON.encode(stdout),
JSON.encode(stderr)
json.encode(stdout),
json.encode(stderr)
]));
}
}
@ -335,7 +335,7 @@ class InstrumentationService {
subprocessId.toString(),
executablePath,
workingDirectory,
JSON.encode(arguments)
json.encode(arguments)
]));
}
return subprocessId;

View file

@ -85,7 +85,7 @@ class PubPackageMapProvider implements PackageMapProvider {
}
try {
PackageMapInfo packageMap =
parsePackageMap(JSON.decode(result.stdout), folder);
parsePackageMap(json.decode(result.stdout), folder);
return packageMap;
} catch (exception, stackTrace) {
AnalysisEngine.instance.logger.logError(

View file

@ -146,7 +146,7 @@ class SdkExtUriResolver extends UriResolver {
void _processSdkExt(String sdkExtJSON, Folder libDir) {
var sdkExt;
try {
sdkExt = JSON.decode(sdkExtJSON);
sdkExt = json.decode(sdkExtJSON);
} catch (e) {
return;
}

View file

@ -1901,7 +1901,7 @@ class AnalysisDriverScheduler {
if (times == 0) {
return new Future.value();
}
return new Future.delayed(Duration.ZERO, () => _pumpEventQueue(times - 1));
return new Future.delayed(Duration.zero, () => _pumpEventQueue(times - 1));
}
}

View file

@ -428,7 +428,7 @@ class FileState {
}
// Compute the content hash.
List<int> contentBytes = UTF8.encode(_content);
List<int> contentBytes = utf8.encode(_content);
{
List<int> hashBytes = md5.convert(contentBytes).bytes;
_contentHash = hex.encode(hashBytes);

View file

@ -494,7 +494,7 @@ class _FileSystemEntityAdaptor implements front_end.FileSystemEntity {
@override
Future<List<int>> readAsBytes() async {
// TODO(scheglov) Optimize.
return UTF8.encode(file.content);
return utf8.encode(file.content);
}
@override

View file

@ -104,7 +104,7 @@ class AnalyzerMetadataRepository
int flag = source.readByte();
if (flag == 1) {
List<int> bytes = source.readByteList();
return UTF8.decode(bytes);
return utf8.decode(bytes);
} else {
return null;
}
@ -119,7 +119,7 @@ class AnalyzerMetadataRepository
void _writeOptionalString(kernel.BinarySink sink, String str) {
if (str != null) {
sink.writeByte(1);
List<int> bytes = UTF8.encode(str);
List<int> bytes = utf8.encode(str);
sink.writeByteList(bytes);
} else {
sink.writeByte(0);

View file

@ -797,7 +797,7 @@ class SdkExtensionFinder {
void _processSdkExt(String sdkExtJSON, Folder libDir) {
var sdkExt;
try {
sdkExt = JSON.decode(sdkExtJSON);
sdkExt = json.decode(sdkExtJSON);
} catch (e) {
return;
}

View file

@ -667,21 +667,21 @@ class TestTypeProvider extends TypeProviderBase {
];
ConstFieldElementImpl varINFINITY = ElementFactory.fieldElement(
"INFINITY", true, false, true, _doubleType,
initializer: AstTestFactory.doubleLiteral(double.INFINITY));
initializer: AstTestFactory.doubleLiteral(double.infinity));
varINFINITY.constantInitializer = AstTestFactory.binaryExpression(
AstTestFactory.integer(1), TokenType.SLASH, AstTestFactory.integer(0));
List<FieldElement> fields = <FieldElement>[
ElementFactory.fieldElement("NAN", true, false, true, _doubleType,
initializer: AstTestFactory.doubleLiteral(double.NAN)),
initializer: AstTestFactory.doubleLiteral(double.nan)),
varINFINITY,
ElementFactory.fieldElement(
"NEGATIVE_INFINITY", true, false, true, _doubleType,
initializer: AstTestFactory.doubleLiteral(double.NEGATIVE_INFINITY)),
initializer: AstTestFactory.doubleLiteral(double.negativeInfinity)),
ElementFactory.fieldElement(
"MIN_POSITIVE", true, false, true, _doubleType,
initializer: AstTestFactory.doubleLiteral(double.MIN_POSITIVE)),
initializer: AstTestFactory.doubleLiteral(double.minPositive)),
ElementFactory.fieldElement("MAX_FINITE", true, false, true, _doubleType,
initializer: AstTestFactory.doubleLiteral(double.MAX_FINITE))
initializer: AstTestFactory.doubleLiteral(double.maxFinite))
];
doubleElement.fields = fields;
int fieldCount = fields.length;

View file

@ -402,7 +402,7 @@ abstract class _AnalysisDriverExceptionContextMixin
};
@override
String toString() => convert.JSON.encode(toJson());
String toString() => convert.json.encode(toJson());
}
class AnalysisDriverExceptionFileBuilder extends Object
@ -519,7 +519,7 @@ abstract class _AnalysisDriverExceptionFileMixin
};
@override
String toString() => convert.JSON.encode(toJson());
String toString() => convert.json.encode(toJson());
}
class AnalysisDriverResolvedUnitBuilder extends Object
@ -666,7 +666,7 @@ abstract class _AnalysisDriverResolvedUnitMixin
};
@override
String toString() => convert.JSON.encode(toJson());
String toString() => convert.json.encode(toJson());
}
class AnalysisDriverSubtypeBuilder extends Object
@ -832,7 +832,7 @@ abstract class _AnalysisDriverSubtypeMixin
};
@override
String toString() => convert.JSON.encode(toJson());
String toString() => convert.json.encode(toJson());
}
class AnalysisDriverUnitErrorBuilder extends Object
@ -1034,7 +1034,7 @@ abstract class _AnalysisDriverUnitErrorMixin
};
@override
String toString() => convert.JSON.encode(toJson());
String toString() => convert.json.encode(toJson());
}
class AnalysisDriverUnitIndexBuilder extends Object
@ -1899,7 +1899,7 @@ abstract class _AnalysisDriverUnitIndexMixin
};
@override
String toString() => convert.JSON.encode(toJson());
String toString() => convert.json.encode(toJson());
}
class AnalysisDriverUnlinkedUnitBuilder extends Object
@ -2168,7 +2168,7 @@ abstract class _AnalysisDriverUnlinkedUnitMixin
};
@override
String toString() => convert.JSON.encode(toJson());
String toString() => convert.json.encode(toJson());
}
class CodeRangeBuilder extends Object
@ -2276,7 +2276,7 @@ abstract class _CodeRangeMixin implements idl.CodeRange {
};
@override
String toString() => convert.JSON.encode(toJson());
String toString() => convert.json.encode(toJson());
}
class EntityRefBuilder extends Object
@ -2740,7 +2740,7 @@ abstract class _EntityRefMixin implements idl.EntityRef {
};
@override
String toString() => convert.JSON.encode(toJson());
String toString() => convert.json.encode(toJson());
}
class LinkedDependencyBuilder extends Object
@ -2864,7 +2864,7 @@ abstract class _LinkedDependencyMixin implements idl.LinkedDependency {
};
@override
String toString() => convert.JSON.encode(toJson());
String toString() => convert.json.encode(toJson());
}
class LinkedExportNameBuilder extends Object
@ -3034,7 +3034,7 @@ abstract class _LinkedExportNameMixin implements idl.LinkedExportName {
};
@override
String toString() => convert.JSON.encode(toJson());
String toString() => convert.json.encode(toJson());
}
class LinkedLibraryBuilder extends Object
@ -3373,7 +3373,7 @@ abstract class _LinkedLibraryMixin implements idl.LinkedLibrary {
};
@override
String toString() => convert.JSON.encode(toJson());
String toString() => convert.json.encode(toJson());
}
class LinkedReferenceBuilder extends Object
@ -3630,7 +3630,7 @@ abstract class _LinkedReferenceMixin implements idl.LinkedReference {
};
@override
String toString() => convert.JSON.encode(toJson());
String toString() => convert.json.encode(toJson());
}
class LinkedUnitBuilder extends Object
@ -3909,7 +3909,7 @@ abstract class _LinkedUnitMixin implements idl.LinkedUnit {
};
@override
String toString() => convert.JSON.encode(toJson());
String toString() => convert.json.encode(toJson());
}
class PackageBundleBuilder extends Object
@ -4303,7 +4303,7 @@ abstract class _PackageBundleMixin implements idl.PackageBundle {
};
@override
String toString() => convert.JSON.encode(toJson());
String toString() => convert.json.encode(toJson());
}
class PackageDependencyInfoBuilder extends Object
@ -4528,7 +4528,7 @@ abstract class _PackageDependencyInfoMixin
};
@override
String toString() => convert.JSON.encode(toJson());
String toString() => convert.json.encode(toJson());
}
class PackageIndexBuilder extends Object
@ -4985,7 +4985,7 @@ abstract class _PackageIndexMixin implements idl.PackageIndex {
};
@override
String toString() => convert.JSON.encode(toJson());
String toString() => convert.json.encode(toJson());
}
class TopLevelInferenceErrorBuilder extends Object
@ -5138,7 +5138,7 @@ abstract class _TopLevelInferenceErrorMixin
};
@override
String toString() => convert.JSON.encode(toJson());
String toString() => convert.json.encode(toJson());
}
class UnitIndexBuilder extends Object
@ -5730,7 +5730,7 @@ abstract class _UnitIndexMixin implements idl.UnitIndex {
};
@override
String toString() => convert.JSON.encode(toJson());
String toString() => convert.json.encode(toJson());
}
class UnlinkedClassBuilder extends Object
@ -6282,7 +6282,7 @@ abstract class _UnlinkedClassMixin implements idl.UnlinkedClass {
};
@override
String toString() => convert.JSON.encode(toJson());
String toString() => convert.json.encode(toJson());
}
class UnlinkedCombinatorBuilder extends Object
@ -6471,7 +6471,7 @@ abstract class _UnlinkedCombinatorMixin implements idl.UnlinkedCombinator {
};
@override
String toString() => convert.JSON.encode(toJson());
String toString() => convert.json.encode(toJson());
}
class UnlinkedConfigurationBuilder extends Object
@ -6618,7 +6618,7 @@ abstract class _UnlinkedConfigurationMixin
};
@override
String toString() => convert.JSON.encode(toJson());
String toString() => convert.json.encode(toJson());
}
class UnlinkedConstructorInitializerBuilder extends Object
@ -6861,7 +6861,7 @@ abstract class _UnlinkedConstructorInitializerMixin
};
@override
String toString() => convert.JSON.encode(toJson());
String toString() => convert.json.encode(toJson());
}
class UnlinkedDocumentationCommentBuilder extends Object
@ -6967,7 +6967,7 @@ abstract class _UnlinkedDocumentationCommentMixin
};
@override
String toString() => convert.JSON.encode(toJson());
String toString() => convert.json.encode(toJson());
}
class UnlinkedEnumBuilder extends Object
@ -7232,7 +7232,7 @@ abstract class _UnlinkedEnumMixin implements idl.UnlinkedEnum {
};
@override
String toString() => convert.JSON.encode(toJson());
String toString() => convert.json.encode(toJson());
}
class UnlinkedEnumValueBuilder extends Object
@ -7380,7 +7380,7 @@ abstract class _UnlinkedEnumValueMixin implements idl.UnlinkedEnumValue {
};
@override
String toString() => convert.JSON.encode(toJson());
String toString() => convert.json.encode(toJson());
}
class UnlinkedExecutableBuilder extends Object
@ -8369,7 +8369,7 @@ abstract class _UnlinkedExecutableMixin implements idl.UnlinkedExecutable {
};
@override
String toString() => convert.JSON.encode(toJson());
String toString() => convert.json.encode(toJson());
}
class UnlinkedExportNonPublicBuilder extends Object
@ -8555,7 +8555,7 @@ abstract class _UnlinkedExportNonPublicMixin
};
@override
String toString() => convert.JSON.encode(toJson());
String toString() => convert.json.encode(toJson());
}
class UnlinkedExportPublicBuilder extends Object
@ -8732,7 +8732,7 @@ abstract class _UnlinkedExportPublicMixin implements idl.UnlinkedExportPublic {
};
@override
String toString() => convert.JSON.encode(toJson());
String toString() => convert.json.encode(toJson());
}
class UnlinkedExprBuilder extends Object
@ -9073,7 +9073,7 @@ abstract class _UnlinkedExprMixin implements idl.UnlinkedExpr {
};
@override
String toString() => convert.JSON.encode(toJson());
String toString() => convert.json.encode(toJson());
}
class UnlinkedImportBuilder extends Object
@ -9488,7 +9488,7 @@ abstract class _UnlinkedImportMixin implements idl.UnlinkedImport {
};
@override
String toString() => convert.JSON.encode(toJson());
String toString() => convert.json.encode(toJson());
}
class UnlinkedParamBuilder extends Object
@ -10089,7 +10089,7 @@ abstract class _UnlinkedParamMixin implements idl.UnlinkedParam {
};
@override
String toString() => convert.JSON.encode(toJson());
String toString() => convert.json.encode(toJson());
}
class UnlinkedPartBuilder extends Object
@ -10244,7 +10244,7 @@ abstract class _UnlinkedPartMixin implements idl.UnlinkedPart {
};
@override
String toString() => convert.JSON.encode(toJson());
String toString() => convert.json.encode(toJson());
}
class UnlinkedPublicNameBuilder extends Object
@ -10438,7 +10438,7 @@ abstract class _UnlinkedPublicNameMixin implements idl.UnlinkedPublicName {
};
@override
String toString() => convert.JSON.encode(toJson());
String toString() => convert.json.encode(toJson());
}
class UnlinkedPublicNamespaceBuilder extends Object
@ -10635,7 +10635,7 @@ abstract class _UnlinkedPublicNamespaceMixin
};
@override
String toString() => convert.JSON.encode(toJson());
String toString() => convert.json.encode(toJson());
}
class UnlinkedReferenceBuilder extends Object
@ -10754,7 +10754,7 @@ abstract class _UnlinkedReferenceMixin implements idl.UnlinkedReference {
};
@override
String toString() => convert.JSON.encode(toJson());
String toString() => convert.json.encode(toJson());
}
class UnlinkedTypedefBuilder extends Object
@ -11126,7 +11126,7 @@ abstract class _UnlinkedTypedefMixin implements idl.UnlinkedTypedef {
};
@override
String toString() => convert.JSON.encode(toJson());
String toString() => convert.json.encode(toJson());
}
class UnlinkedTypeParamBuilder extends Object
@ -11347,7 +11347,7 @@ abstract class _UnlinkedTypeParamMixin implements idl.UnlinkedTypeParam {
};
@override
String toString() => convert.JSON.encode(toJson());
String toString() => convert.json.encode(toJson());
}
class UnlinkedUnitBuilder extends Object
@ -12150,7 +12150,7 @@ abstract class _UnlinkedUnitMixin implements idl.UnlinkedUnit {
};
@override
String toString() => convert.JSON.encode(toJson());
String toString() => convert.json.encode(toJson());
}
class UnlinkedVariableBuilder extends Object
@ -12662,5 +12662,5 @@ abstract class _UnlinkedVariableMixin implements idl.UnlinkedVariable {
};
@override
String toString() => convert.JSON.encode(toJson());
String toString() => convert.json.encode(toJson());
}

View file

@ -101,6 +101,6 @@ class PackageBundleAssembler {
* Compute a hash of the given file contents.
*/
String _hash(String contents) {
return hex.encode(md5.convert(UTF8.encode(contents)).bytes);
return hex.encode(md5.convert(utf8.encode(contents)).bytes);
}
}

View file

@ -872,7 +872,7 @@ class MemoryResourceProviderTest {
}
Future _delayed(computation()) {
return new Future.delayed(Duration.ZERO, computation);
return new Future.delayed(Duration.zero, computation);
}
_watchingFolder(String path, test(List<WatchEvent> changesReceived)) {

View file

@ -44,7 +44,7 @@ void runPackageMapTests() {
];
Packages createPackageMap(Uri base, String configFileContents) {
List<int> bytes = UTF8.encode(configFileContents);
List<int> bytes = utf8.encode(configFileContents);
Map<String, Uri> map = pkgfile.parse(bytes, base);
return new MapPackages(map);
}

View file

@ -60,7 +60,7 @@ Future pumpEventQueue([int times = 5000]) {
// Future.value or Future() constructors use scheduleMicrotask themselves and
// would therefore not wait for microtask callbacks that are scheduled after
// invoking this method.
return new Future.delayed(Duration.ZERO, () => pumpEventQueue(times - 1));
return new Future.delayed(Duration.zero, () => pumpEventQueue(times - 1));
}
/**

View file

@ -788,7 +788,7 @@ set _V3(_) {}
String _p(String path) => provider.convertPath(path);
static String _md5(String content) {
return hex.encode(md5.convert(UTF8.encode(content)).bytes);
return hex.encode(md5.convert(utf8.encode(content)).bytes);
}
}

View file

@ -166,7 +166,7 @@ class InferredTypeCollector {
String formatParam(UnlinkedParam param) {
if (param.isFunctionTyped) {
// TODO(paulberry): fix this case.
return 'BAD(${JSON.encode(param)})';
return 'BAD(${json.encode(param)})';
}
String result;
if (param.type != null) {

View file

@ -521,7 +521,7 @@ class _CodeGenerator {
* Enclose [s] in quotes, escaping as necessary.
*/
String quoted(String s) {
return JSON.encode(s);
return json.encode(s);
}
void _generateBuilder(idlModel.ClassDeclaration cls) {
@ -915,7 +915,7 @@ class _CodeGenerator {
out();
// Write toString().
out('@override');
out('String toString() => convert.JSON.encode(toJson());');
out('String toString() => convert.json.encode(toJson());');
});
out('}');
}

View file

@ -211,7 +211,7 @@ class SummaryInspector {
}
return new DecodedEntity.group('[', parts, ']', false);
} else if (obj is String) {
return new DecodedEntity.short(JSON.encode(obj));
return new DecodedEntity.short(json.encode(obj));
} else if (isEnum(obj)) {
return new DecodedEntity.short(obj.toString().split('.')[1]);
} else if (obj is int &&
@ -243,7 +243,7 @@ class SummaryInspector {
new UnitWrapper(linked.units[0], unlinked[0]);
for (int i = 1; i < linked.units.length; i++) {
String partUri = unlinked[0].publicNamespace.parts[i - 1];
result['part ${JSON.encode(partUri)}'] =
result['part ${json.encode(partUri)}'] =
new UnitWrapper(linked.units[i], unlinked[i]);
}
return decodeMap(result);
@ -324,14 +324,14 @@ class SummaryInspector {
libraryUnits.add(units[partUriString]);
seenUnits.add(partUriString);
}
result['library ${JSON.encode(libraryUriString)}'] =
result['library ${json.encode(libraryUriString)}'] =
new LibraryWrapper(linkedLibrary, libraryUnits);
}
for (String uriString in units.keys) {
if (seenUnits.contains(uriString)) {
continue;
}
result['orphan unit ${JSON.encode(uriString)}'] =
result['orphan unit ${json.encode(uriString)}'] =
new UnitWrapper(null, units[uriString]);
}
restOfMap.remove('linkedLibraries');

View file

@ -30,7 +30,7 @@ class BatchRunner {
ErrorSeverity batchResult = ErrorSeverity.NONE;
// Read line from stdin.
Stream<String> cmdLine =
stdin.transform(UTF8.decoder).transform(new LineSplitter());
stdin.transform(utf8.decoder).transform(new LineSplitter());
cmdLine.listen((String line) async {
// Maybe finish.
if (line.isEmpty) {

View file

@ -4,7 +4,7 @@
library analyzer_cli.test.perf_report;
import 'dart:convert' show JSON;
import 'dart:convert' show json;
import 'package:analyzer_cli/src/error_formatter.dart' show AnalysisStats;
import 'package:analyzer_cli/src/options.dart';
@ -16,8 +16,8 @@ main() {
var options = CommandLineOptions.parse(["somefile.dart"]);
var encoded = makePerfReport(1000, 1234, options, 0, new AnalysisStats());
var json = JSON.decode(encoded);
expect(json['totalElapsedTime'], 234);
expect(json['options']['sourceFiles'], ["somefile.dart"]);
var jsonData = json.decode(encoded);
expect(jsonData['totalElapsedTime'], 234);
expect(jsonData['options']['sourceFiles'], ["somefile.dart"]);
});
}

View file

@ -73,7 +73,7 @@ class AddContentOverlay implements HasToJson {
}
@override
String toString() => JSON.encode(toJson());
String toString() => json.encode(toJson());
@override
bool operator ==(other) {
@ -317,7 +317,7 @@ class AnalysisError implements HasToJson {
}
@override
String toString() => JSON.encode(toJson());
String toString() => json.encode(toJson());
@override
bool operator ==(other) {
@ -570,7 +570,7 @@ class ChangeContentOverlay implements HasToJson {
}
@override
String toString() => JSON.encode(toJson());
String toString() => json.encode(toJson());
@override
bool operator ==(other) {
@ -1256,7 +1256,7 @@ class CompletionSuggestion implements HasToJson {
}
@override
String toString() => JSON.encode(toJson());
String toString() => json.encode(toJson());
@override
bool operator ==(other) {
@ -1725,7 +1725,7 @@ class Element implements HasToJson {
}
@override
String toString() => JSON.encode(toJson());
String toString() => json.encode(toJson());
@override
bool operator ==(other) {
@ -2139,7 +2139,7 @@ class FoldingRegion implements HasToJson {
}
@override
String toString() => JSON.encode(toJson());
String toString() => json.encode(toJson());
@override
bool operator ==(other) {
@ -2265,7 +2265,7 @@ class HighlightRegion implements HasToJson {
}
@override
String toString() => JSON.encode(toJson());
String toString() => json.encode(toJson());
@override
bool operator ==(other) {
@ -3138,7 +3138,7 @@ class KytheEntry implements HasToJson {
}
@override
String toString() => JSON.encode(toJson());
String toString() => json.encode(toJson());
@override
bool operator ==(other) {
@ -3328,7 +3328,7 @@ class KytheVName implements HasToJson {
}
@override
String toString() => JSON.encode(toJson());
String toString() => json.encode(toJson());
@override
bool operator ==(other) {
@ -3491,7 +3491,7 @@ class LinkedEditGroup implements HasToJson {
}
@override
String toString() => JSON.encode(toJson());
String toString() => json.encode(toJson());
@override
bool operator ==(other) {
@ -3595,7 +3595,7 @@ class LinkedEditSuggestion implements HasToJson {
}
@override
String toString() => JSON.encode(toJson());
String toString() => json.encode(toJson());
@override
bool operator ==(other) {
@ -3840,7 +3840,7 @@ class Location implements HasToJson {
}
@override
String toString() => JSON.encode(toJson());
String toString() => json.encode(toJson());
@override
bool operator ==(other) {
@ -3974,7 +3974,7 @@ class NavigationRegion implements HasToJson {
}
@override
String toString() => JSON.encode(toJson());
String toString() => json.encode(toJson());
@override
bool operator ==(other) {
@ -4183,7 +4183,7 @@ class NavigationTarget implements HasToJson {
}
@override
String toString() => JSON.encode(toJson());
String toString() => json.encode(toJson());
@override
bool operator ==(other) {
@ -4316,7 +4316,7 @@ class Occurrences implements HasToJson {
}
@override
String toString() => JSON.encode(toJson());
String toString() => json.encode(toJson());
@override
bool operator ==(other) {
@ -4478,7 +4478,7 @@ class Outline implements HasToJson {
}
@override
String toString() => JSON.encode(toJson());
String toString() => json.encode(toJson());
@override
bool operator ==(other) {
@ -4581,7 +4581,7 @@ class Position implements HasToJson {
}
@override
String toString() => JSON.encode(toJson());
String toString() => json.encode(toJson());
@override
bool operator ==(other) {
@ -4867,7 +4867,7 @@ class RefactoringMethodParameter implements HasToJson {
}
@override
String toString() => JSON.encode(toJson());
String toString() => json.encode(toJson());
@override
bool operator ==(other) {
@ -5066,7 +5066,7 @@ class RefactoringProblem implements HasToJson {
}
@override
String toString() => JSON.encode(toJson());
String toString() => json.encode(toJson());
@override
bool operator ==(other) {
@ -5223,7 +5223,7 @@ class RemoveContentOverlay implements HasToJson {
}
@override
String toString() => JSON.encode(toJson());
String toString() => json.encode(toJson());
@override
bool operator ==(other) {
@ -5448,7 +5448,7 @@ class SourceChange implements HasToJson {
SourceFileEdit getFileEdit(String file) => getChangeFileEdit(this, file);
@override
String toString() => JSON.encode(toJson());
String toString() => json.encode(toJson());
@override
bool operator ==(other) {
@ -5634,7 +5634,7 @@ class SourceEdit implements HasToJson {
String apply(String code) => applyEdit(code, this);
@override
String toString() => JSON.encode(toJson());
String toString() => json.encode(toJson());
@override
bool operator ==(other) {
@ -5788,7 +5788,7 @@ class SourceFileEdit implements HasToJson {
void addAll(Iterable<SourceEdit> edits) => addAllEditsForSource(this, edits);
@override
String toString() => JSON.encode(toJson());
String toString() => json.encode(toJson());
@override
bool operator ==(other) {

View file

@ -104,7 +104,7 @@ class AnalysisErrorFixes implements HasToJson {
}
@override
String toString() => JSON.encode(toJson());
String toString() => json.encode(toJson());
@override
bool operator ==(other) {
@ -218,7 +218,7 @@ class AnalysisErrorsParams implements HasToJson {
}
@override
String toString() => JSON.encode(toJson());
String toString() => json.encode(toJson());
@override
bool operator ==(other) {
@ -332,7 +332,7 @@ class AnalysisFoldingParams implements HasToJson {
}
@override
String toString() => JSON.encode(toJson());
String toString() => json.encode(toJson());
@override
bool operator ==(other) {
@ -471,7 +471,7 @@ class AnalysisGetNavigationParams implements RequestParams {
}
@override
String toString() => JSON.encode(toJson());
String toString() => json.encode(toJson());
@override
bool operator ==(other) {
@ -625,7 +625,7 @@ class AnalysisGetNavigationResult implements ResponseResult {
}
@override
String toString() => JSON.encode(toJson());
String toString() => json.encode(toJson());
@override
bool operator ==(other) {
@ -720,7 +720,7 @@ class AnalysisHandleWatchEventsParams implements RequestParams {
}
@override
String toString() => JSON.encode(toJson());
String toString() => json.encode(toJson());
@override
bool operator ==(other) {
@ -860,7 +860,7 @@ class AnalysisHighlightsParams implements HasToJson {
}
@override
String toString() => JSON.encode(toJson());
String toString() => json.encode(toJson());
@override
bool operator ==(other) {
@ -1033,7 +1033,7 @@ class AnalysisNavigationParams implements HasToJson {
}
@override
String toString() => JSON.encode(toJson());
String toString() => json.encode(toJson());
@override
bool operator ==(other) {
@ -1153,7 +1153,7 @@ class AnalysisOccurrencesParams implements HasToJson {
}
@override
String toString() => JSON.encode(toJson());
String toString() => json.encode(toJson());
@override
bool operator ==(other) {
@ -1266,7 +1266,7 @@ class AnalysisOutlineParams implements HasToJson {
}
@override
String toString() => JSON.encode(toJson());
String toString() => json.encode(toJson());
@override
bool operator ==(other) {
@ -1433,7 +1433,7 @@ class AnalysisSetContextRootsParams implements RequestParams {
}
@override
String toString() => JSON.encode(toJson());
String toString() => json.encode(toJson());
@override
bool operator ==(other) {
@ -1547,7 +1547,7 @@ class AnalysisSetPriorityFilesParams implements RequestParams {
}
@override
String toString() => JSON.encode(toJson());
String toString() => json.encode(toJson());
@override
bool operator ==(other) {
@ -1668,7 +1668,7 @@ class AnalysisSetSubscriptionsParams implements RequestParams {
}
@override
String toString() => JSON.encode(toJson());
String toString() => json.encode(toJson());
@override
bool operator ==(other) {
@ -1799,7 +1799,7 @@ class AnalysisUpdateContentParams implements RequestParams {
}
@override
String toString() => JSON.encode(toJson());
String toString() => json.encode(toJson());
@override
bool operator ==(other) {
@ -1935,7 +1935,7 @@ class CompletionGetSuggestionsParams implements RequestParams {
}
@override
String toString() => JSON.encode(toJson());
String toString() => json.encode(toJson());
@override
bool operator ==(other) {
@ -2097,7 +2097,7 @@ class CompletionGetSuggestionsResult implements ResponseResult {
}
@override
String toString() => JSON.encode(toJson());
String toString() => json.encode(toJson());
@override
bool operator ==(other) {
@ -2230,7 +2230,7 @@ class ContextRoot implements HasToJson {
}
@override
String toString() => JSON.encode(toJson());
String toString() => json.encode(toJson());
@override
bool operator ==(other) {
@ -2449,7 +2449,7 @@ class EditGetAssistsParams implements RequestParams {
}
@override
String toString() => JSON.encode(toJson());
String toString() => json.encode(toJson());
@override
bool operator ==(other) {
@ -2544,7 +2544,7 @@ class EditGetAssistsResult implements ResponseResult {
}
@override
String toString() => JSON.encode(toJson());
String toString() => json.encode(toJson());
@override
bool operator ==(other) {
@ -2677,7 +2677,7 @@ class EditGetAvailableRefactoringsParams implements RequestParams {
}
@override
String toString() => JSON.encode(toJson());
String toString() => json.encode(toJson());
@override
bool operator ==(other) {
@ -2782,7 +2782,7 @@ class EditGetAvailableRefactoringsResult implements ResponseResult {
}
@override
String toString() => JSON.encode(toJson());
String toString() => json.encode(toJson());
@override
bool operator ==(other) {
@ -2890,7 +2890,7 @@ class EditGetFixesParams implements RequestParams {
}
@override
String toString() => JSON.encode(toJson());
String toString() => json.encode(toJson());
@override
bool operator ==(other) {
@ -2981,7 +2981,7 @@ class EditGetFixesResult implements ResponseResult {
}
@override
String toString() => JSON.encode(toJson());
String toString() => json.encode(toJson());
@override
bool operator ==(other) {
@ -3203,7 +3203,7 @@ class EditGetRefactoringParams implements RequestParams {
}
@override
String toString() => JSON.encode(toJson());
String toString() => json.encode(toJson());
@override
bool operator ==(other) {
@ -3478,7 +3478,7 @@ class EditGetRefactoringResult implements ResponseResult {
}
@override
String toString() => JSON.encode(toJson());
String toString() => json.encode(toJson());
@override
bool operator ==(other) {
@ -3686,7 +3686,7 @@ class ExtractLocalVariableFeedback extends RefactoringFeedback {
}
@override
String toString() => JSON.encode(toJson());
String toString() => json.encode(toJson());
@override
bool operator ==(other) {
@ -3807,7 +3807,7 @@ class ExtractLocalVariableOptions extends RefactoringOptions {
}
@override
String toString() => JSON.encode(toJson());
String toString() => json.encode(toJson());
@override
bool operator ==(other) {
@ -4084,7 +4084,7 @@ class ExtractMethodFeedback extends RefactoringFeedback {
}
@override
String toString() => JSON.encode(toJson());
String toString() => json.encode(toJson());
@override
bool operator ==(other) {
@ -4313,7 +4313,7 @@ class ExtractMethodOptions extends RefactoringOptions {
}
@override
String toString() => JSON.encode(toJson());
String toString() => json.encode(toJson());
@override
bool operator ==(other) {
@ -4424,7 +4424,7 @@ class InlineLocalVariableFeedback extends RefactoringFeedback {
}
@override
String toString() => JSON.encode(toJson());
String toString() => json.encode(toJson());
@override
bool operator ==(other) {
@ -4575,7 +4575,7 @@ class InlineMethodFeedback extends RefactoringFeedback {
}
@override
String toString() => JSON.encode(toJson());
String toString() => json.encode(toJson());
@override
bool operator ==(other) {
@ -4688,7 +4688,7 @@ class InlineMethodOptions extends RefactoringOptions {
}
@override
String toString() => JSON.encode(toJson());
String toString() => json.encode(toJson());
@override
bool operator ==(other) {
@ -4775,7 +4775,7 @@ class KytheGetKytheEntriesParams implements RequestParams {
}
@override
String toString() => JSON.encode(toJson());
String toString() => json.encode(toJson());
@override
bool operator ==(other) {
@ -4897,7 +4897,7 @@ class KytheGetKytheEntriesResult implements ResponseResult {
}
@override
String toString() => JSON.encode(toJson());
String toString() => json.encode(toJson());
@override
bool operator ==(other) {
@ -5000,7 +5000,7 @@ class MoveFileOptions extends RefactoringOptions {
}
@override
String toString() => JSON.encode(toJson());
String toString() => json.encode(toJson());
@override
bool operator ==(other) {
@ -5141,7 +5141,7 @@ class PluginErrorParams implements HasToJson {
}
@override
String toString() => JSON.encode(toJson());
String toString() => json.encode(toJson());
@override
bool operator ==(other) {
@ -5342,7 +5342,7 @@ class PluginVersionCheckParams implements RequestParams {
}
@override
String toString() => JSON.encode(toJson());
String toString() => json.encode(toJson());
@override
bool operator ==(other) {
@ -5552,7 +5552,7 @@ class PluginVersionCheckResult implements ResponseResult {
}
@override
String toString() => JSON.encode(toJson());
String toString() => json.encode(toJson());
@override
bool operator ==(other) {
@ -5662,7 +5662,7 @@ class PrioritizedSourceChange implements HasToJson {
}
@override
String toString() => JSON.encode(toJson());
String toString() => json.encode(toJson());
@override
bool operator ==(other) {
@ -5705,7 +5705,7 @@ class RefactoringFeedback implements HasToJson {
}
@override
String toString() => JSON.encode(toJson());
String toString() => json.encode(toJson());
@override
bool operator ==(other) {
@ -5745,7 +5745,7 @@ class RefactoringOptions implements HasToJson {
}
@override
String toString() => JSON.encode(toJson());
String toString() => json.encode(toJson());
@override
bool operator ==(other) {
@ -5894,7 +5894,7 @@ class RenameFeedback extends RefactoringFeedback {
}
@override
String toString() => JSON.encode(toJson());
String toString() => json.encode(toJson());
@override
bool operator ==(other) {
@ -5980,7 +5980,7 @@ class RenameOptions extends RefactoringOptions {
}
@override
String toString() => JSON.encode(toJson());
String toString() => json.encode(toJson());
@override
bool operator ==(other) {
@ -6105,7 +6105,7 @@ class RequestError implements HasToJson {
}
@override
String toString() => JSON.encode(toJson());
String toString() => json.encode(toJson());
@override
bool operator ==(other) {
@ -6300,7 +6300,7 @@ class WatchEvent implements HasToJson {
}
@override
String toString() => JSON.encode(toJson());
String toString() => json.encode(toJson());
@override
bool operator ==(other) {

View file

@ -269,11 +269,11 @@ abstract class ServerIsolateChannel implements ServerCommunicationChannel {
channelReady.complete(null);
} else if (input is Map) {
if (input.containsKey('id')) {
String encodedInput = JSON.encode(input);
String encodedInput = json.encode(input);
instrumentationService.logPluginResponse(pluginId, encodedInput);
onResponse(new Response.fromJson(input));
} else if (input.containsKey('event')) {
String encodedInput = JSON.encode(input);
String encodedInput = json.encode(input);
instrumentationService.logPluginNotification(pluginId, encodedInput);
onNotification(new Notification.fromJson(input));
}
@ -285,10 +285,10 @@ abstract class ServerIsolateChannel implements ServerCommunicationChannel {
@override
void sendRequest(Request request) {
if (_sendPort != null) {
Map<String, Object> json = request.toJson();
String encodedRequest = JSON.encode(json);
Map<String, Object> jsonData = request.toJson();
String encodedRequest = json.encode(jsonData);
instrumentationService.logPluginRequest(pluginId, encodedRequest);
_sendPort.send(json);
_sendPort.send(jsonData);
}
}

View file

@ -309,14 +309,14 @@ abstract class JsonDecoder {
* Decode a JSON object that is expected to be a Map. [keyDecoder] is used
* to decode the keys, and [valueDecoder] is used to decode the values.
*/
Map<K, V> decodeMap<K, V>(String jsonPath, Object json,
Map<K, V> decodeMap<K, V>(String jsonPath, Object jsonData,
{JsonDecoderCallback<K> keyDecoder,
JsonDecoderCallback<V> valueDecoder}) {
if (json == null) {
if (jsonData == null) {
return {};
} else if (json is Map) {
} else if (jsonData is Map) {
Map<K, V> result = <K, V>{};
json.forEach((key, value) {
jsonData.forEach((key, value) {
K decodedKey;
if (keyDecoder != null) {
decodedKey = keyDecoder('$jsonPath.key', key);
@ -324,13 +324,13 @@ abstract class JsonDecoder {
decodedKey = key as K;
}
if (valueDecoder != null) {
value = valueDecoder('$jsonPath[${JSON.encode(key)}]', value);
value = valueDecoder('$jsonPath[${json.encode(key)}]', value);
}
result[decodedKey] = value as V;
});
return result;
} else {
throw mismatch(jsonPath, 'Map', json);
throw mismatch(jsonPath, 'Map', jsonData);
}
}
@ -351,21 +351,21 @@ abstract class JsonDecoder {
* [decoders] is a map from each possible string in the field to the decoder
* that should be used to decode the JSON object.
*/
Object decodeUnion(String jsonPath, Map json, String field,
Object decodeUnion(String jsonPath, Map jsonData, String field,
Map<String, JsonDecoderCallback> decoders) {
if (json is Map) {
if (!json.containsKey(field)) {
if (jsonData is Map) {
if (!jsonData.containsKey(field)) {
throw missingKey(jsonPath, field);
}
var disambiguatorPath = '$jsonPath[${JSON.encode(field)}]';
String disambiguator = decodeString(disambiguatorPath, json[field]);
var disambiguatorPath = '$jsonPath[${json.encode(field)}]';
String disambiguator = decodeString(disambiguatorPath, jsonData[field]);
if (!decoders.containsKey(disambiguator)) {
throw mismatch(
disambiguatorPath, 'One of: ${decoders.keys.toList()}', json);
disambiguatorPath, 'One of: ${decoders.keys.toList()}', jsonData);
}
return decoders[disambiguator](jsonPath, json);
return decoders[disambiguator](jsonPath, jsonData);
} else {
throw mismatch(jsonPath, 'Map', json);
throw mismatch(jsonPath, 'Map', jsonData);
}
}
@ -407,7 +407,7 @@ class RequestDecoder extends JsonDecoder {
buffer.write(expected);
if (actual != null) {
buffer.write('; found "');
buffer.write(JSON.encode(actual));
buffer.write(json.encode(actual));
buffer.write('"');
}
return new RequestFailure(
@ -417,7 +417,7 @@ class RequestDecoder extends JsonDecoder {
@override
dynamic missingKey(String jsonPath, String key) {
return new RequestFailure(RequestErrorFactory.invalidParameter(
jsonPath, 'Expected to contain key ${JSON.encode(key)}'));
jsonPath, 'Expected to contain key ${json.encode(key)}'));
}
}
@ -446,7 +446,7 @@ class ResponseDecoder extends JsonDecoder {
buffer.write(expected);
if (actual != null) {
buffer.write(' found "');
buffer.write(JSON.encode(actual));
buffer.write(json.encode(actual));
buffer.write('"');
}
buffer.write(' at ');

View file

@ -542,7 +542,7 @@ class Server {
_recordStdio('RECV: $trimmedLine');
var message;
try {
message = JSON.decoder.convert(trimmedLine);
message = json.decoder.convert(trimmedLine);
} catch (exception) {
_badDataFromServer('JSON decode failure: $exception');
return;
@ -608,9 +608,9 @@ class Server {
}
Completer completer = new Completer();
_pendingCommands[id] = completer;
String line = JSON.encode(command);
String line = json.encode(command);
_recordStdio('SEND: $line');
_process.stdin.add(UTF8.encoder.convert("$line\n"));
_process.stdin.add(utf8.encoder.convert("$line\n"));
return completer.future;
}

View file

@ -86,7 +86,7 @@ class PluginIsolateChannelTest {
// Future.value or Future() constructors use scheduleMicrotask themselves and
// would therefore not wait for microtask callbacks that are scheduled after
// invoking this method.
return new Future.delayed(Duration.ZERO, () => _pumpEventQueue(times - 1));
return new Future.delayed(Duration.zero, () => _pumpEventQueue(times - 1));
}
}

View file

@ -551,7 +551,7 @@ abstract class DartCompletionContributorTest extends AbstractContextTest {
// would therefore not wait for microtask callbacks that are scheduled after
// invoking this method.
return new Future.delayed(
Duration.ZERO, () => performAnalysis(times - 1, completer));
Duration.zero, () => performAnalysis(times - 1, completer));
}
void resolveSource(String path, String content) {

View file

@ -503,7 +503,7 @@ class CodegenProtocolVisitor extends DartCodegenVisitor with CodeGenerator {
writeln();
}
writeln('@override');
writeln('String toString() => JSON.encode(toJson());');
writeln('String toString() => json.encode(toJson());');
writeln();
emitObjectEqualsMember(type, className);
writeln();
@ -1109,7 +1109,7 @@ class CodegenProtocolVisitor extends DartCodegenVisitor with CodeGenerator {
* Create a string literal that evaluates to [s].
*/
String literalString(String s) {
return JSON.encode(s);
return json.encode(s);
}
/**

View file

@ -182,7 +182,7 @@ class CodegenInttestMethodsVisitor extends DartCodegenVisitor
writeln('$streamName = _$streamName.stream.asBroadcastStream();');
}));
notificationSwitchContents.add(collectCode(() {
writeln('case ${JSON.encode(notification.longEvent)}:');
writeln('case ${json.encode(notification.longEvent)}:');
indent(() {
String paramsValidator = camelJoin(
['is', notification.domainName, notification.event, 'params']);
@ -255,7 +255,7 @@ class CodegenInttestMethodsVisitor extends DartCodegenVisitor
args.addAll(optionalArgs);
writeln('var params = new $requestClass(${args.join(', ')}).toJson();');
}
String methodJson = JSON.encode(request.longMethod);
String methodJson = json.encode(request.longMethod);
writeln('var result = await server.send($methodJson, $paramsVar);');
if (request.result != null) {
String kind = 'null';

View file

@ -81,9 +81,9 @@ class CodegenMatchersVisitor extends HierarchicalApiVisitor with CodeGenerator {
if (commaNeeded) {
writeln(',');
}
write('${JSON.encode(field.name)}: ');
write('${json.encode(field.name)}: ');
if (field.value != null) {
write('equals(${JSON.encode(field.value)})');
write('equals(${json.encode(field.value)})');
} else {
visitTypeDecl(field.type);
}
@ -115,14 +115,14 @@ class CodegenMatchersVisitor extends HierarchicalApiVisitor with CodeGenerator {
@override
visitTypeEnum(TypeEnum typeEnum) {
writeln('new MatchesEnum(${JSON.encode(context)}, [');
writeln('new MatchesEnum(${json.encode(context)}, [');
indent(() {
bool commaNeeded = false;
for (TypeEnumValue value in typeEnum.values) {
if (commaNeeded) {
writeln(',');
}
write('${JSON.encode(value.value)}');
write('${json.encode(value.value)}');
commaNeeded = true;
}
writeln();
@ -150,7 +150,7 @@ class CodegenMatchersVisitor extends HierarchicalApiVisitor with CodeGenerator {
void visitTypeObject(TypeObject typeObject) {
writeln('new LazyMatcher(() => new MatchesJsonObject(');
indent(() {
write('${JSON.encode(context)}, ');
write('${json.encode(context)}, ');
Iterable<TypeObjectField> requiredFields =
typeObject.fields.where((TypeObjectField field) => !field.optional);
outputObjectFields(requiredFields);

View file

@ -675,7 +675,7 @@ class ToHtmlVisitor extends HierarchicalApiVisitor
write(typeObjectField.name);
}
if (typeObjectField.value != null) {
write(' = ${JSON.encode(typeObjectField.value)}');
write(' = ${json.encode(typeObjectField.value)}');
} else {
write(': ');
TypeVisitor typeVisitor = new TypeVisitor(api, short: true);
@ -785,7 +785,7 @@ class TypeVisitor extends HierarchicalApiVisitor
}
write('": ');
if (field.value != null) {
write(JSON.encode(field.value));
write(json.encode(field.value));
} else {
if (field.optional) {
gray(() {