Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(8)

Side by Side Diff: pkg/analysis_server/lib/src/operation/operation_analysis.dart

Issue 1941793002: Use null aware operators to clean up code (Closed) Base URL: https://github.com/dart-lang/sdk.git@master
Patch Set: Created 4 years, 7 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
1 // Copyright (c) 2014, the Dart project authors. Please see the AUTHORS file 1 // Copyright (c) 2014, the Dart project authors. Please see the AUTHORS file
2 // for details. All rights reserved. Use of this source code is governed by a 2 // for details. All rights reserved. Use of this source code is governed by a
3 // BSD-style license that can be found in the LICENSE file. 3 // BSD-style license that can be found in the LICENSE file.
4 4
5 library operation.analysis; 5 library operation.analysis;
6 6
7 import 'package:analysis_server/src/analysis_server.dart'; 7 import 'package:analysis_server/src/analysis_server.dart';
8 import 'package:analysis_server/src/computer/computer_highlights.dart'; 8 import 'package:analysis_server/src/computer/computer_highlights.dart';
9 import 'package:analysis_server/src/computer/computer_highlights2.dart'; 9 import 'package:analysis_server/src/computer/computer_highlights2.dart';
10 import 'package:analysis_server/src/computer/computer_outline.dart'; 10 import 'package:analysis_server/src/computer/computer_outline.dart';
(...skipping 71 matching lines...) Expand 10 before | Expand all | Expand 10 after
82 AnalysisContext context, 82 AnalysisContext context,
83 CompilationUnit parsedDartUnit, 83 CompilationUnit parsedDartUnit,
84 CompilationUnit resolvedDartUnit, 84 CompilationUnit resolvedDartUnit,
85 List<AnalysisError> errors) { 85 List<AnalysisError> errors) {
86 // If the file belongs to any analysis root, check whether we're in it now. 86 // If the file belongs to any analysis root, check whether we're in it now.
87 AnalysisContext containingContext = server.getContainingContext(file); 87 AnalysisContext containingContext = server.getContainingContext(file);
88 if (containingContext != null && context != containingContext) { 88 if (containingContext != null && context != containingContext) {
89 return; 89 return;
90 } 90 }
91 // Dart 91 // Dart
92 CompilationUnit dartUnit = 92 CompilationUnit dartUnit = resolvedDartUnit ?? parsedDartUnit;
93 resolvedDartUnit != null ? resolvedDartUnit : parsedDartUnit;
94 if (resolvedDartUnit != null) { 93 if (resolvedDartUnit != null) {
95 if (server.hasAnalysisSubscription( 94 if (server.hasAnalysisSubscription(
96 protocol.AnalysisService.HIGHLIGHTS, file)) { 95 protocol.AnalysisService.HIGHLIGHTS, file)) {
97 server.scheduleOperation( 96 server.scheduleOperation(
98 new _DartHighlightsOperation(context, file, resolvedDartUnit)); 97 new _DartHighlightsOperation(context, file, resolvedDartUnit));
99 } 98 }
100 if (server.hasAnalysisSubscription( 99 if (server.hasAnalysisSubscription(
101 protocol.AnalysisService.NAVIGATION, file)) { 100 protocol.AnalysisService.NAVIGATION, file)) {
102 server.scheduleOperation(new NavigationOperation(context, source)); 101 server.scheduleOperation(new NavigationOperation(context, source));
103 } 102 }
(...skipping 437 matching lines...) Expand 10 before | Expand all | Expand 10 after
541 abstract class _SingleFileOperation extends SourceSensitiveOperation { 540 abstract class _SingleFileOperation extends SourceSensitiveOperation {
542 final String file; 541 final String file;
543 542
544 _SingleFileOperation(AnalysisContext context, this.file) : super(context); 543 _SingleFileOperation(AnalysisContext context, this.file) : super(context);
545 544
546 @override 545 @override
547 bool shouldBeDiscardedOnSourceChange(Source source) { 546 bool shouldBeDiscardedOnSourceChange(Source source) {
548 return source.fullName == file; 547 return source.fullName == file;
549 } 548 }
550 } 549 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698