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

Unified Diff: sdk/lib/_internal/compiler/implementation/typechecker.dart

Issue 24282005: Move compile-time constant registrations to the backend. (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: Update status Created 7 years, 3 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: sdk/lib/_internal/compiler/implementation/typechecker.dart
diff --git a/sdk/lib/_internal/compiler/implementation/typechecker.dart b/sdk/lib/_internal/compiler/implementation/typechecker.dart
index 1af2669d9f4b8c6ef7e2448acec5ca809e0fd010..ec2fc91f7571d3ac2cf8a1baa2b6e8a414cd7830 100644
--- a/sdk/lib/_internal/compiler/implementation/typechecker.dart
+++ b/sdk/lib/_internal/compiler/implementation/typechecker.dart
@@ -155,10 +155,24 @@ class TypeCheckerVisitor extends Visitor<DartType> {
final ClassElement currentClass;
+ InterfaceType thisTypeCache;
+ InterfaceType superTypeCache;
+
/// The type of [:this:]. Can only be accessed if [currentClass] is not null.
- InterfaceType thisType;
+ InterfaceType get thisType {
+ assert(invariant(elements.currentElement, thisTypeCache != null,
+ message: 'Trying to access the type of this in '
+ '${elements.currentElement}'));
+ return thisTypeCache;
ahe 2013/09/30 11:05:26 This isn't a cache, please find a different name.
Johnni Winther 2013/10/01 11:21:48 Removed the getters.
+ }
+
/// The type of [:super:]. Can only be accessed if [currentClass] is not null.
- InterfaceType superType;
+ InterfaceType get superType {
+ assert(invariant(elements.currentElement, superTypeCache != null,
+ message: 'Trying to access the type of super in '
+ '${elements.currentElement}'));
+ return superTypeCache;
+ }
Link<DartType> cascadeTypes = const Link<DartType>();
@@ -181,8 +195,8 @@ class TypeCheckerVisitor extends Visitor<DartType> {
listType = compiler.listClass.computeType(compiler);
if (currentClass != null) {
- thisType = currentClass.computeType(compiler);
- superType = currentClass.supertype;
+ thisTypeCache = currentClass.computeType(compiler);
karlklose 2013/10/01 08:58:58 Can you use currentClass.thisType here?
Johnni Winther 2013/10/01 11:21:48 Added a TODO.
+ superTypeCache = currentClass.supertype;
}
}

Powered by Google App Engine
This is Rietveld 408576698