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

Unified Diff: pkg/compiler/lib/src/ssa/builder_kernel.dart

Issue 2918913003: Handle list and map literals (Closed)
Patch Set: Rebased Created 3 years, 7 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: pkg/compiler/lib/src/ssa/builder_kernel.dart
diff --git a/pkg/compiler/lib/src/ssa/builder_kernel.dart b/pkg/compiler/lib/src/ssa/builder_kernel.dart
index 3f5fb4d7fb8b98cbb664f6f056c0b883c556e10a..74325db5a8a43094c0c3d7fbe2f68721125f779f 100644
--- a/pkg/compiler/lib/src/ssa/builder_kernel.dart
+++ b/pkg/compiler/lib/src/ssa/builder_kernel.dart
@@ -650,13 +650,13 @@ class KernelSsaBuilder extends ir.Visitor with GraphBuilder {
closeFunction();
}
- void addImplicitInstantiation(ResolutionDartType type) {
+ void addImplicitInstantiation(DartType type) {
if (type != null) {
currentImplicitInstantiations.add(type);
}
}
- void removeImplicitInstantiation(ResolutionDartType type) {
+ void removeImplicitInstantiation(DartType type) {
if (type != null) {
currentImplicitInstantiations.removeLast();
}
@@ -1830,15 +1830,15 @@ class KernelSsaBuilder extends ir.Visitor with GraphBuilder {
}
/// Set the runtime type information if necessary.
- HInstruction setListRuntimeTypeInfoIfNeeded(
+ HInstruction _setListRuntimeTypeInfoIfNeeded(
HInstruction object, ir.ListLiteral listLiteral) {
- ResolutionInterfaceType type = localsHandler
- .substInContext(astAdapter.getDartTypeOfListLiteral(listLiteral));
+ InterfaceType type = localsHandler.substInContext(_commonElements
+ .listType(_elementMap.getDartType(listLiteral.typeArgument)));
if (!rtiNeed.classNeedsRti(type.element) || type.treatAsRaw) {
return object;
}
List<HInstruction> arguments = <HInstruction>[];
- for (ResolutionDartType argument in type.typeArguments) {
+ for (DartType argument in type.typeArguments) {
arguments.add(typeBuilder.analyzeTypeArgument(argument, sourceElement));
}
// TODO(15489): Register at codegen.
@@ -1862,7 +1862,7 @@ class KernelSsaBuilder extends ir.Visitor with GraphBuilder {
new HLiteralList(elements, commonMasks.extendableArrayType);
add(listInstruction);
listInstruction =
- setListRuntimeTypeInfoIfNeeded(listInstruction, listLiteral);
+ _setListRuntimeTypeInfoIfNeeded(listInstruction, listLiteral);
}
TypeMask type = _typeInferenceMap.typeOfListLiteral(
@@ -1905,14 +1905,14 @@ class KernelSsaBuilder extends ir.Visitor with GraphBuilder {
assert(
constructor is ConstructorEntity && constructor.isFactoryConstructor);
- ResolutionInterfaceType type = localsHandler
- .substInContext(astAdapter.getDartTypeOfMapLiteral(mapLiteral));
-
+ InterfaceType type = localsHandler.substInContext(_commonElements.mapType(
+ _elementMap.getDartType(mapLiteral.keyType),
+ _elementMap.getDartType(mapLiteral.valueType)));
ClassEntity cls = constructor.enclosingClass;
if (rtiNeed.classNeedsRti(cls)) {
List<HInstruction> typeInputs = <HInstruction>[];
- type.typeArguments.forEach((ResolutionDartType argument) {
+ type.typeArguments.forEach((DartType argument) {
typeInputs
.add(typeBuilder.analyzeTypeArgument(argument, sourceElement));
});

Powered by Google App Engine
This is Rietveld 408576698