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

Unified Diff: pkg/compiler/lib/src/kernel/kernel.dart

Issue 2392863002: Roll kernel to latest (Closed)
Patch Set: Reinsert code Created 4 years, 2 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/kernel/kernel.dart
diff --git a/pkg/compiler/lib/src/kernel/kernel.dart b/pkg/compiler/lib/src/kernel/kernel.dart
index 2fe3c704eaaf1e77e1669110d4469f4dbc45ce75..35ff9ea49490cf6ea642f34166ab4706265ddc42 100644
--- a/pkg/compiler/lib/src/kernel/kernel.dart
+++ b/pkg/compiler/lib/src/kernel/kernel.dart
@@ -8,6 +8,8 @@ import 'dart:collection' show Queue;
import 'package:kernel/ast.dart' as ir;
import 'package:kernel/checks.dart' show CheckParentPointers;
+import '../common.dart';
+import '../common/names.dart';
import '../compiler.dart' show Compiler;
import '../constants/expressions.dart' show TypeConstantExpression;
import '../dart_types.dart'
@@ -591,10 +593,26 @@ class Kernel {
return false;
}
+ ir.Constructor getDartCoreConstructor(
+ String className, String constructorName) {
+ LibraryElement library =
+ compiler.libraryLoader.lookupLibrary(Uris.dart_core);
+ ClassElement cls = library.implementation.localLookup(className);
+ assert(invariant(CURRENT_ELEMENT_SPANNABLE, cls != null,
+ message: 'dart:core class $className not found.'));
+ ConstructorElement constructor = cls.lookupConstructor(constructorName);
+ assert(invariant(CURRENT_ELEMENT_SPANNABLE, constructor != null,
+ message: "Constructor '$constructorName' not found "
+ "in class '$className'."));
+ return functionToIr(constructor);
+ }
+
ir.Procedure getDartCoreMethod(String name) {
LibraryElement library =
- compiler.libraryLoader.lookupLibrary(Uri.parse("dart:core"));
+ compiler.libraryLoader.lookupLibrary(Uris.dart_core);
Element function = library.implementation.localLookup(name);
+ assert(invariant(CURRENT_ELEMENT_SPANNABLE, function != null,
+ message: "dart:core method '$name' not found."));
return functionToIr(function);
}
@@ -646,8 +664,8 @@ class Kernel {
return getDartCoreMethod('_genericNoSuchMethod');
}
- ir.Procedure getFallThroughErrorBuilder() {
- return getDartCoreMethod('_fallThroughError');
+ ir.Constructor getFallThroughErrorConstructor() {
+ return getDartCoreConstructor('FallThroughError', '');
}
}
« no previous file with comments | « pkg/compiler/lib/src/kernel/fall_through_visitor.dart ('k') | pkg/compiler/lib/src/kernel/kernel_visitor.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698