Skip to content

Commit 42634de

Browse files
fix(parser): remove map-specific code from the parser
The parser utility functions getKeyed() and setKeyed() treat instances of the List and Map classes specially. For maps, the existing code assumes that keys are always strings. If that is not the case, an exception is likely thrown by the Map implementation. As map keys are not necessarily strings, and there is code that handles generic instances just fine, this commit simply removes the code that treats maps specially. Closes dart-archive#608
1 parent 259ac5b commit 42634de

File tree

1 file changed

+0
-4
lines changed

1 file changed

+0
-4
lines changed

lib/core/parser/utils.dart

-4
Original file line numberDiff line numberDiff line change
@@ -74,8 +74,6 @@ Function ensureFunctionFromMap(Map map, String name) {
7474
getKeyed(object, key) {
7575
if (object is List) {
7676
return object[key.toInt()];
77-
} else if (object is Map) {
78-
return object["$key"]; // toString dangerous?
7977
} else if (object == null) {
8078
throw new EvalError('Accessing null object');
8179
} else {
@@ -89,8 +87,6 @@ setKeyed(object, key, value) {
8987
int index = key.toInt();
9088
if (object.length <= index) object.length = index + 1;
9189
object[index] = value;
92-
} else if (object is Map) {
93-
object["$key"] = value; // toString dangerous?
9490
} else {
9591
object[key] = value;
9692
}

0 commit comments

Comments
 (0)