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

Side by Side Diff: pkg/analyzer/lib/src/context/context.dart

Issue 1214853028: One more fix for making removing overlays incremental changes. (Closed) Base URL: git@github.com:dart-lang/sdk.git@master
Patch Set: Created 5 years, 5 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) 2015, the Dart project authors. Please see the AUTHORS file 1 // Copyright (c) 2015, 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 analyzer.src.context.context; 5 library analyzer.src.context.context;
6 6
7 import 'dart:async'; 7 import 'dart:async';
8 import 'dart:collection'; 8 import 'dart:collection';
9 9
10 import 'package:analyzer/instrumentation/instrumentation.dart'; 10 import 'package:analyzer/instrumentation/instrumentation.dart';
(...skipping 952 matching lines...) Expand 10 before | Expand all | Expand 10 after
963 entry.modificationTime = _contentCache.getModificationStamp(source); 963 entry.modificationTime = _contentCache.getModificationStamp(source);
964 entry.setValue(CONTENT, newContents, TargetedResult.EMPTY_LIST); 964 entry.setValue(CONTENT, newContents, TargetedResult.EMPTY_LIST);
965 } else { 965 } else {
966 entry.modificationTime = _contentCache.getModificationStamp(source); 966 entry.modificationTime = _contentCache.getModificationStamp(source);
967 } 967 }
968 } else if (originalContents != null) { 968 } else if (originalContents != null) {
969 // We are removing the overlay for the file, check if the file's 969 // We are removing the overlay for the file, check if the file's
970 // contents is the same as it was in the overlay. 970 // contents is the same as it was in the overlay.
971 try { 971 try {
972 TimestampedData<String> fileContents = getContents(source); 972 TimestampedData<String> fileContents = getContents(source);
973 String fileContentsData = fileContents.data; 973 newContents = fileContents.data;
974 if (fileContentsData == originalContents) { 974 entry.modificationTime = fileContents.modificationTime;
975 entry.setValue(CONTENT, fileContentsData, TargetedResult.EMPTY_LIST); 975 if (newContents == originalContents) {
976 entry.modificationTime = fileContents.modificationTime; 976 entry.setValue(CONTENT, newContents, TargetedResult.EMPTY_LIST);
977 changed = false; 977 changed = false;
978 } 978 }
979 newContents = fileContentsData;
980 } catch (e) {} 979 } catch (e) {}
981 // If not the same content (e.g. the file is being closed without save), 980 // If not the same content (e.g. the file is being closed without save),
982 // then force analysis. 981 // then force analysis.
983 if (changed) { 982 if (changed) {
984 if (!analysisOptions.incremental || 983 if (!analysisOptions.incremental ||
985 !_tryPoorMansIncrementalResolution(source, newContents)) { 984 !_tryPoorMansIncrementalResolution(source, newContents)) {
986 _sourceChanged(source); 985 _sourceChanged(source);
987 } 986 }
988 } 987 }
989 } 988 }
(...skipping 1036 matching lines...) Expand 10 before | Expand all | Expand 10 after
2026 new PendingFuture<T>(_context, target, computeValue); 2025 new PendingFuture<T>(_context, target, computeValue);
2027 if (!pendingFuture.evaluate(entry)) { 2026 if (!pendingFuture.evaluate(entry)) {
2028 _context._pendingFutureTargets 2027 _context._pendingFutureTargets
2029 .putIfAbsent(target, () => <PendingFuture>[]) 2028 .putIfAbsent(target, () => <PendingFuture>[])
2030 .add(pendingFuture); 2029 .add(pendingFuture);
2031 scheduleComputation(); 2030 scheduleComputation();
2032 } 2031 }
2033 return pendingFuture.future; 2032 return pendingFuture.future;
2034 } 2033 }
2035 } 2034 }
OLDNEW
« no previous file with comments | « pkg/analysis_server/test/analysis/update_content_test.dart ('k') | pkg/analyzer/lib/src/generated/engine.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698