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

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

Issue 2603263002: Prefix resolution_types with Resolution. (Closed)
Patch Set: Rebased 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
« no previous file with comments | « pkg/compiler/lib/src/mirrors_used.dart ('k') | pkg/compiler/lib/src/native/enqueue.dart » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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 3469ff08c8a0a9e97d01b6c842d3facde84fc864..e236975ddf5b6da00f6cf5abfb059a6202db4ff8 100644
--- a/pkg/compiler/lib/src/native/behavior.dart
+++ b/pkg/compiler/lib/src/native/behavior.dart
@@ -130,10 +130,12 @@ class NativeThrowBehavior {
* `null` may be returned.
*/
class NativeBehavior {
- /// [DartType]s or [SpecialType]s returned or yielded by the native element.
+ /// [ResolutionDartType]s or [SpecialType]s returned or yielded by the native
+ /// element.
final List typesReturned = [];
- /// [DartType]s or [SpecialType]s instantiated by the native element.
+ /// [ResolutionDartType]s or [SpecialType]s instantiated by the native
+ /// element.
final List typesInstantiated = [];
String codeTemplateText;
@@ -744,14 +746,14 @@ class NativeBehavior {
static NativeBehavior ofMethodElement(
FunctionElement element, Compiler compiler) {
- FunctionType type = element.computeType(compiler.resolution);
+ ResolutionFunctionType type = element.computeType(compiler.resolution);
List<ConstantExpression> metadata = <ConstantExpression>[];
for (MetadataAnnotation annotation in element.implementation.metadata) {
annotation.ensureResolved(compiler.resolution);
metadata.add(annotation.constant);
}
- DartType lookup(String name) {
+ ResolutionDartType lookup(String name) {
Element e = element.buildScope().lookup(name);
if (e == null) return null;
if (e is! ClassElement) return null;
@@ -766,7 +768,7 @@ class NativeBehavior {
static NativeBehavior ofMethod(
Spannable spannable,
- FunctionType type,
+ ResolutionFunctionType type,
List<ConstantExpression> metadata,
TypeLookup lookupType,
Compiler compiler,
@@ -785,7 +787,7 @@ class NativeBehavior {
behavior.typesReturned.add(
!isJsInterop || compiler.options.trustJSInteropTypeAnnotations
? returnType
- : const DynamicType());
+ : const ResolutionDynamicType());
if (!type.returnType.isVoid) {
// Declared types are nullable.
behavior.typesReturned.add(compiler.commonElements.nullType);
@@ -793,10 +795,10 @@ class NativeBehavior {
behavior._capture(type, compiler.resolution,
isInterop: isJsInterop, compiler: compiler);
- for (DartType type in type.optionalParameterTypes) {
+ for (ResolutionDartType type in type.optionalParameterTypes) {
behavior._escape(type, compiler.resolution);
}
- for (DartType type in type.namedParameterTypes) {
+ for (ResolutionDartType type in type.namedParameterTypes) {
behavior._escape(type, compiler.resolution);
}
@@ -808,14 +810,14 @@ class NativeBehavior {
static NativeBehavior ofFieldElementLoad(
MemberElement element, Compiler compiler) {
Resolution resolution = compiler.resolution;
- DartType type = element.computeType(resolution);
+ ResolutionDartType type = element.computeType(resolution);
List<ConstantExpression> metadata = <ConstantExpression>[];
for (MetadataAnnotation annotation in element.implementation.metadata) {
annotation.ensureResolved(compiler.resolution);
metadata.add(annotation.constant);
}
- DartType lookup(String name) {
+ ResolutionDartType lookup(String name) {
Element e = element.buildScope().lookup(name);
if (e == null) return null;
if (e is! ClassElement) return null;
@@ -830,7 +832,7 @@ class NativeBehavior {
static NativeBehavior ofFieldLoad(
Spannable spannable,
- DartType type,
+ ResolutionDartType type,
List<ConstantExpression> metadata,
TypeLookup lookupType,
Compiler compiler,
@@ -841,7 +843,7 @@ class NativeBehavior {
behavior.typesReturned.add(
!isJsInterop || compiler.options.trustJSInteropTypeAnnotations
? type
- : const DynamicType());
+ : const ResolutionDynamicType());
// Declared types are nullable.
behavior.typesReturned.add(resolution.commonElements.nullType);
behavior._capture(type, resolution,
@@ -853,11 +855,12 @@ class NativeBehavior {
static NativeBehavior ofFieldElementStore(
MemberElement field, Resolution resolution) {
- DartType type = field.computeType(resolution);
+ ResolutionDartType type = field.computeType(resolution);
return ofFieldStore(type, resolution);
}
- static NativeBehavior ofFieldStore(DartType type, Resolution resolution) {
+ static NativeBehavior ofFieldStore(
+ ResolutionDartType type, Resolution resolution) {
var behavior = new NativeBehavior();
behavior._escape(type, resolution);
// We don't override the default behaviour - the annotations apply to
@@ -924,15 +927,15 @@ class NativeBehavior {
/// Models the behavior of having intances of [type] escape from Dart code
/// into native code.
- void _escape(DartType type, Resolution resolution) {
+ void _escape(ResolutionDartType type, Resolution resolution) {
type.computeUnaliased(resolution);
type = type.unaliased;
- if (type is FunctionType) {
- FunctionType functionType = type;
+ if (type is ResolutionFunctionType) {
+ ResolutionFunctionType functionType = type;
// A function might be called from native code, passing us novel
// parameters.
_escape(functionType.returnType, resolution);
- for (DartType parameter in functionType.parameterTypes) {
+ for (ResolutionDartType parameter in functionType.parameterTypes) {
_capture(parameter, resolution);
}
}
@@ -944,15 +947,15 @@ class NativeBehavior {
///
/// We assume that JS-interop APIs cannot instantiate Dart types or
/// non-JSInterop native types.
- void _capture(DartType type, Resolution resolution,
+ void _capture(ResolutionDartType type, Resolution resolution,
{bool isInterop: false, Compiler compiler}) {
type.computeUnaliased(resolution);
type = type.unaliased;
- if (type is FunctionType) {
- FunctionType functionType = type;
+ if (type is ResolutionFunctionType) {
+ ResolutionFunctionType functionType = type;
_capture(functionType.returnType, resolution,
isInterop: isInterop, compiler: compiler);
- for (DartType parameter in functionType.parameterTypes) {
+ for (ResolutionDartType parameter in functionType.parameterTypes) {
_escape(parameter, resolution);
}
} else {
@@ -992,7 +995,7 @@ class NativeBehavior {
Spannable spannable, DiagnosticReporter reporter, TypeLookup lookupType) {
if (typeString == '=Object') return SpecialType.JsObject;
if (typeString == 'dynamic') {
- return const DynamicType();
+ return const ResolutionDynamicType();
}
var type = lookupType(typeString);
if (type != null) return type;
@@ -1001,7 +1004,7 @@ class NativeBehavior {
if (index < 1) {
reporter.reportErrorMessage(spannable, MessageKind.GENERIC,
{'text': "Type '$typeString' not found."});
- return const DynamicType();
+ return const ResolutionDynamicType();
}
type = lookupType(typeString.substring(0, index));
if (type != null) {
@@ -1010,6 +1013,6 @@ class NativeBehavior {
}
reporter.reportErrorMessage(spannable, MessageKind.GENERIC,
{'text': "Type '$typeString' not found."});
- return const DynamicType();
+ return const ResolutionDynamicType();
}
}
« no previous file with comments | « pkg/compiler/lib/src/mirrors_used.dart ('k') | pkg/compiler/lib/src/native/enqueue.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698