| Index: pkg/compiler/lib/src/native/behavior.dart
|
| diff --git a/pkg/compiler/lib/src/native/behavior.dart b/pkg/compiler/lib/src/native/behavior.dart
|
| index 0a08d3aaf9f4dac57a074873df7979bef4b0205a..7c2a59b401bb362571646852368b824c9d939499 100644
|
| --- a/pkg/compiler/lib/src/native/behavior.dart
|
| +++ b/pkg/compiler/lib/src/native/behavior.dart
|
| @@ -7,13 +7,14 @@ import '../common/backend_api.dart' show ForeignResolver;
|
| import '../common/resolution.dart' show ParsingContext, Resolution;
|
| import '../compiler.dart' show Compiler;
|
| import '../constants/values.dart';
|
| -import '../common_elements.dart' show CommonElements;
|
| +import '../common_elements.dart' show CommonElements, ElementEnvironment;
|
| import '../elements/elements.dart';
|
| import '../elements/entities.dart';
|
| import '../elements/resolution_types.dart';
|
| import '../elements/types.dart';
|
| import '../js/js.dart' as js;
|
| import '../js_backend/native_data.dart' show NativeBasicData;
|
| +import '../resolution/resolution_strategy.dart';
|
| import '../tree/tree.dart';
|
| import '../universe/side_effects.dart' show SideEffects;
|
| import '../util/util.dart';
|
| @@ -851,8 +852,7 @@ abstract class BehaviorBuilder {
|
| DiagnosticReporter get reporter;
|
| NativeBasicData get nativeBasicData;
|
| bool get trustJSInteropTypeAnnotations;
|
| -
|
| - Resolution get resolution => null;
|
| + ElementEnvironment get elementEnvironment;
|
|
|
| NativeBehavior _behavior;
|
|
|
| @@ -910,10 +910,7 @@ abstract class BehaviorBuilder {
|
| /// Models the behavior of having instances of [type] escape from Dart code
|
| /// into native code.
|
| void _escape(DartType type) {
|
| - if (type is ResolutionDartType) {
|
| - type.computeUnaliased(resolution);
|
| - }
|
| - type = type.unaliased;
|
| + type = elementEnvironment.getUnaliasedType(type);
|
| if (type is FunctionType) {
|
| FunctionType functionType = type;
|
| // A function might be called from native code, passing us novel
|
| @@ -932,10 +929,7 @@ abstract class BehaviorBuilder {
|
| /// We assume that JS-interop APIs cannot instantiate Dart types or
|
| /// non-JSInterop native types.
|
| void _capture(DartType type, {bool isInterop: false}) {
|
| - if (type is ResolutionDartType) {
|
| - type.computeUnaliased(resolution);
|
| - }
|
| - type = type.unaliased;
|
| + type = elementEnvironment.getUnaliasedType(type);
|
| if (type is FunctionType) {
|
| FunctionType functionType = type;
|
| _capture(functionType.returnType, isInterop: isInterop);
|
| @@ -962,9 +956,8 @@ abstract class BehaviorBuilder {
|
| // annotations. This means that to some degree we still use the return
|
| // type to decide whether to include native types, even if we don't
|
| // trust the type annotation.
|
| - ClassElement cls = commonElements.jsJavaScriptObjectClass;
|
| - cls.ensureResolved(resolution);
|
| - _behavior.typesInstantiated.add(cls.thisType);
|
| + ClassEntity cls = commonElements.jsJavaScriptObjectClass;
|
| + _behavior.typesInstantiated.add(elementEnvironment.getThisType(cls));
|
| } else {
|
| // Otherwise, when the declared type is a Dart type, we do not
|
| // register an allocation because we assume it cannot be instantiated
|
| @@ -1040,7 +1033,7 @@ class ResolverBehaviorBuilder extends BehaviorBuilder {
|
| ResolverBehaviorBuilder(this.compiler, this.nativeBasicData);
|
|
|
| @override
|
| - CommonElements get commonElements => resolution.commonElements;
|
| + CommonElements get commonElements => compiler.resolution.commonElements;
|
|
|
| @override
|
| bool get trustJSInteropTypeAnnotations =>
|
| @@ -1050,5 +1043,8 @@ class ResolverBehaviorBuilder extends BehaviorBuilder {
|
| DiagnosticReporter get reporter => compiler.reporter;
|
|
|
| @override
|
| - Resolution get resolution => compiler.resolution;
|
| + ElementEnvironment get elementEnvironment {
|
| + ResolutionFrontEndStrategy frontendStrategy = compiler.frontendStrategy;
|
| + return frontendStrategy.elementEnvironment;
|
| + }
|
| }
|
|
|