@@ -137,24 +137,25 @@ class JsonObject<E> extends Object implements Map, Iterable {
137
137
int positionalArgs = 0 ;
138
138
if (mirror.positionalArguments != null ) positionalArgs = mirror.positionalArguments.length;
139
139
140
+ var property = _symbolToString (mirror.memberName);
141
+
140
142
if (mirror.isGetter && (positionalArgs == 0 )) {
141
143
//synthetic getter
142
- var property = mirror.memberName;
143
144
if (this .containsKey (property)) {
144
145
return this [property];
145
146
}
146
147
}
147
148
else if (mirror.isSetter && positionalArgs == 1 ) {
148
149
//synthetic setter
149
- var property = mirror.memberName.replaceAll ("=" , "" );
150
150
//if the property doesn't exist, it will only be added
151
151
//if isExtendable = true
152
+ property = property.replaceAll ("=" , "" );
152
153
this [property] = mirror.positionalArguments[0 ]; // args[0];
153
154
return this [property];
154
155
}
155
156
156
157
//if we get here, then we've not found it - throw.
157
- _log ("Not found: ${mirror . memberName }" );
158
+ _log ("Not found: ${property }" );
158
159
_log ("IsGetter: ${mirror .isGetter }" );
159
160
_log ("IsSetter: ${mirror .isGetter }" );
160
161
_log ("isAccessor: ${mirror .isAccessor }" );
@@ -209,6 +210,15 @@ class JsonObject<E> extends Object implements Map, Iterable {
209
210
210
211
}
211
212
213
+ String _symbolToString (value) {
214
+ if (value is Symbol ) {
215
+ return mirrors.MirrorSystem .getName (value);
216
+ }
217
+ else {
218
+ return value.toString ();
219
+ }
220
+ }
221
+
212
222
/***************************************************************************
213
223
* Iterable implementation methods and properties *
214
224
*/
@@ -284,7 +294,9 @@ class JsonObject<E> extends Object implements Map, Iterable {
284
294
bool containsValue (value) => _objectData.containsValue (value);
285
295
286
296
// Pass through to the inner _objectData map.
287
- bool containsKey (value) => _objectData.containsKey (value);
297
+ bool containsKey (value) {
298
+ return _objectData.containsKey (_symbolToString (value));
299
+ }
288
300
289
301
// Pass through to the inner _objectData map.
290
302
operator [](key) => _objectData[key];
0 commit comments