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

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

Issue 11299009: Support type literals as compile-time constants. (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: Created 8 years, 1 month 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/compile_time_constants.dart
diff --git a/sdk/lib/_internal/compiler/implementation/compile_time_constants.dart b/sdk/lib/_internal/compiler/implementation/compile_time_constants.dart
index 3505466746b2aef2374d67c6692c7cc33639bbcf..2b7b1ea3da48148309724be678033adb9eb9aa8f 100644
--- a/sdk/lib/_internal/compiler/implementation/compile_time_constants.dart
+++ b/sdk/lib/_internal/compiler/implementation/compile_time_constants.dart
@@ -416,6 +416,12 @@ class CompileTimeConstantEvaluator extends Visitor {
result = compiler.compileVariable(element);
}
if (result != null) return result;
+ } else if (Elements.isClass(element) || Elements.isTypedef(element)) {
+ DartType type = element.computeType(compiler).asRaw();
+ Constant constant =
+ new TypeConstant(type, compiler.typeClass.computeType(compiler));
+ compiler.constantHandler.registerCompileTimeConstant(constant);
+ return constant;
}
return signalNotCompileTimeConstant(send);
} else if (send.isCall) {

Powered by Google App Engine
This is Rietveld 408576698