--- a/Parser.st Sat Oct 01 06:55:17 2016 +0200
+++ b/Parser.st Sun Oct 02 06:59:15 2016 +0200
@@ -6452,7 +6452,14 @@
"/ self emptyStatement.
"/ ].
].
- arr := Array withAll:elements.
+
+ elements size == 0 ifTrue:[
+ "always return the same object for an empty array,
+ which is also immutable by definition"
+ ^ #().
+ ].
+
+ arr := elements asArray.
parserFlags arraysAreImmutable ifTrue:[
^ self makeImmutableArray:arr
@@ -6759,8 +6766,8 @@
|bytes index limit newArray elem pos1 pos2|
pos1 := tokenPosition.
- bytes := ByteArray uninitializedNew:5000.
index := 0. limit := 5000.
+ bytes := ByteArray uninitializedNew:limit.
[tokenType ~~ $] ] whileTrue:[
pos2 := tokenPosition.
"
@@ -6798,6 +6805,13 @@
].
self nextToken.
].
+
+ index == 0 ifTrue:[
+ "always return the same object for an empty byte array,
+ which is also immutable by definition"
+ ^ #[].
+ ].
+
newArray := ByteArray uninitializedNew:index.
newArray replaceFrom:1 to:index with:bytes startingAt:1.
parserFlags arraysAreImmutable ifTrue:[