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

Unified Diff: tools/patch_sdk.dart

Issue 2993493002: Remove warnings when building the dart2js sdk. (Closed)
Patch Set: lint Created 3 years, 5 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 | « no previous file | 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 81f239f3e29f06f156817f5f45b474181d21c54f..8e86120e9c5a7e37327dc2c5850a840f4c7adccf 100644
--- a/tools/patch_sdk.dart
+++ b/tools/patch_sdk.dart
@@ -597,8 +597,9 @@ class PatchApplier extends GeneralizingAstVisitor {
var name = _qualifiedName(node);
var patchNode = patch.patches[name];
if (patchNode == null) {
- if (externalKeyword != null) {
+ if (externalKeyword != null && _shouldHaveImplementation(name)) {
print('warning: patch not found for $name: $node');
+ exitCode = 1;
}
return;
}
@@ -615,6 +616,23 @@ class PatchApplier extends GeneralizingAstVisitor {
}
}
+/// Whether a member should have an implementation after patching the SDK.
+///
+/// True for most members except for the *.fromEnvironment constructors under
+/// the dart2js target.
+bool _shouldHaveImplementation(String qualifiedName) {
+ if (!forDart2js) return true;
+ // Note: dart2js implements int.fromEnvironment, bool.fromEnvironment
+ // and String.fromEnvironment directly and expects the SDK code to
+ // have an external declaration.
+ var isFromEnvironment = const [
+ 'bool.fromEnvironment',
+ 'int.fromEnvironment',
+ 'String.fromEnvironment'
+ ].contains(qualifiedName);
+ return !isFromEnvironment;
+}
+
class PatchFinder extends GeneralizingAstVisitor {
final String contents;
final CompilationUnit unit;
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698