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

Unified Diff: tools/patch_sdk.dart

Issue 2485993002: VM: Support bootstrapping core libraries from Kernel binaries instead of source. (Closed)
Patch Set: Done 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
« runtime/vm/bootstrap_nocore.cc ('K') | « tests/language/language_kernel.status ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: tools/patch_sdk.dart
diff --git a/tools/patch_sdk.dart b/tools/patch_sdk.dart
index 3bb9965ec32def7758b8f5d176f55a70256b496f..d92f0a693a0142536abe867c6d3ed99918df741e 100644
--- a/tools/patch_sdk.dart
+++ b/tools/patch_sdk.dart
@@ -264,6 +264,17 @@ List<String> _patchLibrary(String name,
partUnit.accept(new PatchApplier(partEdits, patchFinder));
results.add(partEdits);
}
+
+ if (patchFinder.patches.length != patchFinder.applied.length) {
+ print('Some elements marked as @patch do not have corresponding elements:');
+ for (var patched in patchFinder.patches.keys) {
+ if (!patchFinder.applied.contains(patched)) {
+ print('*** ${patched}');
+ }
+ }
+ throw "Failed to apply all @patch-es";
+ }
+
return new List<String>.from(results.map((e) => e.toString()));
}
@@ -343,14 +354,16 @@ class PatchApplier extends GeneralizingAstVisitor {
if (node is FieldDeclaration) return;
var externalKeyword = (node as dynamic).externalKeyword;
- if (externalKeyword == null) return;
var name = _qualifiedName(node);
var patchNode = patch.patches[name];
if (patchNode == null) {
- print('warning: patch not found for $name: $node');
+ if (externalKeyword != null) {
+ print('warning: patch not found for $name: $node');
+ }
return;
}
+ patch.applied.add(name);
Annotation patchMeta = patchNode.metadata.lastWhere(_isPatchAnnotation);
int start = patchMeta.endToken.next.offset;
@@ -359,7 +372,7 @@ class PatchApplier extends GeneralizingAstVisitor {
// 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.
- edits.replace(externalKeyword.offset, node.end, code);
+ edits.replace(externalKeyword?.offset ?? node.offset, node.end, code);
}
}
@@ -370,6 +383,7 @@ class PatchFinder extends GeneralizingAstVisitor {
final Map patches = <String, Declaration>{};
final Map mergeMembers = <String, List<ClassMember>>{};
final List mergeDeclarations = <CompilationUnitMember>[];
+ final Set<String> applied = new Set<String>();
PatchFinder.parseAndVisit(String name, String contents)
: contents = contents,
« runtime/vm/bootstrap_nocore.cc ('K') | « tests/language/language_kernel.status ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698