Version 2.10.0-35.0.dev
Merge commit 'd9ce879bc2584792566ac3e92fddbed8fceb90b4' into 'dev'
diff --git a/pkg/analysis_server/lib/src/analysis_server.dart b/pkg/analysis_server/lib/src/analysis_server.dart
index c0d5406..3e87f9c 100644
--- a/pkg/analysis_server/lib/src/analysis_server.dart
+++ b/pkg/analysis_server/lib/src/analysis_server.dart
@@ -55,7 +55,6 @@
import 'package:analyzer/src/dart/analysis/status.dart' as nd;
import 'package:analyzer/src/generated/engine.dart';
import 'package:analyzer/src/generated/sdk.dart';
-import 'package:analyzer/src/generated/utilities_general.dart';
import 'package:analyzer_plugin/protocol/protocol_common.dart' hide Element;
import 'package:analyzer_plugin/src/utilities/navigation/navigation.dart';
import 'package:analyzer_plugin/utilities/navigation/navigation_dart.dart';
@@ -234,34 +233,32 @@
void handleRequest(Request request) {
performance.logRequestTiming(request.clientRequestTime);
runZonedGuarded(() {
- ServerPerformanceStatistics.serverRequests.makeCurrentWhile(() {
- var count = handlers.length;
- for (var i = 0; i < count; i++) {
- try {
- var response = handlers[i].handleRequest(request);
- if (response == Response.DELAYED_RESPONSE) {
- return;
- }
- if (response != null) {
- channel.sendResponse(response);
- return;
- }
- } on RequestFailure catch (exception) {
- channel.sendResponse(exception.response);
+ var count = handlers.length;
+ for (var i = 0; i < count; i++) {
+ try {
+ var response = handlers[i].handleRequest(request);
+ if (response == Response.DELAYED_RESPONSE) {
return;
- } catch (exception, stackTrace) {
- var error = RequestError(
- RequestErrorCode.SERVER_ERROR, exception.toString());
- if (stackTrace != null) {
- error.stackTrace = stackTrace.toString();
- }
- var response = Response(request.id, error: error);
+ }
+ if (response != null) {
channel.sendResponse(response);
return;
}
+ } on RequestFailure catch (exception) {
+ channel.sendResponse(exception.response);
+ return;
+ } catch (exception, stackTrace) {
+ var error =
+ RequestError(RequestErrorCode.SERVER_ERROR, exception.toString());
+ if (stackTrace != null) {
+ error.stackTrace = stackTrace.toString();
+ }
+ var response = Response(request.id, error: error);
+ channel.sendResponse(response);
+ return;
}
- channel.sendResponse(Response.unknownRequest(request));
- });
+ }
+ channel.sendResponse(Response.unknownRequest(request));
}, (exception, stackTrace) {
AnalysisEngine.instance.instrumentationService.logException(
FatalException(
@@ -931,23 +928,3 @@
}
}
}
-
-/// Container with global [AnalysisServer] performance statistics.
-class ServerPerformanceStatistics {
- /// The [PerformanceTag] for `package:analysis_server`.
- static final PerformanceTag server = PerformanceTag('server');
-
- /// The [PerformanceTag] for time spent between calls to
- /// AnalysisServer.performOperation when the server is idle.
- static final PerformanceTag idle = PerformanceTag('idle');
-
- /// The [PerformanceTag] for time spent in
- /// PerformAnalysisOperation._sendNotices.
- static final PerformanceTag notices = server.createChild('notices');
-
- /// The [PerformanceTag] for time spent in server communication channels.
- static final PerformanceTag serverChannel = server.createChild('channel');
-
- /// The [PerformanceTag] for time spent in server request handlers.
- static final PerformanceTag serverRequests = server.createChild('requests');
-}
diff --git a/pkg/analysis_server/lib/src/channel/byte_stream_channel.dart b/pkg/analysis_server/lib/src/channel/byte_stream_channel.dart
index beb2d8e..a6567e6 100644
--- a/pkg/analysis_server/lib/src/channel/byte_stream_channel.dart
+++ b/pkg/analysis_server/lib/src/channel/byte_stream_channel.dart
@@ -7,7 +7,6 @@
import 'dart:io';
import 'package:analysis_server/protocol/protocol.dart';
-import 'package:analysis_server/src/analysis_server.dart';
import 'package:analysis_server/src/channel/channel.dart';
import 'package:analysis_server/src/utilities/request_statistics.dart';
import 'package:analyzer/instrumentation/instrumentation.dart';
@@ -115,14 +114,12 @@
if (_closeRequested) {
return;
}
- ServerPerformanceStatistics.serverChannel.makeCurrentWhile(() {
- var jsonEncoding = json.encode(notification.toJson());
- _outputLine(jsonEncoding);
- if (!identical(notification.event, 'server.log')) {
- _instrumentationService.logNotification(jsonEncoding);
- _requestStatistics?.logNotification(notification);
- }
- });
+ var jsonEncoding = json.encode(notification.toJson());
+ _outputLine(jsonEncoding);
+ if (!identical(notification.event, 'server.log')) {
+ _instrumentationService.logNotification(jsonEncoding);
+ _requestStatistics?.logNotification(notification);
+ }
}
@override
@@ -132,12 +129,10 @@
if (_closeRequested) {
return;
}
- ServerPerformanceStatistics.serverChannel.makeCurrentWhile(() {
- _requestStatistics?.addResponse(response);
- var jsonEncoding = json.encode(response.toJson());
- _outputLine(jsonEncoding);
- _instrumentationService.logResponse(jsonEncoding);
- });
+ _requestStatistics?.addResponse(response);
+ var jsonEncoding = json.encode(response.toJson());
+ _outputLine(jsonEncoding);
+ _instrumentationService.logResponse(jsonEncoding);
}
/// Send the string [s] to [_output] followed by a newline.
@@ -156,17 +151,15 @@
if (_closed.isCompleted) {
return;
}
- ServerPerformanceStatistics.serverChannel.makeCurrentWhile(() {
- _instrumentationService.logRequest(data);
- // Parse the string as a JSON descriptor and process the resulting
- // structure as a request.
- var request = Request.fromString(data);
- if (request == null) {
- sendResponse(Response.invalidRequestFormat());
- return;
- }
- _requestStatistics?.addRequest(request);
- onRequest(request);
- });
+ _instrumentationService.logRequest(data);
+ // Parse the string as a JSON descriptor and process the resulting
+ // structure as a request.
+ var request = Request.fromString(data);
+ if (request == null) {
+ sendResponse(Response.invalidRequestFormat());
+ return;
+ }
+ _requestStatistics?.addRequest(request);
+ onRequest(request);
}
}
diff --git a/pkg/analysis_server/lib/src/flutter/flutter_notifications.dart b/pkg/analysis_server/lib/src/flutter/flutter_notifications.dart
index 9e31bd0..a5d894f 100644
--- a/pkg/analysis_server/lib/src/flutter/flutter_notifications.dart
+++ b/pkg/analysis_server/lib/src/flutter/flutter_notifications.dart
@@ -25,13 +25,11 @@
/// Runs the given notification producing function [f], catching exceptions.
void _sendNotification(AnalysisServer server, Function() f) {
- ServerPerformanceStatistics.notices.makeCurrentWhile(() {
- try {
- f();
- } catch (exception, stackTrace) {
- AnalysisEngine.instance.instrumentationService.logException(
- CaughtException.withMessage(
- 'Failed to send notification', exception, stackTrace));
- }
- });
+ try {
+ f();
+ } catch (exception, stackTrace) {
+ AnalysisEngine.instance.instrumentationService.logException(
+ CaughtException.withMessage(
+ 'Failed to send notification', exception, stackTrace));
+ }
}
diff --git a/pkg/analysis_server/lib/src/lsp/channel/lsp_byte_stream_channel.dart b/pkg/analysis_server/lib/src/lsp/channel/lsp_byte_stream_channel.dart
index e05cec2..acd9c2e 100644
--- a/pkg/analysis_server/lib/src/lsp/channel/lsp_byte_stream_channel.dart
+++ b/pkg/analysis_server/lib/src/lsp/channel/lsp_byte_stream_channel.dart
@@ -8,7 +8,6 @@
import 'package:analysis_server/lsp_protocol/protocol_generated.dart';
import 'package:analysis_server/lsp_protocol/protocol_special.dart';
-import 'package:analysis_server/src/analysis_server.dart';
import 'package:analysis_server/src/lsp/channel/lsp_channel.dart';
import 'package:analysis_server/src/lsp/json_parsing.dart';
import 'package:analysis_server/src/lsp/lsp_packet_transformer.dart';
@@ -80,19 +79,17 @@
if (_closed.isCompleted) {
return;
}
- ServerPerformanceStatistics.serverChannel.makeCurrentWhile(() {
- _instrumentationService.logRequest(data);
- final Map<String, Object> json = jsonDecode(data);
- if (RequestMessage.canParse(json, nullLspJsonReporter)) {
- onMessage(RequestMessage.fromJson(json));
- } else if (NotificationMessage.canParse(json, nullLspJsonReporter)) {
- onMessage(NotificationMessage.fromJson(json));
- } else if (ResponseMessage.canParse(json, nullLspJsonReporter)) {
- onMessage(ResponseMessage.fromJson(json));
- } else {
- _sendParseError();
- }
- });
+ _instrumentationService.logRequest(data);
+ final Map<String, Object> json = jsonDecode(data);
+ if (RequestMessage.canParse(json, nullLspJsonReporter)) {
+ onMessage(RequestMessage.fromJson(json));
+ } else if (NotificationMessage.canParse(json, nullLspJsonReporter)) {
+ onMessage(NotificationMessage.fromJson(json));
+ } else if (ResponseMessage.canParse(json, nullLspJsonReporter)) {
+ onMessage(ResponseMessage.fromJson(json));
+ } else {
+ _sendParseError();
+ }
}
/// Sends a message prefixed with the required LSP headers.
@@ -102,19 +99,17 @@
if (_closeRequested) {
return;
}
- ServerPerformanceStatistics.serverChannel.makeCurrentWhile(() {
- final jsonEncodedBody = jsonEncode(json);
- final utf8EncodedBody = utf8.encode(jsonEncodedBody);
- final header = 'Content-Length: ${utf8EncodedBody.length}\r\n'
- 'Content-Type: application/vscode-jsonrpc; charset=utf-8\r\n\r\n';
- final asciiEncodedHeader = ascii.encode(header);
+ final jsonEncodedBody = jsonEncode(json);
+ final utf8EncodedBody = utf8.encode(jsonEncodedBody);
+ final header = 'Content-Length: ${utf8EncodedBody.length}\r\n'
+ 'Content-Type: application/vscode-jsonrpc; charset=utf-8\r\n\r\n';
+ final asciiEncodedHeader = ascii.encode(header);
- // Header is always ascii, body is always utf8!
- _write(asciiEncodedHeader);
- _write(utf8EncodedBody);
+ // Header is always ascii, body is always utf8!
+ _write(asciiEncodedHeader);
+ _write(utf8EncodedBody);
- _instrumentationService.logResponse(jsonEncodedBody);
- });
+ _instrumentationService.logResponse(jsonEncodedBody);
}
void _sendParseError() {
diff --git a/pkg/analysis_server/lib/src/lsp/lsp_analysis_server.dart b/pkg/analysis_server/lib/src/lsp/lsp_analysis_server.dart
index e875cfa..d52a6a35 100644
--- a/pkg/analysis_server/lib/src/lsp/lsp_analysis_server.dart
+++ b/pkg/analysis_server/lib/src/lsp/lsp_analysis_server.dart
@@ -258,46 +258,44 @@
/// Handle a [message] that was read from the communication channel.
void handleMessage(Message message) {
performance.logRequestTiming(null);
- runZonedGuarded(() {
- ServerPerformanceStatistics.serverRequests.makeCurrentWhile(() async {
- try {
- if (message is ResponseMessage) {
- handleClientResponse(message);
- } else if (message is RequestMessage) {
- final result = await messageHandler.handleMessage(message);
- if (result.isError) {
- sendErrorResponse(message, result.error);
- } else {
- channel.sendResponse(ResponseMessage(
- id: message.id,
- result: result.result,
- jsonrpc: jsonRpcVersion));
- }
- } else if (message is NotificationMessage) {
- final result = await messageHandler.handleMessage(message);
- if (result.isError) {
- sendErrorResponse(message, result.error);
- }
+ runZonedGuarded(() async {
+ try {
+ if (message is ResponseMessage) {
+ handleClientResponse(message);
+ } else if (message is RequestMessage) {
+ final result = await messageHandler.handleMessage(message);
+ if (result.isError) {
+ sendErrorResponse(message, result.error);
} else {
- showErrorMessageToUser('Unknown message type');
+ channel.sendResponse(ResponseMessage(
+ id: message.id,
+ result: result.result,
+ jsonrpc: jsonRpcVersion));
}
- } catch (error, stackTrace) {
- final errorMessage = message is ResponseMessage
- ? 'An error occurred while handling the response to request ${message.id}'
- : message is RequestMessage
- ? 'An error occurred while handling ${message.method} request'
- : message is NotificationMessage
- ? 'An error occurred while handling ${message.method} notification'
- : 'Unknown message type';
- sendErrorResponse(
- message,
- ResponseError(
- code: ServerErrorCodes.UnhandledError,
- message: errorMessage,
- ));
- logException(errorMessage, error, stackTrace);
+ } else if (message is NotificationMessage) {
+ final result = await messageHandler.handleMessage(message);
+ if (result.isError) {
+ sendErrorResponse(message, result.error);
+ }
+ } else {
+ showErrorMessageToUser('Unknown message type');
}
- });
+ } catch (error, stackTrace) {
+ final errorMessage = message is ResponseMessage
+ ? 'An error occurred while handling the response to request ${message.id}'
+ : message is RequestMessage
+ ? 'An error occurred while handling ${message.method} request'
+ : message is NotificationMessage
+ ? 'An error occurred while handling ${message.method} notification'
+ : 'Unknown message type';
+ sendErrorResponse(
+ message,
+ ResponseError(
+ code: ServerErrorCodes.UnhandledError,
+ message: errorMessage,
+ ));
+ logException(errorMessage, error, stackTrace);
+ }
}, socketError);
}
@@ -623,6 +621,7 @@
final bool closingLabels;
final bool outline;
final bool flutterOutline;
+
LspInitializationOptions(dynamic options)
: onlyAnalyzeProjectsWithOpenFiles = options != null &&
options['onlyAnalyzeProjectsWithOpenFiles'] == true,
diff --git a/pkg/analysis_server/lib/src/operation/operation_analysis.dart b/pkg/analysis_server/lib/src/operation/operation_analysis.dart
index 7890009..feb124f 100644
--- a/pkg/analysis_server/lib/src/operation/operation_analysis.dart
+++ b/pkg/analysis_server/lib/src/operation/operation_analysis.dart
@@ -165,13 +165,11 @@
/// Runs the given notification producing function [f], catching exceptions.
void _sendNotification(AnalysisServer server, Function() f) {
- ServerPerformanceStatistics.notices.makeCurrentWhile(() {
- try {
- f();
- } catch (exception, stackTrace) {
- AnalysisEngine.instance.instrumentationService.logException(
- CaughtException.withMessage(
- 'Failed to send notification', exception, stackTrace));
- }
- });
+ try {
+ f();
+ } catch (exception, stackTrace) {
+ AnalysisEngine.instance.instrumentationService.logException(
+ CaughtException.withMessage(
+ 'Failed to send notification', exception, stackTrace));
+ }
}
diff --git a/pkg/analysis_server/lib/src/status/diagnostics.dart b/pkg/analysis_server/lib/src/status/diagnostics.dart
index 6c165e4..b99d5c2 100644
--- a/pkg/analysis_server/lib/src/status/diagnostics.dart
+++ b/pkg/analysis_server/lib/src/status/diagnostics.dart
@@ -29,9 +29,6 @@
import 'package:analyzer/src/dartdoc/dartdoc_directive_info.dart';
import 'package:analyzer/src/generated/engine.dart';
import 'package:analyzer/src/generated/source.dart';
-import 'package:analyzer/src/generated/utilities_general.dart';
-import 'package:analyzer/src/lint/registry.dart';
-import 'package:analyzer/src/services/lint.dart';
import 'package:analyzer/src/source/package_map_resolver.dart';
import 'package:path/path.dart' as path;
@@ -142,10 +139,6 @@
}
''';
-/// TODO(devoncarew): We're not currently tracking the time spent in specific
-/// lints by default (analysisOptions / driverOptions enableTiming)
-final bool _showLints = false;
-
String get _sdkVersion {
var version = Platform.version;
if (version.contains(' ')) {
@@ -773,7 +766,6 @@
pages.add(EnvironmentVariablesPage(this));
pages.add(ExceptionsPage(this));
//pages.add(new InstrumentationPage(this));
- pages.add(ProfilePage(this));
// Add server-specific pages. Ordering doesn't matter as the items are
// sorted later.
@@ -1270,106 +1262,6 @@
}
}
-class ProfilePage extends DiagnosticPageWithNav {
- ProfilePage(DiagnosticsSite site)
- : super(site, 'profile', 'Profiling Info',
- description: 'Profiling performance tag data.');
-
- @override
- Future generateContent(Map<String, String> params) async {
- h3('Profiling performance tag data');
-
- // prepare sorted tags
- var tags = PerformanceTag.all.toList();
- tags.remove(ServerPerformanceStatistics.idle);
- tags.remove(PerformanceTag.unknown);
- tags.removeWhere((tag) => tag.elapsedMs == 0);
- tags.sort((a, b) => b.elapsedMs - a.elapsedMs);
-
- // print total time
- var totalTime =
- tags.fold<int>(0, (int a, PerformanceTag tag) => a + tag.elapsedMs);
- p('Total measured time: ${printMilliseconds(totalTime)}');
-
- // draw a pie chart
- var rowData =
- tags.map((tag) => "['${tag.label}', ${tag.elapsedMs}]").join(',');
- buf.writeln(
- '<div id="chart-div" style="width: 700px; height: 300px;"></div>');
- buf.writeln('''
- <script type="text/javascript">
- google.charts.load('current', {'packages':['corechart']});
- google.charts.setOnLoadCallback(drawChart);
-
- function drawChart() {
- var data = new google.visualization.DataTable();
- data.addColumn('string', 'Tag');
- data.addColumn('number', 'Time (ms)');
- data.addRows([$rowData]);
- var options = {'title': 'Performance Tag Data', 'width': 700, 'height': 300};
- var chart = new google.visualization.PieChart(document.getElementById('chart-div'));
- chart.draw(data, options);
- }
- </script>
-''');
-
- // write out a table
- void _writeRow(List<String> data, {bool header = false}) {
- buf.write('<tr>');
- if (header) {
- for (var d in data) {
- buf.write('<th>$d</th>');
- }
- } else {
- buf.write('<td>${data[0]}</td>');
-
- for (var d in data.sublist(1)) {
- buf.write('<td class="right">$d</td>');
- }
- }
- buf.writeln('</tr>');
- }
-
- buf.write('<table>');
- _writeRow(['Tag name', 'Time (in ms)', 'Percent'], header: true);
- void writeRow(PerformanceTag tag) {
- var percent = tag.elapsedMs / totalTime;
- _writeRow([
- tag.label,
- printMilliseconds(tag.elapsedMs),
- printPercentage(percent)
- ]);
- }
-
- tags.forEach(writeRow);
- buf.write('</table>');
-
- if (_showLints) {
- h3('Lint rule timings');
- var rules = Registry.ruleRegistry.rules.toList();
- var totalLintTime = rules.fold(0,
- (sum, rule) => sum + lintRegistry.getTimer(rule).elapsedMilliseconds);
- p('Total time spent in lints: ${printMilliseconds(totalLintTime)}');
-
- rules.sort((first, second) {
- var firstTime = lintRegistry.getTimer(first).elapsedMilliseconds;
- var secondTime = lintRegistry.getTimer(second).elapsedMilliseconds;
- if (firstTime == secondTime) {
- return first.name.compareTo(second.name);
- }
- return secondTime - firstTime;
- });
- buf.write('<table>');
- _writeRow(['Lint code', 'Time (in ms)'], header: true);
- for (var rule in rules) {
- var time = lintRegistry.getTimer(rule).elapsedMilliseconds;
- _writeRow([rule.name, printMilliseconds(time)]);
- }
- buf.write('</table>');
- }
- }
-}
-
class StatusPage extends DiagnosticPageWithNav {
StatusPage(DiagnosticsSite site)
: super(site, 'status', 'Status',
diff --git a/pkg/analyzer/lib/src/dart/analysis/driver.dart b/pkg/analyzer/lib/src/dart/analysis/driver.dart
index 94b9332..84ad8a2 100644
--- a/pkg/analyzer/lib/src/dart/analysis/driver.dart
+++ b/pkg/analyzer/lib/src/dart/analysis/driver.dart
@@ -34,14 +34,8 @@
import 'package:analyzer/src/diagnostic/diagnostic.dart';
import 'package:analyzer/src/error/codes.dart';
import 'package:analyzer/src/generated/engine.dart'
- show
- AnalysisContext,
- AnalysisEngine,
- AnalysisOptions,
- AnalysisOptionsImpl,
- PerformanceStatistics;
+ show AnalysisContext, AnalysisEngine, AnalysisOptions, AnalysisOptionsImpl;
import 'package:analyzer/src/generated/source.dart';
-import 'package:analyzer/src/generated/utilities_general.dart';
import 'package:analyzer/src/lint/registry.dart' as linter;
import 'package:analyzer/src/summary/api_signature.dart';
import 'package:analyzer/src/summary/format.dart';
@@ -1259,9 +1253,7 @@
// If we don't need the fully resolved unit, check for the cached result.
if (!withUnit) {
- List<int> bytes = DriverPerformance.cache.makeCurrentWhile(() {
- return _byteStore.get(key);
- });
+ List<int> bytes = _byteStore.get(key);
if (bytes != null) {
return _getAnalysisResultFromBytes(file, signature, bytes);
}
@@ -2040,13 +2032,6 @@
errors);
}
-class DriverPerformance {
- static final PerformanceTag driver =
- PerformanceStatistics.analyzer.createChild('driver');
-
- static final PerformanceTag cache = driver.createChild('cache');
-}
-
/// An object that watches for the creation and removal of analysis drivers.
///
/// Clients may not extend, implement or mix-in this class.
diff --git a/pkg/analyzer/lib/src/dart/analysis/file_state.dart b/pkg/analyzer/lib/src/dart/analysis/file_state.dart
index 1a6d0f1..5b3bac5 100644
--- a/pkg/analyzer/lib/src/dart/analysis/file_state.dart
+++ b/pkg/analyzer/lib/src/dart/analysis/file_state.dart
@@ -337,9 +337,7 @@
CompilationUnit parse([AnalysisErrorListener errorListener]) {
errorListener ??= AnalysisErrorListener.NULL_LISTENER;
try {
- return PerformanceStatistics.parse.makeCurrentWhile(() {
- return _parse(errorListener);
- });
+ return _parse(errorListener);
} catch (_) {
return _createEmptyCompilationUnit();
}
@@ -566,9 +564,7 @@
_packageLanguageVersion,
),
);
- Token token = PerformanceStatistics.scan.makeCurrentWhile(() {
- return scanner.tokenize(reportScannerErrors: false);
- });
+ Token token = scanner.tokenize(reportScannerErrors: false);
LineInfo lineInfo = LineInfo(scanner.lineStarts);
bool useFasta = analysisOptions.useFastaParser;
diff --git a/pkg/analyzer/lib/src/dart/analysis/library_analyzer.dart b/pkg/analyzer/lib/src/dart/analysis/library_analyzer.dart
index 1e14234..d49ac6d 100644
--- a/pkg/analyzer/lib/src/dart/analysis/library_analyzer.dart
+++ b/pkg/analyzer/lib/src/dart/analysis/library_analyzer.dart
@@ -102,9 +102,7 @@
/// Compute analysis results for all units of the library.
Map<FileState, UnitAnalysisResult> analyze() {
- return PerformanceStatistics.analysis.makeCurrentWhile(() {
- return analyzeSync();
- });
+ return analyzeSync();
}
/// Compute analysis results for all units of the library.
@@ -142,41 +140,35 @@
timerLibraryAnalyzerConst.stop();
timerLibraryAnalyzerVerify.start();
- PerformanceStatistics.errors.makeCurrentWhile(() {
- units.forEach((file, unit) {
- _computeVerifyErrors(file, unit);
- });
+ units.forEach((file, unit) {
+ _computeVerifyErrors(file, unit);
});
if (_analysisOptions.hint) {
- PerformanceStatistics.hints.makeCurrentWhile(() {
- units.forEach((file, unit) {
- {
- var visitor = GatherUsedLocalElementsVisitor(_libraryElement);
- unit.accept(visitor);
- _usedLocalElementsList.add(visitor.usedElements);
- }
- {
- var visitor = GatherUsedImportedElementsVisitor(_libraryElement);
- unit.accept(visitor);
- _usedImportedElementsList.add(visitor.usedElements);
- }
- });
- units.forEach((file, unit) {
- _computeHints(file, unit);
- });
+ units.forEach((file, unit) {
+ {
+ var visitor = GatherUsedLocalElementsVisitor(_libraryElement);
+ unit.accept(visitor);
+ _usedLocalElementsList.add(visitor.usedElements);
+ }
+ {
+ var visitor = GatherUsedImportedElementsVisitor(_libraryElement);
+ unit.accept(visitor);
+ _usedImportedElementsList.add(visitor.usedElements);
+ }
+ });
+ units.forEach((file, unit) {
+ _computeHints(file, unit);
});
}
if (_analysisOptions.lint) {
- PerformanceStatistics.lints.makeCurrentWhile(() {
- var allUnits = _library.libraryFiles
- .map((file) => LinterContextUnit(file.content, units[file]))
- .toList();
- for (int i = 0; i < allUnits.length; i++) {
- _computeLints(_library.libraryFiles[i], allUnits[i], allUnits);
- }
- });
+ var allUnits = _library.libraryFiles
+ .map((file) => LinterContextUnit(file.content, units[file]))
+ .toList();
+ for (int i = 0; i < allUnits.length; i++) {
+ _computeLints(_library.libraryFiles[i], allUnits[i], allUnits);
+ }
}
assert(units.values.every(LegacyTypeAsserter.assertLegacyTypes));
diff --git a/pkg/analyzer/lib/src/dart/micro/library_graph.dart b/pkg/analyzer/lib/src/dart/micro/library_graph.dart
index 4b532b3..d7e63f2 100644
--- a/pkg/analyzer/lib/src/dart/micro/library_graph.dart
+++ b/pkg/analyzer/lib/src/dart/micro/library_graph.dart
@@ -144,9 +144,7 @@
featureSetForOverriding: featureSet,
featureSet: featureSet,
);
- Token token = PerformanceStatistics.scan.makeCurrentWhile(() {
- return scanner.tokenize(reportScannerErrors: false);
- });
+ Token token = scanner.tokenize(reportScannerErrors: false);
LineInfo lineInfo = LineInfo(scanner.lineStarts);
bool useFasta = analysisOptions.useFastaParser;
diff --git a/pkg/analyzer/lib/src/generated/engine.dart b/pkg/analyzer/lib/src/generated/engine.dart
index 7907567..4cb7d34 100644
--- a/pkg/analyzer/lib/src/generated/engine.dart
+++ b/pkg/analyzer/lib/src/generated/engine.dart
@@ -16,7 +16,6 @@
import 'package:analyzer/src/generated/constant.dart';
import 'package:analyzer/src/generated/java_engine.dart';
import 'package:analyzer/src/generated/source.dart';
-import 'package:analyzer/src/generated/utilities_general.dart';
import 'package:analyzer/src/services/lint.dart';
import 'package:analyzer/src/summary/api_signature.dart';
import 'package:path/path.dart' as pathos;
@@ -862,39 +861,3 @@
@deprecated
static bool _analyzeNoFunctionBodies(Source _) => false;
}
-
-/// Container with global [AnalysisContext] performance statistics.
-class PerformanceStatistics {
- /// The [PerformanceTag] for `package:analyzer`.
- static PerformanceTag analyzer = PerformanceTag('analyzer');
-
- /// The [PerformanceTag] for time spent in reading files.
- static PerformanceTag io = analyzer.createChild('io');
-
- /// The [PerformanceTag] for general phases of analysis.
- static PerformanceTag analysis = analyzer.createChild('analysis');
-
- /// The [PerformanceTag] for time spent in scanning.
- static PerformanceTag scan = analyzer.createChild('scan');
-
- /// The [PerformanceTag] for time spent in parsing.
- static PerformanceTag parse = analyzer.createChild('parse');
-
- /// The [PerformanceTag] for time spent in resolving.
- static PerformanceTag resolve = PerformanceTag('resolve');
-
- /// The [PerformanceTag] for time spent in error verifier.
- static PerformanceTag errors = analysis.createChild('errors');
-
- /// The [PerformanceTag] for time spent in hints generator.
- static PerformanceTag hints = analysis.createChild('hints');
-
- /// The [PerformanceTag] for time spent in linting.
- static PerformanceTag lints = analysis.createChild('lints');
-
- /// The [PerformanceTag] for time spent computing cycles.
- static PerformanceTag cycles = PerformanceTag('cycles');
-
- /// The [PerformanceTag] for time spent in summaries support.
- static PerformanceTag summary = analyzer.createChild('summary');
-}
diff --git a/pkg/analyzer/lib/src/generated/error_verifier.dart b/pkg/analyzer/lib/src/generated/error_verifier.dart
index 1576546..512d356 100644
--- a/pkg/analyzer/lib/src/generated/error_verifier.dart
+++ b/pkg/analyzer/lib/src/generated/error_verifier.dart
@@ -39,6 +39,7 @@
import 'package:analyzer/src/generated/java_engine.dart';
import 'package:analyzer/src/generated/parser.dart' show ParserErrorCode;
import 'package:analyzer/src/generated/sdk.dart' show DartSdk, SdkLibrary;
+import 'package:analyzer/src/generated/this_access_tracker.dart';
import 'package:analyzer/src/task/strong/checker.dart';
import 'package:meta/meta.dart';
@@ -194,6 +195,9 @@
/// in the scope of an extension.
ExtensionElement _enclosingExtension;
+ /// The helper for tracking if the current location has access to `this`.
+ final ThisAccessTracker _thisAccessTracker = ThisAccessTracker.unit();
+
/// The context of the method or function that we are currently visiting, or
/// `null` if we are not inside a method or function.
EnclosingExecutableContext _enclosingExecutable =
@@ -366,6 +370,16 @@
}
@override
+ void visitBlockFunctionBody(BlockFunctionBody node) {
+ _thisAccessTracker.enterFunctionBody(node);
+ try {
+ super.visitBlockFunctionBody(node);
+ } finally {
+ _thisAccessTracker.exitFunctionBody(node);
+ }
+ }
+
+ @override
void visitBreakStatement(BreakStatement node) {
SimpleIdentifier labelNode = node.label;
if (labelNode != null) {
@@ -546,8 +560,13 @@
@override
void visitExpressionFunctionBody(ExpressionFunctionBody node) {
- _returnTypeVerifier.verifyExpressionFunctionBody(node);
- super.visitExpressionFunctionBody(node);
+ _thisAccessTracker.enterFunctionBody(node);
+ try {
+ _returnTypeVerifier.verifyExpressionFunctionBody(node);
+ super.visitExpressionFunctionBody(node);
+ } finally {
+ _thisAccessTracker.exitFunctionBody(node);
+ }
}
@override
@@ -574,6 +593,7 @@
@override
void visitFieldDeclaration(FieldDeclaration node) {
var fields = node.fields;
+ _thisAccessTracker.enterFieldDeclaration(node);
_isInStaticVariableDeclaration = node.isStatic;
_isInInstanceNotLateVariableDeclaration =
!node.isStatic && !node.fields.isLate;
@@ -591,6 +611,7 @@
} finally {
_isInStaticVariableDeclaration = false;
_isInInstanceNotLateVariableDeclaration = false;
+ _thisAccessTracker.exitFieldDeclaration(node);
}
}
@@ -2976,7 +2997,7 @@
///
/// See [CompileTimeErrorCode.INVALID_REFERENCE_TO_THIS].
void _checkForInvalidReferenceToThis(ThisExpression expression) {
- if (!_isThisInValidContext(expression)) {
+ if (!_thisAccessTracker.hasAccess) {
_errorReporter.reportErrorForNode(
CompileTimeErrorCode.INVALID_REFERENCE_TO_THIS, expression);
}
@@ -5161,29 +5182,6 @@
return false;
}
- /// Return `true` if the given 'this' [expression] is in a valid context.
- bool _isThisInValidContext(ThisExpression expression) {
- for (AstNode node = expression.parent; node != null; node = node.parent) {
- if (node is CompilationUnit) {
- return false;
- } else if (node is ConstructorDeclaration) {
- return node.factoryKeyword == null;
- } else if (node is ConstructorInitializer) {
- return false;
- } else if (node is MethodDeclaration) {
- return !node.isStatic;
- } else if (node is FieldDeclaration) {
- if (node.fields.isLate &&
- (node.parent is ClassDeclaration ||
- node.parent is MixinDeclaration)) {
- return true;
- }
- // Continue; a non-late variable may still occur in a valid context.
- }
- }
- return false;
- }
-
/// Return `true` if the given [identifier] is in a location where it is
/// allowed to resolve to a static member of a supertype.
bool _isUnqualifiedReferenceToNonLocalStaticMemberAllowed(
diff --git a/pkg/analyzer/lib/src/generated/source_io.dart b/pkg/analyzer/lib/src/generated/source_io.dart
index 105c95a..533bc34 100644
--- a/pkg/analyzer/lib/src/generated/source_io.dart
+++ b/pkg/analyzer/lib/src/generated/source_io.dart
@@ -91,9 +91,7 @@
@override
TimestampedData<String> get contents {
- return PerformanceStatistics.io.makeCurrentWhile(() {
- return contentsFromFile;
- });
+ return contentsFromFile;
}
/// Get the contents and timestamp of the underlying file.
diff --git a/pkg/analyzer/lib/src/generated/this_access_tracker.dart b/pkg/analyzer/lib/src/generated/this_access_tracker.dart
new file mode 100644
index 0000000..7fdb8d3
--- /dev/null
+++ b/pkg/analyzer/lib/src/generated/this_access_tracker.dart
@@ -0,0 +1,45 @@
+// Copyright (c) 2020, the Dart project authors. Please see the AUTHORS file
+// for details. All rights reserved. Use of this source code is governed by a
+// BSD-style license that can be found in the LICENSE file.
+
+import 'package:analyzer/dart/ast/ast.dart';
+
+/// Tracks if the current location has access to `this`.
+///
+/// The current instance (and hence its members) can only be accessed at
+/// specific locations in a class: We say that a location `l` has access to
+/// `this` iff `l` is inside the body of a declaration of an instance member,
+/// or a generative constructor, or in the initializing expression of a `late`
+/// instance variable declaration.
+class ThisAccessTracker {
+ final List<bool> _stack = [];
+
+ ThisAccessTracker.unit() {
+ _stack.add(false);
+ }
+
+ bool get hasAccess => _stack.last;
+
+ void enterFieldDeclaration(FieldDeclaration node) {
+ _stack.add(!node.isStatic && node.fields.isLate);
+ }
+
+ void enterFunctionBody(FunctionBody node) {
+ var parent = node.parent;
+ if (parent is ConstructorDeclaration) {
+ _stack.add(parent.factoryKeyword == null);
+ } else if (parent is MethodDeclaration) {
+ _stack.add(!parent.isStatic);
+ } else {
+ _stack.add(_stack.last);
+ }
+ }
+
+ void exitFieldDeclaration(FieldDeclaration node) {
+ _stack.removeLast();
+ }
+
+ void exitFunctionBody(FunctionBody node) {
+ _stack.removeLast();
+ }
+}
diff --git a/pkg/analyzer/lib/src/generated/utilities_general.dart b/pkg/analyzer/lib/src/generated/utilities_general.dart
index 4eb59de..cbbbaa9 100644
--- a/pkg/analyzer/lib/src/generated/utilities_general.dart
+++ b/pkg/analyzer/lib/src/generated/utilities_general.dart
@@ -2,9 +2,7 @@
// for details. All rights reserved. Use of this source code is governed by a
// BSD-style license that can be found in the LICENSE file.
-import 'dart:async';
import 'dart:collection';
-import 'dart:developer' show UserTag;
import 'package:yaml/yaml.dart';
@@ -111,121 +109,3 @@
}
}
}
-
-/// Helper class for gathering performance statistics. This class is modeled on
-/// the UserTag class in dart:developer so that it can interoperate easily with
-/// it.
-abstract class PerformanceTag {
- /// Return a list of all [PerformanceTag]s which have been created.
- static List<PerformanceTag> get all => _PerformanceTagImpl.all.toList();
-
- /// Return the current [PerformanceTag] for the isolate.
- static PerformanceTag get current => _PerformanceTagImpl.current;
-
- /// Return the [PerformanceTag] that is initially current. This is intended
- /// to track time when the system is performing unknown operations.
- static PerformanceTag get unknown => _PerformanceTagImpl.unknown;
-
- /// Create a [PerformanceTag] having the given [label]. A [UserTag] will also
- /// be created, having the same [label], so that performance information can
- /// be queried using the observatory.
- factory PerformanceTag(String label) = _PerformanceTagImpl;
-
- /// Return the total number of milliseconds that this [PerformanceTag] has
- /// been the current [PerformanceTag] for the isolate.
- ///
- /// This call is safe even if this [PerformanceTag] is current.
- int get elapsedMs;
-
- /// Return the label for this [PerformanceTag].
- String get label;
-
- /// Create a child tag of the current tag. The new tag's name will include the
- /// parent's name.
- PerformanceTag createChild(String childTagName);
-
- /// Make this the current tag for the isolate, and return the previous tag.
- PerformanceTag makeCurrent();
-
- /// Make this the current tag for the isolate, run [f], and restore the
- /// previous tag. Returns the result of invoking [f].
- E makeCurrentWhile<E>(E Function() f);
-
- /// Make this the current tag for the isolate, run [f], and restore the
- /// previous tag. Returns the result of invoking [f].
- Future<E> makeCurrentWhileAsync<E>(Future<E> Function() f);
-
- /// Reset the total time tracked by all [PerformanceTag]s to zero.
- static void reset() {
- for (_PerformanceTagImpl tag in _PerformanceTagImpl.all) {
- tag.stopwatch.reset();
- }
- }
-}
-
-class _PerformanceTagImpl implements PerformanceTag {
- /// The current performance tag for the isolate.
- static _PerformanceTagImpl current = unknown;
-
- static final _PerformanceTagImpl unknown = _PerformanceTagImpl('unknown');
-
- /// A list of all performance tags that have been created so far.
- static List<_PerformanceTagImpl> all = <_PerformanceTagImpl>[];
-
- /// The [UserTag] associated with this [PerformanceTag].
- final UserTag userTag;
-
- /// Stopwatch tracking the amount of time this [PerformanceTag] has been the
- /// current tag for the isolate.
- final Stopwatch stopwatch;
-
- _PerformanceTagImpl(String label)
- : userTag = UserTag(label),
- stopwatch = Stopwatch() {
- all.add(this);
- }
-
- @override
- int get elapsedMs => stopwatch.elapsedMilliseconds;
-
- @override
- String get label => userTag.label;
-
- @override
- PerformanceTag createChild(String childTagName) {
- return _PerformanceTagImpl('$label.$childTagName');
- }
-
- @override
- PerformanceTag makeCurrent() {
- if (identical(this, current)) {
- return current;
- }
- _PerformanceTagImpl previous = current;
- previous.stopwatch.stop();
- stopwatch.start();
- current = this;
- userTag.makeCurrent();
- return previous;
- }
-
- @override
- E makeCurrentWhile<E>(E Function() f) {
- PerformanceTag prevTag = makeCurrent();
- try {
- return f();
- } finally {
- prevTag.makeCurrent();
- }
- }
-
- @override
- Future<E> makeCurrentWhileAsync<E>(Future<E> Function() f) async {
- PerformanceTag prevTag = makeCurrent();
- try {
- return await f();
- } finally {
- prevTag.makeCurrent();
- }
- }
-}
diff --git a/pkg/analyzer/lib/src/source/source_resource.dart b/pkg/analyzer/lib/src/source/source_resource.dart
index 39ef8c3..d835a11 100644
--- a/pkg/analyzer/lib/src/source/source_resource.dart
+++ b/pkg/analyzer/lib/src/source/source_resource.dart
@@ -52,9 +52,7 @@
@override
TimestampedData<String> get contents {
- return PerformanceStatistics.io.makeCurrentWhile(() {
- return contentsFromFile;
- });
+ return contentsFromFile;
}
/// Get and return the contents and timestamp of the underlying file.
diff --git a/pkg/analyzer/test/src/diagnostics/invalid_reference_to_this_test.dart b/pkg/analyzer/test/src/diagnostics/invalid_reference_to_this_test.dart
index 48725a2..d565790 100644
--- a/pkg/analyzer/test/src/diagnostics/invalid_reference_to_this_test.dart
+++ b/pkg/analyzer/test/src/diagnostics/invalid_reference_to_this_test.dart
@@ -16,7 +16,7 @@
@reflectiveTest
class InvalidReferenceToThisTest extends PubPackageResolutionTest {
- test_constructor_valid() async {
+ test_class_constructor() async {
await assertErrorsInCode(r'''
class A {
A() {
@@ -28,7 +28,7 @@
]);
}
- test_factoryConstructor() async {
+ test_class_factoryConstructor() async {
await assertErrorsInCode(r'''
class A {
factory A() { return this; }
@@ -38,19 +38,17 @@
]);
}
- test_instanceMethod_valid() async {
- await assertErrorsInCode(r'''
+ test_class_instanceMethod() async {
+ await assertNoErrorsInCode(r'''
class A {
- m() {
- var v = this;
+ void foo() {
+ this;
}
}
-''', [
- error(HintCode.UNUSED_LOCAL_VARIABLE, 26, 1),
- ]);
+''');
}
- test_instanceVariableInitializer_inConstructor() async {
+ test_class_instanceVariableInitializer_inConstructor() async {
await assertErrorsInCode(r'''
class A {
var f;
@@ -61,7 +59,7 @@
]);
}
- test_instanceVariableInitializer_inDeclaration() async {
+ test_class_instanceVariableInitializer_inDeclaration() async {
await assertErrorsInCode(r'''
class A {
var f = this;
@@ -71,7 +69,7 @@
]);
}
- test_staticMethod() async {
+ test_class_staticMethod() async {
await assertErrorsInCode(r'''
class A {
static m() { return this; }
@@ -81,7 +79,7 @@
]);
}
- test_staticVariableInitializer() async {
+ test_class_staticVariableInitializer() async {
await assertErrorsInCode(r'''
class A {
static A f = this;
@@ -91,7 +89,7 @@
]);
}
- test_superInitializer() async {
+ test_class_superInitializer() async {
await assertErrorsInCode(r'''
class A {
A(var x) {}
@@ -112,25 +110,13 @@
]);
}
- test_variableInitializer() async {
+ test_topLevelVariable() async {
await assertErrorsInCode('''
int x = this;
''', [
error(CompileTimeErrorCode.INVALID_REFERENCE_TO_THIS, 8, 4),
]);
}
-
- test_variableInitializer_inMethod_notLate() async {
- await assertErrorsInCode(r'''
-class A {
- f() {
- var r = this;
- }
-}
-''', [
- error(HintCode.UNUSED_LOCAL_VARIABLE, 26, 1),
- ]);
- }
}
@reflectiveTest
diff --git a/pkg/analyzer_cli/lib/src/analyzer_impl.dart b/pkg/analyzer_cli/lib/src/analyzer_impl.dart
index e72299a..2f6c5ae 100644
--- a/pkg/analyzer_cli/lib/src/analyzer_impl.dart
+++ b/pkg/analyzer_cli/lib/src/analyzer_impl.dart
@@ -14,7 +14,6 @@
import 'package:analyzer/src/generated/engine.dart';
import 'package:analyzer/src/generated/source.dart';
import 'package:analyzer/src/generated/source_io.dart';
-import 'package:analyzer/src/generated/utilities_general.dart';
import 'package:analyzer_cli/src/driver.dart';
import 'package:analyzer_cli/src/error_formatter.dart';
import 'package:analyzer_cli/src/error_severity.dart';
@@ -25,11 +24,6 @@
/// Analyzes single library [File].
class AnalyzerImpl {
- static final PerformanceTag _prepareErrorsTag =
- PerformanceTag('AnalyzerImpl.prepareErrors');
- static final PerformanceTag _resolveLibraryTag =
- PerformanceTag('AnalyzerImpl._resolveLibrary');
-
final CommandLineOptions options;
final int startTime;
@@ -123,14 +117,9 @@
Future<void> prepareErrors() async {
// TODO(brianwilkerson) Determine whether this await is necessary.
await null;
- var previous = _prepareErrorsTag.makeCurrent();
- try {
- for (var path in files) {
- var errorsResult = await analysisDriver.getErrors(path);
- errorsResults.add(errorsResult);
- }
- } finally {
- previous.makeCurrent();
+ for (var path in files) {
+ var errorsResult = await analysisDriver.getErrors(path);
+ errorsResults.add(errorsResult);
}
}
@@ -218,30 +207,17 @@
void _printColdPerf() {
// Print cold VM performance numbers.
var totalTime = currentTimeMillis - startTime;
- var otherTime = totalTime;
- for (var tag in PerformanceTag.all) {
- if (tag != PerformanceTag.unknown) {
- var tagTime = tag.elapsedMs;
- outSink.writeln('${tag.label}-cold:$tagTime');
- otherTime -= tagTime;
- }
- }
- outSink.writeln('other-cold:$otherTime');
outSink.writeln('total-cold:$totalTime');
}
Future<LibraryElement> _resolveLibrary() async {
// TODO(brianwilkerson) Determine whether this await is necessary.
await null;
- var previous = _resolveLibraryTag.makeCurrent();
- try {
- var libraryPath = libraryFile.path;
- analysisDriver.priorityFiles = [libraryPath];
- var elementResult = await analysisDriver.getUnitElement(libraryPath);
- return elementResult.element.library;
- } finally {
- previous.makeCurrent();
- }
+
+ var libraryPath = libraryFile.path;
+ analysisDriver.priorityFiles = [libraryPath];
+ var elementResult = await analysisDriver.getUnitElement(libraryPath);
+ return elementResult.element.library;
}
/// Return `true` if the given [pathName] is in the Pub cache.
diff --git a/pkg/analyzer_cli/lib/src/driver.dart b/pkg/analyzer_cli/lib/src/driver.dart
index 702c73a..8fec998 100644
--- a/pkg/analyzer_cli/lib/src/driver.dart
+++ b/pkg/analyzer_cli/lib/src/driver.dart
@@ -28,8 +28,6 @@
import 'package:analyzer/src/generated/java_engine.dart';
import 'package:analyzer/src/generated/sdk.dart';
import 'package:analyzer/src/generated/source.dart';
-import 'package:analyzer/src/generated/utilities_general.dart'
- show PerformanceTag;
import 'package:analyzer/src/manifest/manifest_validator.dart';
import 'package:analyzer/src/pubspec/pubspec_validator.dart';
import 'package:analyzer/src/source/package_map_resolver.dart';
@@ -68,9 +66,6 @@
}
class Driver with HasContextMixin implements CommandLineStarter {
- static final PerformanceTag _analyzeAllTag =
- PerformanceTag('Driver._analyzeAll');
-
static final ByteStore analysisDriverMemoryByteStore = MemoryByteStore();
@override
@@ -184,12 +179,8 @@
Future<ErrorSeverity> _analyzeAll(CommandLineOptions options) async {
// TODO(brianwilkerson) Determine whether this await is necessary.
await null;
- var previous = _analyzeAllTag.makeCurrent();
- try {
- return await _analyzeAllImpl(options);
- } finally {
- previous.makeCurrent();
- }
+
+ return await _analyzeAllImpl(options);
}
/// Perform analysis according to the given [options].
@@ -392,23 +383,19 @@
CommandLineOptions options, SendPort sendPort) async {
// TODO(brianwilkerson) Determine whether this await is necessary.
await null;
- var previous = _analyzeAllTag.makeCurrent();
- try {
- if (options.buildModePersistentWorker) {
- var workerLoop = sendPort == null
- ? AnalyzerWorkerLoop.std(resourceProvider,
- dartSdkPath: options.dartSdkPath)
- : AnalyzerWorkerLoop.sendPort(resourceProvider, sendPort,
- dartSdkPath: options.dartSdkPath);
- await workerLoop.run();
- return ErrorSeverity.NONE;
- } else {
- return await BuildMode(resourceProvider, options, stats,
- ContextCache(resourceProvider, options, verbosePrint))
- .analyze();
- }
- } finally {
- previous.makeCurrent();
+
+ if (options.buildModePersistentWorker) {
+ var workerLoop = sendPort == null
+ ? AnalyzerWorkerLoop.std(resourceProvider,
+ dartSdkPath: options.dartSdkPath)
+ : AnalyzerWorkerLoop.sendPort(resourceProvider, sendPort,
+ dartSdkPath: options.dartSdkPath);
+ await workerLoop.run();
+ return ErrorSeverity.NONE;
+ } else {
+ return await BuildMode(resourceProvider, options, stats,
+ ContextCache(resourceProvider, options, verbosePrint))
+ .analyze();
}
}
diff --git a/pkg/analyzer_cli/lib/src/perf_report.dart b/pkg/analyzer_cli/lib/src/perf_report.dart
index 95c1efc..9f865d3 100644
--- a/pkg/analyzer_cli/lib/src/perf_report.dart
+++ b/pkg/analyzer_cli/lib/src/perf_report.dart
@@ -5,8 +5,6 @@
import 'dart:convert' show JsonEncoder;
import 'dart:io' show Platform;
-import 'package:analyzer/src/generated/utilities_general.dart'
- show PerformanceTag;
import 'package:analyzer_cli/src/error_formatter.dart';
import 'package:analyzer_cli/src/options.dart' show CommandLineOptions;
@@ -29,7 +27,6 @@
String makePerfReport(int startTime, int endTime, CommandLineOptions options,
int analyzedFileCount, AnalysisStats stats) {
var totalTime = endTime - startTime;
- var otherTime = totalTime;
var platformJson = <String, dynamic>{
'osType': _osType,
@@ -47,17 +44,6 @@
'sourceFiles': options.sourceFiles,
};
- // Convert performance tags to JSON representation.
- var perfTagsJson = <String, dynamic>{};
- for (var tag in PerformanceTag.all) {
- if (tag != PerformanceTag.unknown) {
- var tagTime = tag.elapsedMs;
- perfTagsJson[tag.label] = tagTime;
- otherTime -= tagTime;
- }
- }
- perfTagsJson['other'] = otherTime;
-
var reportJson = <String, dynamic>{
'perfReportVersion': 0,
'platform': platformJson,
@@ -66,7 +52,6 @@
'analyzedFiles': analyzedFileCount,
'generatedDiagnostics': stats.unfilteredCount,
'reportedDiagnostics': stats.filteredCount,
- 'performanceTags': perfTagsJson,
};
return _JSON.convert(reportJson);
diff --git a/tools/VERSION b/tools/VERSION
index 7b5d868..ecfcfb0 100644
--- a/tools/VERSION
+++ b/tools/VERSION
@@ -27,5 +27,5 @@
MAJOR 2
MINOR 10
PATCH 0
-PRERELEASE 34
+PRERELEASE 35
PRERELEASE_PATCH 0
\ No newline at end of file