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

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

Issue 2598983002: Introduce DartType super hierarchy based on Entity (Closed)
Patch Set: Cleanup. Created 4 years 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/elements/types.dart
diff --git a/pkg/compiler/lib/src/elements/types.dart b/pkg/compiler/lib/src/elements/types.dart
new file mode 100644
index 0000000000000000000000000000000000000000..a84caa801eb761ab3904d23c992c6024d91d9402
--- /dev/null
+++ b/pkg/compiler/lib/src/elements/types.dart
@@ -0,0 +1,72 @@
+// Copyright (c) 2016, the Dart project authors. Please see the AUTHORS file
+// for details. All rights reserved. Use of this source code is governed by a
+// BSD-style license that can be found in the LICENSE file.
+
+import 'entities.dart';
+
+abstract class DartType {
Siggi Cherem (dart-lang) 2016/12/22 15:42:03 mmmm... I wonder if we should pick a different nam
Johnni Winther 2016/12/22 15:58:49 Good ideas. I'll pause this CL and make the renami
Johnni Winther 2017/01/04 09:52:39 Dartdoc added.
+ /// Returns the unaliased type of this type.
+ ///
+ /// The unaliased type of a typedef'd type is the unaliased type to which its
+ /// name is bound. The unaliased version of any other type is the type itself.
+ ///
+ /// For example, the unaliased type of `typedef A Func<A,B>(B b)` is the
+ /// function type `(B) -> A` and the unaliased type of `Func<int,String>`
+ /// is the function type `(String) -> int`.
+ DartType get unaliased;
+
+ /// Is `true` if this type has no non-dynamic type arguments.
+ bool get treatAsRaw;
+
+ /// Is `true` if this type should be treated as the dynamic type.
+ bool get treatAsDynamic;
+
+ /// Is `true` if this type is the dynamic type.
+ bool get isDynamic;
+
+ /// Is `true` if this type is the void type.
+ bool get isVoid;
+
+ /// Is `true` if this is the type of `Object` from dart:core.
+ bool get isObject;
+
+ /// Is `true` if this type is an interface type.
+ bool get isInterfaceType;
+
+ /// Is `true` if this type is a typedef.
+ bool get isTypedef;
+
+ /// Is `true` if this type is a function type.
+ bool get isFunctionType;
+
+ /// Is `true` if this type is a type variable.
+ bool get isTypeVariable;
+
+ /// Is `true` if this type is a malformed type.
+ bool get isMalformed;
+}
+
+abstract class InterfaceType extends DartType {
+ ClassEntity get element;
+}
+
+abstract class TypeVariableType extends DartType {
+ TypeVariableEntity get element;
+}
+
+abstract class VoidType extends DartType {}
+
+abstract class DynamicType extends DartType {}
+
+abstract class FunctionType extends DartType {
+ DartType get returnType;
+ List<DartType> get parameterTypes;
+ List<DartType> get optionalParameterTypes;
+
+ /// The names of the named parameters ordered lexicographically.
+ List<String> get namedParameters;
+
+ /// The types of the named parameters in the order corresponding to the
+ /// [namedParameters].
+ List<DartType> get namedParameterTypes;
+}

Powered by Google App Engine
This is Rietveld 408576698