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

Unified Diff: pkg/dev_compiler/tool/patch_sdk.dart

Issue 2503803004: fix #27784 and fix #27785, fromEnvironment constants in DDC (Closed)
Patch Set: fix Created 4 years, 1 month 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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « pkg/dev_compiler/test/not_yet_strong_tests.dart ('k') | pkg/dev_compiler/tool/sdk_expected_errors.txt » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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.
« no previous file with comments | « pkg/dev_compiler/test/not_yet_strong_tests.dart ('k') | pkg/dev_compiler/tool/sdk_expected_errors.txt » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698