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

Unified Diff: pkg/compiler/lib/src/native/enqueue.dart

Issue 2608143002: Refactor BackendHelpers to make 'find' methods private. (Closed)
Patch Set: Updated cf. comments. Created 3 years, 11 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
Index: pkg/compiler/lib/src/native/enqueue.dart
diff --git a/pkg/compiler/lib/src/native/enqueue.dart b/pkg/compiler/lib/src/native/enqueue.dart
index e5405ba9b29774f0c7dddd7082c23ca140097ab9..44b82f5f305e235672f094d662b4a3216df3f8e4 100644
--- a/pkg/compiler/lib/src/native/enqueue.dart
+++ b/pkg/compiler/lib/src/native/enqueue.dart
@@ -283,18 +283,10 @@ abstract class NativeEnqueuerBase implements NativeEnqueuer {
void findAnnotationClasses() {
if (_annotationCreatesClass != null) return;
- ClassElement find(name) {
- Element e = helpers.findHelper(name);
- if (e == null || e is! ClassElement) {
- reporter.internalError(NO_LOCATION_SPANNABLE,
- "Could not find implementation class '${name}'.");
- }
- return e;
- }
- _annotationCreatesClass = find('Creates');
- _annotationReturnsClass = find('Returns');
- _annotationJsNameClass = find('JSName');
+ _annotationCreatesClass = helpers.annotationCreatesClass;
+ _annotationReturnsClass = helpers.annotationReturnsClass;
+ _annotationJsNameClass = helpers.annotationJSNameClass;
}
/// Returns the JSName annotation string or `null` if no JSName annotation is
@@ -498,17 +490,16 @@ abstract class NativeEnqueuerBase implements NativeEnqueuer {
}
Iterable<ClassElement> _onFirstNativeClass(WorldImpactBuilder impactBuilder) {
- void staticUse(name) {
- Element element = helpers.findHelper(name);
+ void staticUse(element) {
impactBuilder.registerStaticUse(new StaticUse.foreignUse(element));
backend.registerBackendUse(element);
compiler.globalDependencies.registerDependency(element);
}
- staticUse('defineProperty');
- staticUse('toStringForNativeObject');
- staticUse('hashCodeForNativeObject');
- staticUse('convertDartClosureToJS');
+ staticUse(helpers.defineProperty);
+ staticUse(helpers.toStringForNativeObject);
+ staticUse(helpers.hashCodeForNativeObject);
+ staticUse(helpers.closureConverter);
return _findNativeExceptions();
}
« no previous file with comments | « pkg/compiler/lib/src/js_backend/constant_system_javascript.dart ('k') | pkg/compiler/lib/src/ssa/codegen.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698