OLD | NEW |
1 // Copyright (c) 2016, the Dart project authors. Please see the AUTHORS file | 1 // Copyright (c) 2016, 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 import 'dart:async'; | 5 import 'dart:async'; |
6 import 'dart:collection'; | 6 import 'dart:collection'; |
7 import 'dart:typed_data'; | 7 import 'dart:typed_data'; |
8 | 8 |
9 import 'package:analyzer/dart/ast/ast.dart'; | 9 import 'package:analyzer/dart/ast/ast.dart'; |
10 import 'package:analyzer/error/error.dart'; | 10 import 'package:analyzer/error/error.dart'; |
(...skipping 630 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
641 */ | 641 */ |
642 AnalysisResult _getCachedAnalysisResult(FileState file, String key) { | 642 AnalysisResult _getCachedAnalysisResult(FileState file, String key) { |
643 List<int> bytes = _byteStore.get(key); | 643 List<int> bytes = _byteStore.get(key); |
644 if (bytes != null) { | 644 if (bytes != null) { |
645 var unit = new AnalysisDriverResolvedUnit.fromBuffer(bytes); | 645 var unit = new AnalysisDriverResolvedUnit.fromBuffer(bytes); |
646 List<AnalysisError> errors = unit.errors | 646 List<AnalysisError> errors = unit.errors |
647 .map((error) => new AnalysisError.forValues( | 647 .map((error) => new AnalysisError.forValues( |
648 file.source, | 648 file.source, |
649 error.offset, | 649 error.offset, |
650 error.length, | 650 error.length, |
651 ErrorCode.byUniqueName(error.uniqueName), | 651 errorCodeByUniqueName(error.uniqueName), |
652 error.message, | 652 error.message, |
653 error.correction)) | 653 error.correction)) |
654 .toList(); | 654 .toList(); |
655 return new AnalysisResult(file.path, file.uri, null, file.contentHash, | 655 return new AnalysisResult(file.path, file.uri, null, file.contentHash, |
656 file.lineInfo, null, errors); | 656 file.lineInfo, null, errors); |
657 } | 657 } |
658 return null; | 658 return null; |
659 } | 659 } |
660 | 660 |
661 /** | 661 /** |
(...skipping 360 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1022 /** | 1022 /** |
1023 * Complete the [signal] future if it is not completed yet. It is safe to | 1023 * Complete the [signal] future if it is not completed yet. It is safe to |
1024 * call this method multiple times, but the [signal] will complete only once. | 1024 * call this method multiple times, but the [signal] will complete only once. |
1025 */ | 1025 */ |
1026 void notify() { | 1026 void notify() { |
1027 if (!_completer.isCompleted) { | 1027 if (!_completer.isCompleted) { |
1028 _completer.complete(null); | 1028 _completer.complete(null); |
1029 } | 1029 } |
1030 } | 1030 } |
1031 } | 1031 } |
OLD | NEW |