@@ -85,7 +85,7 @@ func (b *bricksInterpreter) ExitBuild(ctx *parser.BuildContext) {
8585 if neededCollection , ok := firstValue .(model.Collection ); ok {
8686 if providedCollection , ok := secondValue .(model.Collection ); ok {
8787 result := services .Build (& neededCollection , & providedCollection , mode )
88- b .stack .push (result )
88+ b .stack .push (* result )
8989 } else {
9090 log .Fatal ("The second operand of build must be a collection" )
9191 return
@@ -101,7 +101,7 @@ func (b *bricksInterpreter) ExitIdentifier(ctx *parser.IdentifierContext) {
101101 if ! ok {
102102 log .Fatalf ("The variable '%s' is not defined" , ctx .ID ().GetText ())
103103 }
104- b .stack .push (model . DeepClone ( value ))
104+ b .stack .push (value . Clone ( ))
105105}
106106
107107func (b * bricksInterpreter ) ExitLoad (ctx * parser.LoadContext ) {
@@ -115,29 +115,29 @@ func (b *bricksInterpreter) ExitLoad(ctx *parser.LoadContext) {
115115func (b * bricksInterpreter ) ExitImport_ (ctx * parser.Import_Context ) {
116116 filePath := strings .Trim (ctx .STRING ().GetText (), "\" " )
117117
118- b .stack .push (services .ImportCSVCollection (filePath ))
118+ b .stack .push (* services .ImportCSVCollection (filePath ))
119119}
120120
121121func (b * bricksInterpreter ) ExitAllParts (ctx * parser.AllPartsContext ) {
122122 allParts := b .usersAPI .GetAllParts ()
123- b .stack .push (allParts )
123+ b .stack .push (* allParts )
124124}
125125
126126func (b * bricksInterpreter ) ExitLost (ctx * parser.LostContext ) {
127127 lostParts := b .usersAPI .GetLostParts ()
128- b .stack .push (lostParts )
128+ b .stack .push (* lostParts )
129129}
130130
131131func (b * bricksInterpreter ) ExitSet (ctx * parser.SetContext ) {
132132 includeMiniFigs := ctx .BOOL () != nil && ctx .BOOL ().GetText () == "true"
133133 setParts := api .RetrieveSetParts (b .bricksAPI , ctx .SET_NUM ().GetText (), includeMiniFigs )
134- b .stack .push (setParts )
134+ b .stack .push (* setParts )
135135}
136136
137137func (b * bricksInterpreter ) ExitUserSet (ctx * parser.UserSetContext ) {
138138 includeMiniFigs := ctx .BOOL () != nil && ctx .BOOL ().GetText () == "true"
139139 userSetParts := api .RetrieveUserSetParts (b .bricksAPI , b .usersAPI , ctx .SET_NUM ().GetText (), includeMiniFigs )
140- b .stack .push (userSetParts )
140+ b .stack .push (* userSetParts )
141141}
142142
143143func (b * bricksInterpreter ) ExitSetList (ctx * parser.SetListContext ) {
@@ -151,7 +151,7 @@ func (b *bricksInterpreter) ExitSetList(ctx *parser.SetListContext) {
151151 collection := services .MergeAllCollections (setListParts )
152152 collection .SortByColorAndName (false )
153153
154- b .stack .push (collection )
154+ b .stack .push (* collection )
155155}
156156
157157func (b * bricksInterpreter ) ExitPartList (ctx * parser.PartListContext ) {
@@ -160,23 +160,23 @@ func (b *bricksInterpreter) ExitPartList(ctx *parser.PartListContext) {
160160 log .Fatal (err )
161161 }
162162 partListParts := b .usersAPI .GetPartListParts (uint (partListId ))
163- b .stack .push (partListParts )
163+ b .stack .push (* partListParts )
164164}
165165
166166func (b * bricksInterpreter ) ExitPartLists (ctx * parser.PartListsContext ) {
167167 filePath := strings .Trim (ctx .STRING ().GetText (), "\" " )
168168 includeNonBuildable := ctx .BOOL () != nil && ctx .BOOL ().GetText () == "true"
169169 collections := api .RetrievePartListsParts (b .usersAPI , filePath , includeNonBuildable )
170170 collection := services .MergeAllCollections (collections )
171- b .stack .push (collection )
171+ b .stack .push (* collection )
172172}
173173
174174func (b * bricksInterpreter ) ExitSum (ctx * parser.SumContext ) {
175175 log .Printf ("Calculating sum" )
176176
177177 sum := model .NewCollection ()
178178
179- for range ctx .AllCollectionExp () {
179+ for range ctx .AllCollectionOrId () {
180180 value := b .stack .pop ()
181181 if summand , ok := value .(model.Collection ); ok {
182182 sum .Add (& summand )
@@ -185,7 +185,7 @@ func (b *bricksInterpreter) ExitSum(ctx *parser.SumContext) {
185185 }
186186 }
187187
188- b .stack .push (sum )
188+ b .stack .push (* sum )
189189}
190190
191191func (b * bricksInterpreter ) ExitSubtract (ctx * parser.SubtractContext ) {
@@ -209,15 +209,15 @@ func (b *bricksInterpreter) ExitMax(ctx *parser.MaxContext) {
209209 log .Printf ("Calculating maximum" )
210210
211211 max := model .NewCollection ()
212- for range ctx .AllCollectionExp () {
212+ for range ctx .AllCollectionOrId () {
213213 value := b .stack .pop ()
214214 if collection , ok := value .(model.Collection ); ok {
215215 max .Max (& collection )
216216 } else {
217217 log .Fatal ("Only collections can be compared" )
218218 }
219219
220- b .stack .push (max )
220+ b .stack .push (* max )
221221 }
222222}
223223
0 commit comments