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

Unified Diff: pkg/compiler/lib/src/compile_time_constants.dart

Issue 804333002: Add CoreTypes interface. (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: Created 6 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
« no previous file with comments | « no previous file | pkg/compiler/lib/src/compiler.dart » ('j') | pkg/compiler/lib/src/compiler.dart » ('J')
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: pkg/compiler/lib/src/compile_time_constants.dart
diff --git a/pkg/compiler/lib/src/compile_time_constants.dart b/pkg/compiler/lib/src/compile_time_constants.dart
index a1048438ff4a8be257113c3149e1f8d0580f669d..11d56c963208cbab4ea692f841cc3e200f90de45 100644
--- a/pkg/compiler/lib/src/compile_time_constants.dart
+++ b/pkg/compiler/lib/src/compile_time_constants.dart
@@ -162,7 +162,7 @@ abstract class ConstantCompilerBase implements ConstantCompiler {
value = null;
}
} else {
- DartType constantType = value.value.computeType(compiler);
+ DartType constantType = value.value.getType(compiler.coreTypes);
if (!constantSystem.isSubtype(compiler,
constantType, elementType)) {
if (isConst) {
@@ -485,10 +485,12 @@ class CompileTimeConstantEvaluator extends Visitor<AstConstant> {
message: MessageKind.DEFERRED_COMPILE_TIME_CONSTANT);
}
if (Elements.isStaticOrTopLevelFunction(element)) {
+ FunctionElementX function = element;
+ function.computeType(compiler);
return new AstConstant(
context, send, new FunctionConstantExpression(
- new FunctionConstantValue(element),
- element));
+ new FunctionConstantValue(function),
+ function));
} else if (Elements.isStaticOrTopLevelField(element)) {
ConstantExpression result;
if (element.isConst) {
@@ -601,7 +603,7 @@ class CompileTimeConstantEvaluator extends Visitor<AstConstant> {
if (condition == null) {
return null;
} else if (!condition.value.isBool) {
- DartType conditionType = condition.value.computeType(compiler);
+ DartType conditionType = condition.value.getType(compiler.coreTypes);
if (isEvaluatingConstant) {
compiler.reportFatalError(
node.condition, MessageKind.NOT_ASSIGNABLE,
@@ -732,7 +734,7 @@ class CompileTimeConstantEvaluator extends Visitor<AstConstant> {
}
if (!firstArgument.isString) {
- DartType type = defaultValue.computeType(compiler);
+ DartType type = defaultValue.getType(compiler.coreTypes);
compiler.reportFatalError(
send.arguments.head, MessageKind.NOT_ASSIGNABLE,
{'fromType': type, 'toType': compiler.stringClass.rawType});
@@ -741,7 +743,7 @@ class CompileTimeConstantEvaluator extends Visitor<AstConstant> {
if (constructor == compiler.intEnvironment &&
!(defaultValue.isNull || defaultValue.isInt)) {
- DartType type = defaultValue.computeType(compiler);
+ DartType type = defaultValue.getType(compiler.coreTypes);
compiler.reportFatalError(
send.arguments.tail.head, MessageKind.NOT_ASSIGNABLE,
{'fromType': type, 'toType': compiler.intClass.rawType});
@@ -750,7 +752,7 @@ class CompileTimeConstantEvaluator extends Visitor<AstConstant> {
if (constructor == compiler.boolEnvironment &&
!(defaultValue.isNull || defaultValue.isBool)) {
- DartType type = defaultValue.computeType(compiler);
+ DartType type = defaultValue.getType(compiler.coreTypes);
compiler.reportFatalError(
send.arguments.tail.head, MessageKind.NOT_ASSIGNABLE,
{'fromType': type, 'toType': compiler.boolClass.rawType});
@@ -759,7 +761,7 @@ class CompileTimeConstantEvaluator extends Visitor<AstConstant> {
if (constructor == compiler.stringEnvironment &&
!(defaultValue.isNull || defaultValue.isString)) {
- DartType type = defaultValue.computeType(compiler);
+ DartType type = defaultValue.getType(compiler.coreTypes);
compiler.reportFatalError(
send.arguments.tail.head, MessageKind.NOT_ASSIGNABLE,
{'fromType': type, 'toType': compiler.stringClass.rawType});
@@ -907,7 +909,7 @@ class ConstructorEvaluator extends CompileTimeConstantEvaluator {
AstConstant constant) {
if (compiler.enableTypeAssertions) {
DartType elementType = element.type.substByContext(constructedType);
- DartType constantType = constant.value.computeType(compiler);
+ DartType constantType = constant.value.getType(compiler.coreTypes);
if (!constantSystem.isSubtype(compiler, constantType, elementType)) {
compiler.withCurrentElement(constant.element, () {
compiler.reportFatalError(
« no previous file with comments | « no previous file | pkg/compiler/lib/src/compiler.dart » ('j') | pkg/compiler/lib/src/compiler.dart » ('J')

Powered by Google App Engine
This is Rietveld 408576698