You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
This repository was archived by the owner on Feb 22, 2018. It is now read-only.
The problem is in package:angular/core/parser/utils.dart, specifically in the getKeyed() and setKeyed() methods, which treat instances of the List and Map classes specially. For maps, the existing code assumes that keys are always strings:
/// Set a keyed element in the given [object].
setKeyed(object, key, value) {
if (object is List) {
int index = key.toInt();
if (object.length <= index) object.length = index + 1;
object[index] = value;
} else if (object is Map) {
object["$key"] = value; // toString dangerous?
} else {
object[key] = value;
}
return value;
}
The fix is simple: simply remove the Map-specific code:
/// Set a keyed element in the given [object].
setKeyed(object, key, value) {
if (object is List) {
int index = key.toInt();
if (object.length <= index) object.length = index + 1;
object[index] = value;
} else {
object[key] = value;
}
return value;
}
(This fix needs to be applied to getKeyed() as well.)
This fix works well locally -- should I submit a pull request?
The text was updated successfully, but these errors were encountered:
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.
Closesdart-archive#608
Referencing a map value in ng-model where the keys of the map are not strings results in an exception being thrown. Consider this markup:
(Where the type of cmp.fields is Map<Field, String>.)
Error, including stack trace:
The problem is in package:angular/core/parser/utils.dart, specifically in the getKeyed() and setKeyed() methods, which treat instances of the List and Map classes specially. For maps, the existing code assumes that keys are always strings:
The fix is simple: simply remove the Map-specific code:
(This fix needs to be applied to getKeyed() as well.)
This fix works well locally -- should I submit a pull request?
The text was updated successfully, but these errors were encountered: