Skip to content

Commit 0f88d34

Browse files
author
Patrik
committed
Eliminating duplicate code
1 parent 0707bb2 commit 0f88d34

File tree

1 file changed

+10
-11
lines changed
  • filetree/Neo-JSON-Core.package/NeoJSONObject.class/class

1 file changed

+10
-11
lines changed
Lines changed: 10 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -1,17 +1,16 @@
11
convenience
22
fromStream: readStream
33
"Parse stream as JSON, so that maps become instances of me and lists instances of NeoJSONArray"
4+
| jsonReader |
45

5-
Smalltalk globals isDictionary
6+
jsonReader := Smalltalk globals isDictionary
67
ifTrue: [ "Pharo"
7-
^ (NeoJSONReader on: readStream readStream)
8-
mapClass: self;
9-
listClass: NeoJSONArray;
10-
propertyNamesAsSymbols: true;
11-
next ]
8+
NeoJSONReader on: readStream readStream ]
129
ifFalse: [ "GemStone"
13-
^ (NeoJSONReader on: readStream)
14-
mapClass: self;
15-
listClass: NeoJSONArray;
16-
propertyNamesAsSymbols: true;
17-
next ]
10+
NeoJSONReader on: readStream ].
11+
12+
^ jsonReader
13+
mapClass: self;
14+
listClass: NeoJSONArray;
15+
propertyNamesAsSymbols: true;
16+
next

0 commit comments

Comments
 (0)