Skip to content

Commit 2946ea7

Browse files
committed
Macro. Remove more from analyzer/ and analysis_seever/.
Change-Id: Id5426cce73395d3d95657cf1e0b5f9d85fe3f574 Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/406921 Reviewed-by: Brian Wilkerson <[email protected]>
1 parent 38d534e commit 2946ea7

File tree

51 files changed

+16
-708
lines changed

Some content is hidden

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

51 files changed

+16
-708
lines changed

pkg/analysis_server/lib/src/computer/computer_highlights.dart

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -806,7 +806,6 @@ class _DartUnitHighlightsComputerVisitor extends RecursiveAstVisitor<void> {
806806
node.augmentKeyword,
807807
HighlightRegionType.BUILT_IN,
808808
);
809-
computer._addRegion_token(node.macroKeyword, HighlightRegionType.BUILT_IN);
810809
computer._addRegion_token(
811810
node.abstractKeyword,
812811
HighlightRegionType.BUILT_IN,

pkg/analysis_server/lib/src/handler/legacy/edit_get_assists.dart

Lines changed: 0 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,6 @@ import 'package:analysis_server/src/services/correction/assist_internal.dart';
1616
import 'package:analysis_server_plugin/src/correction/dart_change_workspace.dart';
1717
import 'package:analyzer/dart/analysis/session.dart';
1818
import 'package:analyzer/src/exception/exception.dart';
19-
import 'package:analyzer/src/util/file_paths.dart';
2019
import 'package:analyzer_plugin/protocol/protocol_common.dart';
2120
import 'package:analyzer_plugin/protocol/protocol_generated.dart' as plugin;
2221

@@ -45,10 +44,6 @@ class EditGetAssistsHandler extends LegacyHandler
4544
if (server.sendResponseErrorIfInvalidFilePath(request, file)) {
4645
return;
4746
}
48-
if (isMacroGenerated(file)) {
49-
sendResult(EditGetAssistsResult([]));
50-
return;
51-
}
5247
//
5348
// Allow plugins to start computing assists.
5449
//

pkg/analysis_server/lib/src/handler/legacy/edit_get_available_refactorings.dart

Lines changed: 0 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,6 @@ import 'package:analysis_server/src/handler/legacy/legacy_handler.dart';
99
import 'package:analysis_server/src/services/refactoring/legacy/refactoring.dart';
1010
import 'package:analyzer/dart/element/element2.dart';
1111
import 'package:analyzer/src/dart/ast/utilities.dart';
12-
import 'package:analyzer/src/util/file_paths.dart';
1312
import 'package:analyzer_plugin/protocol/protocol_common.dart';
1413

1514
/// The handler for the `edit.getAvailableRefactorings` request.
@@ -36,10 +35,6 @@ class EditGetAvailableRefactoringsHandler extends LegacyHandler {
3635
if (server.sendResponseErrorIfInvalidFilePath(request, file)) {
3736
return;
3837
}
39-
if (isMacroGenerated(file)) {
40-
sendResult(EditGetAvailableRefactoringsResult([]));
41-
return;
42-
}
4338

4439
// add refactoring kinds
4540
var kinds = <RefactoringKind>[];

pkg/analysis_server/lib/src/handler/legacy/edit_get_fixes.dart

Lines changed: 0 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,6 @@ import 'package:analyzer/src/generated/source.dart' show SourceFactory;
2828
import 'package:analyzer/src/pubspec/pubspec_validator.dart';
2929
import 'package:analyzer/src/task/options.dart';
3030
import 'package:analyzer/src/util/file_paths.dart' as file_paths;
31-
import 'package:analyzer/src/util/file_paths.dart';
3231
import 'package:analyzer/src/workspace/pub.dart';
3332
import 'package:analyzer_plugin/protocol/protocol_generated.dart' as plugin;
3433
import 'package:yaml/yaml.dart';
@@ -62,10 +61,6 @@ class EditGetFixesHandler extends LegacyHandler
6261
server.sendResponse(Response.getFixesInvalidFile(request));
6362
return;
6463
}
65-
if (isMacroGenerated(file)) {
66-
sendResult(EditGetFixesResult([]));
67-
return;
68-
}
6964

7065
//
7166
// Allow plugins to start computing fixes.

pkg/analysis_server/lib/src/services/correction/assist_internal.dart

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -80,7 +80,6 @@ import 'package:analysis_server_plugin/src/correction/fix_generators.dart';
8080
import 'package:analyzer/error/error.dart';
8181
import 'package:analyzer/src/dart/ast/utilities.dart';
8282
import 'package:analyzer/src/generated/java_core.dart';
83-
import 'package:analyzer/src/util/file_paths.dart';
8483
import 'package:analyzer_plugin/utilities/assist/assist.dart'
8584
hide AssistContributor;
8685
import 'package:analyzer_plugin/utilities/change_builder/change_builder_core.dart';
@@ -178,9 +177,6 @@ class AssistProcessor {
178177
AssistProcessor(this._assistContext);
179178

180179
Future<List<Assist>> compute() async {
181-
if (isMacroGenerated(_assistContext.unitResult.file.path)) {
182-
return _assists;
183-
}
184180
await _addFromProducers();
185181
return _assists;
186182
}

pkg/analysis_server/lib/src/services/correction/bulk_fix_processor.dart

Lines changed: 6 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -227,9 +227,7 @@ class BulkFixProcessor {
227227
}) async {
228228
var pathContext = context.contextRoot.resourceProvider.pathContext;
229229

230-
if (file_paths.isDart(pathContext, path) &&
231-
!file_paths.isGenerated(path) &&
232-
!file_paths.isMacroGenerated(path)) {
230+
if (file_paths.isDart(pathContext, path) && !file_paths.isGenerated(path)) {
233231
var libraryResult = await performance.runAsync(
234232
'getResolvedLibrary',
235233
(_) => context.currentSession.getResolvedContainingLibrary(path),
@@ -257,8 +255,7 @@ class BulkFixProcessor {
257255
var pathContext = context.contextRoot.resourceProvider.pathContext;
258256
for (var path in context.contextRoot.analyzedFiles()) {
259257
if (!file_paths.isDart(pathContext, path) ||
260-
file_paths.isGenerated(path) ||
261-
file_paths.isMacroGenerated(path)) {
258+
file_paths.isGenerated(path)) {
262259
continue;
263260
}
264261

@@ -397,8 +394,7 @@ class BulkFixProcessor {
397394

398395
for (var path in context.contextRoot.analyzedFiles()) {
399396
if (!file_paths.isDart(pathContext, path) ||
400-
file_paths.isGenerated(path) ||
401-
file_paths.isMacroGenerated(path)) {
397+
file_paths.isGenerated(path)) {
402398
continue;
403399
}
404400
var package = workspace.findPackageFor(path);
@@ -510,8 +506,7 @@ class BulkFixProcessor {
510506
var pathContext = context.contextRoot.resourceProvider.pathContext;
511507
for (var path in context.contextRoot.analyzedFiles()) {
512508
if (!file_paths.isDart(pathContext, path) ||
513-
file_paths.isGenerated(path) ||
514-
file_paths.isMacroGenerated(path)) {
509+
file_paths.isGenerated(path)) {
515510
continue;
516511
}
517512

@@ -831,8 +826,7 @@ class BulkFixProcessor {
831826
for (var path in context.contextRoot.analyzedFiles()) {
832827
var pathContext = context.contextRoot.resourceProvider.pathContext;
833828
if (!file_paths.isDart(pathContext, path) ||
834-
file_paths.isGenerated(path) ||
835-
file_paths.isMacroGenerated(path)) {
829+
file_paths.isGenerated(path)) {
836830
continue;
837831
}
838832
var unitResult =
@@ -905,8 +899,7 @@ class BulkFixProcessor {
905899
for (var path in context.contextRoot.analyzedFiles()) {
906900
var pathContext = context.contextRoot.resourceProvider.pathContext;
907901
if (!file_paths.isDart(pathContext, path) ||
908-
file_paths.isGenerated(path) ||
909-
file_paths.isMacroGenerated(path)) {
902+
file_paths.isGenerated(path)) {
910903
continue;
911904
}
912905
var unitResult =

pkg/analysis_server/lib/src/services/correction/error_fix_status.yaml

Lines changed: 0 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -966,8 +966,6 @@ CompileTimeErrorCode.INVALID_INLINE_FUNCTION_TYPE:
966966
status: needsFix
967967
notes: |-
968968
Replace with the equivalent generic function type.
969-
CompileTimeErrorCode.INVALID_MACRO_APPLICATION_TARGET:
970-
status: noFix
971969
CompileTimeErrorCode.INVALID_MODIFIER_ON_CONSTRUCTOR:
972970
status: hasFix
973971
CompileTimeErrorCode.INVALID_MODIFIER_ON_SETTER:
@@ -1023,18 +1021,6 @@ CompileTimeErrorCode.LIST_ELEMENT_TYPE_NOT_ASSIGNABLE_NULLABILITY:
10231021
status: hasFix
10241022
CompileTimeErrorCode.LIST_ELEMENT_TYPE_NOT_ASSIGNABLE:
10251023
status: needsEvaluation
1026-
CompileTimeErrorCode.MACRO_DECLARATIONS_PHASE_INTROSPECTION_CYCLE:
1027-
status: needsEvaluation
1028-
CompileTimeErrorCode.MACRO_DEFINITION_APPLICATION_SAME_LIBRARY_CYCLE:
1029-
status: noFix
1030-
CompileTimeErrorCode.MACRO_APPLICATION_ARGUMENT_ERROR:
1031-
status: noFix
1032-
CompileTimeErrorCode.MACRO_ERROR:
1033-
status: noFix
1034-
CompileTimeErrorCode.MACRO_INTERNAL_EXCEPTION:
1035-
status: noFix
1036-
CompileTimeErrorCode.MACRO_NOT_ALLOWED_DECLARATION:
1037-
status: noFix
10381024
CompileTimeErrorCode.MAIN_FIRST_POSITIONAL_PARAMETER_TYPE:
10391025
status: needsFix
10401026
notes: |-
@@ -1844,8 +1830,6 @@ HintCode.DEPRECATED_MEMBER_USE_WITH_MESSAGE:
18441830
status: hasFix
18451831
HintCode.IMPORT_DEFERRED_LIBRARY_WITH_LOAD_FUNCTION:
18461832
status: noFix
1847-
HintCode.MACRO_INFO:
1848-
status: noFix
18491833
HintCode.UNNECESSARY_IMPORT:
18501834
status: hasFix
18511835
LintCode.always_declare_return_types_of_functions:
@@ -3644,8 +3628,6 @@ WarningCode.INVALID_VISIBLE_FOR_OVERRIDING_ANNOTATION:
36443628
status: hasFix
36453629
WarningCode.INVALID_VISIBLE_OUTSIDE_TEMPLATE_ANNOTATION:
36463630
status: needsEvaluation
3647-
WarningCode.MACRO_WARNING:
3648-
status: noFix
36493631
WarningCode.MISSING_OVERRIDE_OF_MUST_BE_OVERRIDDEN_ONE:
36503632
status: hasFix
36513633
WarningCode.MISSING_OVERRIDE_OF_MUST_BE_OVERRIDDEN_TWO:

pkg/analysis_server/lib/src/services/refactoring/legacy/convert_getter_to_method.dart

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,6 @@ import 'package:analyzer/dart/ast/ast.dart';
1313
import 'package:analyzer/dart/ast/token.dart';
1414
import 'package:analyzer/dart/element/element2.dart';
1515
import 'package:analyzer/src/dart/analysis/session_helper.dart';
16-
import 'package:analyzer/src/util/file_paths.dart';
1716
import 'package:analyzer_plugin/utilities/range_factory.dart';
1817

1918
/// [ConvertMethodToGetterRefactoring] implementation.
@@ -141,8 +140,6 @@ class ConvertGetterToMethodRefactoringImpl extends RefactoringImpl
141140
var matches = await searchEngine.searchReferences(element);
142141
var references = getSourceReferences(matches);
143142
for (var reference in references) {
144-
// Don't update references in macro-generated files.
145-
if (isMacroGenerated(reference.file)) continue;
146143
var refRange = reference.range;
147144
// insert "()"
148145
var edit = SourceEdit(refRange.end, 0, '()');

pkg/analysis_server/lib/src/services/refactoring/legacy/convert_method_to_getter.dart

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,6 @@ import 'package:analyzer/dart/element/element2.dart';
1414
import 'package:analyzer/dart/element/type.dart';
1515
import 'package:analyzer/src/dart/analysis/session_helper.dart';
1616
import 'package:analyzer/src/dart/ast/utilities.dart';
17-
import 'package:analyzer/src/util/file_paths.dart';
1817
import 'package:analyzer_plugin/utilities/range_factory.dart';
1918

2019
/// [ConvertMethodToGetterRefactoring] implementation.
@@ -141,9 +140,6 @@ class ConvertMethodToGetterRefactoringImpl extends RefactoringImpl
141140
var matches = await searchEngine.searchReferences(element);
142141
var references = getSourceReferences(matches);
143142
for (var reference in references) {
144-
// Don't update references in macro-generated files.
145-
if (isMacroGenerated(reference.file)) continue;
146-
147143
var refElement = reference.element2;
148144
var refRange = reference.range;
149145
// prepare invocation

pkg/analysis_server/test/edit/bulk_fixes_test.dart

Lines changed: 0 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -377,20 +377,6 @@ linter:
377377
class A {}
378378
//ignore: unnecessary_new
379379
A f() => new A();
380-
''');
381-
await assertNoEdits();
382-
}
383-
384-
Future<void> test_unnecessaryNew_macroGenerated() async {
385-
newAnalysisOptionsYamlFile(testPackageRootPath, '''
386-
linter:
387-
rules:
388-
- unnecessary_new
389-
''');
390-
var macroFilePath = join(testPackageLibPath, 'test.macro.dart');
391-
newFile(macroFilePath, '''
392-
class A {}
393-
A f() => new A();
394380
''');
395381
await assertNoEdits();
396382
}

0 commit comments

Comments
 (0)