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

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

Issue 2595493002: Merge CoreTypes and CoreClasses into CommonElements. (Closed)
Patch Set: Updated cf. comment 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
« no previous file with comments | « pkg/compiler/lib/src/common/resolution.dart ('k') | pkg/compiler/lib/src/compiler.dart » ('j') | no next file with comments »
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 a1d62a2e6d7cdec533cc6642e0c0c074be354bea..d99734e4eca7876d7b6253a5e557a6f9e5467cf7 100644
--- a/pkg/compiler/lib/src/compile_time_constants.dart
+++ b/pkg/compiler/lib/src/compile_time_constants.dart
@@ -13,7 +13,7 @@ import 'constants/constant_system.dart';
import 'constants/evaluation.dart';
import 'constants/expressions.dart';
import 'constants/values.dart';
-import 'core_types.dart' show CoreTypes;
+import 'core_types.dart' show CommonElements;
import 'dart_types.dart';
import 'elements/elements.dart';
import 'elements/modelx.dart' show ConstantVariableMixin;
@@ -159,7 +159,7 @@ abstract class ConstantCompilerBase implements ConstantCompiler {
DiagnosticReporter get reporter => compiler.reporter;
- CoreTypes get coreTypes => compiler.coreTypes;
+ CommonElements get commonElements => compiler.commonElements;
@override
@deprecated
@@ -272,7 +272,7 @@ abstract class ConstantCompilerBase implements ConstantCompiler {
expression = null;
}
} else {
- DartType constantType = value.getType(coreTypes);
+ DartType constantType = value.getType(commonElements);
if (!constantSystem.isSubtype(
compiler.types, constantType, elementType)) {
if (isConst) {
@@ -407,7 +407,7 @@ class CompileTimeConstantEvaluator extends Visitor<AstConstant> {
ConstantSystem get constantSystem => handler.constantSystem;
Resolution get resolution => compiler.resolution;
- CoreTypes get coreTypes => compiler.coreTypes;
+ CommonElements get commonElements => compiler.commonElements;
DiagnosticReporter get reporter => compiler.reporter;
AstConstant evaluate(Node node) {
@@ -594,7 +594,7 @@ class CompileTimeConstantEvaluator extends Visitor<AstConstant> {
}
AstConstant visitLiteralSymbol(LiteralSymbol node) {
- InterfaceType type = coreTypes.symbolType;
+ InterfaceType type = commonElements.symbolType;
String text = node.slowNameString;
List<AstConstant> arguments = <AstConstant>[
new AstConstant(context, node, new StringConstantExpression(text),
@@ -810,10 +810,10 @@ class CompileTimeConstantEvaluator extends Visitor<AstConstant> {
if (condition == null || condition.isError) {
return condition;
} else if (!condition.value.isBool) {
- DartType conditionType = condition.value.getType(coreTypes);
+ DartType conditionType = condition.value.getType(commonElements);
if (isEvaluatingConstant) {
reporter.reportErrorMessage(node.condition, MessageKind.NOT_ASSIGNABLE,
- {'fromType': conditionType, 'toType': coreTypes.boolType});
+ {'fromType': conditionType, 'toType': commonElements.boolType});
return new ErroneousAstConstant(context, node);
}
return null;
@@ -1008,38 +1008,38 @@ class CompileTimeConstantEvaluator extends Visitor<AstConstant> {
}
if (!firstArgument.isString) {
- DartType type = defaultValue.getType(coreTypes);
+ DartType type = defaultValue.getType(commonElements);
return reportNotCompileTimeConstant(
normalizedArguments[0].node,
MessageKind.NOT_ASSIGNABLE,
- {'fromType': type, 'toType': coreTypes.stringType});
+ {'fromType': type, 'toType': commonElements.stringType});
}
if (constructor.isIntFromEnvironmentConstructor &&
!(defaultValue.isNull || defaultValue.isInt)) {
- DartType type = defaultValue.getType(coreTypes);
+ DartType type = defaultValue.getType(commonElements);
return reportNotCompileTimeConstant(
normalizedArguments[1].node,
MessageKind.NOT_ASSIGNABLE,
- {'fromType': type, 'toType': coreTypes.intType});
+ {'fromType': type, 'toType': commonElements.intType});
}
if (constructor.isBoolFromEnvironmentConstructor &&
!(defaultValue.isNull || defaultValue.isBool)) {
- DartType type = defaultValue.getType(coreTypes);
+ DartType type = defaultValue.getType(commonElements);
return reportNotCompileTimeConstant(
normalizedArguments[1].node,
MessageKind.NOT_ASSIGNABLE,
- {'fromType': type, 'toType': coreTypes.boolType});
+ {'fromType': type, 'toType': commonElements.boolType});
}
if (constructor.isStringFromEnvironmentConstructor &&
!(defaultValue.isNull || defaultValue.isString)) {
- DartType type = defaultValue.getType(coreTypes);
+ DartType type = defaultValue.getType(commonElements);
return reportNotCompileTimeConstant(
normalizedArguments[1].node,
MessageKind.NOT_ASSIGNABLE,
- {'fromType': type, 'toType': coreTypes.stringType});
+ {'fromType': type, 'toType': commonElements.stringType});
}
String name = firstArgument.primitiveValue.slowToString();
@@ -1209,7 +1209,7 @@ class ConstructorEvaluator extends CompileTimeConstantEvaluator {
void potentiallyCheckType(TypedElement element, AstConstant constant) {
if (compiler.options.enableTypeAssertions) {
DartType elementType = element.type.substByContext(constructedType);
- DartType constantType = constant.value.getType(coreTypes);
+ DartType constantType = constant.value.getType(commonElements);
if (!constantSystem.isSubtype(
compiler.types, constantType, elementType)) {
reporter.withCurrentElement(constant.element, () {
« no previous file with comments | « pkg/compiler/lib/src/common/resolution.dart ('k') | pkg/compiler/lib/src/compiler.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698