| Index: pkg/dev_compiler/tool/patch_sdk.dart
|
| diff --git a/pkg/dev_compiler/tool/patch_sdk.dart b/pkg/dev_compiler/tool/patch_sdk.dart
|
| index 3c7e543112252d828b45ed7f3ce3f16adfb395ff..00ec5db14fa36ade328ee1d31621239b0a7ff2f8 100755
|
| --- a/pkg/dev_compiler/tool/patch_sdk.dart
|
| +++ b/pkg/dev_compiler/tool/patch_sdk.dart
|
| @@ -14,8 +14,8 @@ import 'package:analyzer/src/generated/sdk.dart';
|
| import 'package:path/path.dart' as path;
|
|
|
| void main(List<String> argv) {
|
| + var self = path.relative(path.fromUri(Platform.script));
|
| if (argv.length < 2) {
|
| - var self = path.relative(path.fromUri(Platform.script));
|
| var toolDir = path.relative(path.dirname(path.fromUri(Platform.script)));
|
|
|
| var inputExample = path.join(toolDir, 'input_sdk');
|
| @@ -28,6 +28,8 @@ void main(List<String> argv) {
|
| exit(1);
|
| }
|
|
|
| + var selfModifyTime = new File(self).lastModifiedSync().millisecondsSinceEpoch;
|
| +
|
| var input = argv[0];
|
| var sdkLibIn = path.join(input, 'lib');
|
| var patchIn = path.join(input, 'patch');
|
| @@ -71,8 +73,8 @@ void main(List<String> argv) {
|
| var outPaths = <String>[libraryOut];
|
| var libraryContents = libraryFile.readAsStringSync();
|
|
|
| - int inputModifyTime =
|
| - libraryFile.lastModifiedSync().millisecondsSinceEpoch;
|
| + int inputModifyTime = math.max(selfModifyTime,
|
| + libraryFile.lastModifiedSync().millisecondsSinceEpoch);
|
| var partFiles = <File>[];
|
| for (var part in parseDirectives(libraryContents).directives) {
|
| if (part is PartDirective) {
|
| @@ -263,6 +265,15 @@ class PatchApplier extends GeneralizingAstVisitor {
|
| int start = patchMeta.endToken.next.offset;
|
| var code = patch.contents.substring(start, patchNode.end);
|
|
|
| + // Const factory constructors can't be legally parsed from the patch file,
|
| + // so we need to omit the "const" there, but still preserve it.
|
| + if (node is ConstructorDeclaration &&
|
| + node.constKeyword != null &&
|
| + patchNode is ConstructorDeclaration &&
|
| + patchNode.constKeyword == null) {
|
| + code = 'const $code';
|
| + }
|
| +
|
| // For some node like static fields, the node's offset doesn't include
|
| // the external keyword. Also starting from the keyword lets us preserve
|
| // documentation comments.
|
|
|