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

Unified Diff: pkg/compiler/lib/src/js_model/elements.dart

Issue 2996723002: Support typedef type literals (Closed)
Patch Set: Updated cf. comments Created 3 years, 4 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/js_backend/runtime_types.dart ('k') | pkg/compiler/lib/src/kernel/element_map.dart » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: pkg/compiler/lib/src/js_model/elements.dart
diff --git a/pkg/compiler/lib/src/js_model/elements.dart b/pkg/compiler/lib/src/js_model/elements.dart
index ebab4220809959a192a55edeafff0574bde3422b..36e690187c7382bae2dca60dbcef2b4947aa6586 100644
--- a/pkg/compiler/lib/src/js_model/elements.dart
+++ b/pkg/compiler/lib/src/js_model/elements.dart
@@ -101,6 +101,11 @@ class JsElementCreatorMixin {
return new JClass(library, classIndex, name, isAbstract: isAbstract);
}
+ IndexedTypedef createTypedef(
+ LibraryEntity library, int typedefIndex, String name) {
+ return new JTypedef(library, typedefIndex, name);
+ }
+
TypeVariableEntity createTypeVariable(
int typeVariableIndex, Entity typeDeclaration, String name, int index) {
return new JTypeVariable(typeVariableIndex, typeDeclaration, name, index);
@@ -263,6 +268,12 @@ class TypeConverter implements DartTypeVisitor<DartType, EntityConverter> {
}
@override
+ DartType visitTypedefType(TypedefType type, EntityConverter converter) {
+ return new TypedefType(
+ converter(type.element), visitList(type.typeArguments, converter));
+ }
+
+ @override
DartType visitFunctionType(FunctionType type, EntityConverter converter) {
return new FunctionType(
visit(type.returnType, converter),
@@ -314,6 +325,19 @@ class JClass implements ClassEntity, IndexedClass {
String toString() => '${jsElementPrefix}class($name)';
}
+class JTypedef implements TypedefEntity, IndexedTypedef {
+ final JLibrary library;
+
+ /// Typedef index used for fast lookup in [JsToFrontendMapImpl].
+ final int typedefIndex;
+
+ final String name;
+
+ JTypedef(this.library, this.typedefIndex, this.name);
+
+ String toString() => '${jsElementPrefix}typedef($name)';
+}
+
abstract class JMember implements MemberEntity, IndexedMember {
/// Member index used for fast lookup in [JsToFrontendMapImpl].
final int memberIndex;
« no previous file with comments | « pkg/compiler/lib/src/js_backend/runtime_types.dart ('k') | pkg/compiler/lib/src/kernel/element_map.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698