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

Unified Diff: tool/patch_sdk.dart

Issue 959913003: cleanup patch generation to preseve comments and remove @patch (Closed) Base URL: git@github.com:dart-lang/dev_compiler.git@master
Patch Set: Created 5 years, 10 months 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 | « test/generated_sdk/lib/typed_data/typed_data.dart ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: tool/patch_sdk.dart
diff --git a/tool/patch_sdk.dart b/tool/patch_sdk.dart
index 15f899197736ef77f2a73abfa47c6010faeaf841..bc877acb31e548878173b45fcae846e26f6402b2 100755
--- a/tool/patch_sdk.dart
+++ b/tool/patch_sdk.dart
@@ -171,12 +171,13 @@ class PatchApplier extends RecursiveAstVisitor {
var patchNode = patches[name];
if (patchNode == null) throw 'patch not found for $name: $node';
- var code = patchCode.substring(patchNode.offset, patchNode.end);
+ Annotation patch = patchNode.metadata.lastWhere(_isPatchAnnotation);
+ var code = patchCode.substring(patch.endToken.next.offset, patchNode.end);
// For some node like static fields, the node's offset doesn't include
- // the external keyword.
- var begin = math.min(node.offset, externalKeyword.offset);
- edits.replace(begin, node.end, code);
+ // the external keyword. Also starting from the keyword lets us preserve
+ // documentation comments.
+ edits.replace(externalKeyword.offset, node.end, code);
}
}
« no previous file with comments | « test/generated_sdk/lib/typed_data/typed_data.dart ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698