| OLD | NEW |
| 1 // Copyright (c) 2017, the Dart project authors. Please see the AUTHORS file | 1 // Copyright (c) 2017, 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 | 6 |
| 7 import 'package:analyzer/dart/ast/ast.dart'; | 7 import 'package:analyzer/dart/ast/ast.dart'; |
| 8 import 'package:analyzer/dart/ast/token.dart'; | 8 import 'package:analyzer/dart/ast/token.dart'; |
| 9 import 'package:analyzer/dart/element/element.dart'; | 9 import 'package:analyzer/dart/element/element.dart'; |
| 10 import 'package:analyzer/dart/element/type.dart'; | 10 import 'package:analyzer/dart/element/type.dart'; |
| (...skipping 22 matching lines...) Expand all Loading... |
| 33 * The analysis driver in which the files being edited were analyzed. | 33 * The analysis driver in which the files being edited were analyzed. |
| 34 */ | 34 */ |
| 35 final AnalysisDriver driver; | 35 final AnalysisDriver driver; |
| 36 | 36 |
| 37 /** | 37 /** |
| 38 * Initialize a newly created change builder. | 38 * Initialize a newly created change builder. |
| 39 */ | 39 */ |
| 40 DartChangeBuilderImpl(this.driver); | 40 DartChangeBuilderImpl(this.driver); |
| 41 | 41 |
| 42 @override | 42 @override |
| 43 Future<Null> addFileEdit(String path, int fileStamp, | 43 Future<Null> addFileEdit( |
| 44 void buildFileEdit(DartFileEditBuilder builder)) => | 44 String path, void buildFileEdit(DartFileEditBuilder builder)) => |
| 45 super.addFileEdit(path, fileStamp, buildFileEdit); | 45 super.addFileEdit(path, buildFileEdit); |
| 46 | 46 |
| 47 @override | 47 @override |
| 48 Future<DartFileEditBuilderImpl> createFileEditBuilder( | 48 Future<DartFileEditBuilderImpl> createFileEditBuilder(String path) async { |
| 49 String path, int fileStamp) async { | |
| 50 AnalysisResult result = await driver.getResult(path); | 49 AnalysisResult result = await driver.getResult(path); |
| 51 return new DartFileEditBuilderImpl(this, path, fileStamp, result.unit); | 50 int timeStamp = driver.fsState.getFileForPath(path).exists ? 0 : -1; |
| 51 return new DartFileEditBuilderImpl(this, path, timeStamp, result.unit); |
| 52 } | 52 } |
| 53 } | 53 } |
| 54 | 54 |
| 55 /** | 55 /** |
| 56 * An [EditBuilder] used to build edits in Dart files. | 56 * An [EditBuilder] used to build edits in Dart files. |
| 57 */ | 57 */ |
| 58 class DartEditBuilderImpl extends EditBuilderImpl implements DartEditBuilder { | 58 class DartEditBuilderImpl extends EditBuilderImpl implements DartEditBuilder { |
| 59 List<String> _KNOWN_METHOD_NAME_PREFIXES = ['get', 'is', 'to']; | 59 List<String> _KNOWN_METHOD_NAME_PREFIXES = ['get', 'is', 'to']; |
| 60 | 60 |
| 61 /** | 61 /** |
| (...skipping 1339 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1401 } | 1401 } |
| 1402 } | 1402 } |
| 1403 | 1403 |
| 1404 class _InsertionDescription { | 1404 class _InsertionDescription { |
| 1405 final int offset; | 1405 final int offset; |
| 1406 final bool insertEmptyLineBefore; | 1406 final bool insertEmptyLineBefore; |
| 1407 final bool insertEmptyLineAfter; | 1407 final bool insertEmptyLineAfter; |
| 1408 _InsertionDescription( | 1408 _InsertionDescription( |
| 1409 this.offset, this.insertEmptyLineBefore, this.insertEmptyLineAfter); | 1409 this.offset, this.insertEmptyLineBefore, this.insertEmptyLineAfter); |
| 1410 } | 1410 } |
| OLD | NEW |