Skip to content

Commit

Permalink
Merge pull request #17095 from MarcusDenker/17093-Backport-17090-Wron…
Browse files Browse the repository at this point in the history
…g-compilation-to-ConstantBlockClosure--0--1--value-

17093-Backport-17090-Wrong-compilation-to-ConstantBlockClosure
  • Loading branch information
MarcusDenker authored Sep 12, 2024
2 parents b368d31 + 669039e commit 5fcb57b
Show file tree
Hide file tree
Showing 3 changed files with 5 additions and 3 deletions.
4 changes: 3 additions & 1 deletion src/AST-Core-Tests/RBBlockNodeTest.class.st
Original file line number Diff line number Diff line change
Expand Up @@ -64,7 +64,9 @@ RBBlockNodeTest >> testIsConstant [
self assert: [ ] sourceNode isConstant.
self assert: [ 1 ] sourceNode isConstant.
self deny: [ ^1 ] sourceNode isConstant.
self deny: [ 1 sin. 1 ] sourceNode isConstant
"only one statement is allowed, even if the first is constant"
self deny: [ 1 sin. 1 ] sourceNode isConstant.
self deny: [ 1 . 1 ] sourceNode isConstant
]

{ #category : 'tests' }
Expand Down
2 changes: 1 addition & 1 deletion src/AST-Core-Tests/RBCodeSnippet.class.st
Original file line number Diff line number Diff line change
Expand Up @@ -193,7 +193,7 @@ RBCodeSnippet class >> badComments [
nodeAt: 'DDD 00EEE0548884449994A0CCC00 FFF';
styled: '""" 0 """ n """ . """ n """ 0 """';
formattedCode: '[ "a""b""f" 1. "c" "d" 2 "e" ]';
value: 1).
value: 2).
(self new
source: '"a" [ "b" : "c" x "d" : "e" y "f" | "g" ] "h"';
nodeAt: '888 00999000AAA030BBB000FFF0C0GGG000III00 JJJ';
Expand Down
2 changes: 1 addition & 1 deletion src/AST-Core/RBBlockNode.class.st
Original file line number Diff line number Diff line change
Expand Up @@ -285,7 +285,7 @@ RBBlockNode >> isConstant [
"is the block just returning a literal?"
^ body statements
ifEmpty: [ true "empty block returns nil" ]
ifNotEmpty: [:statements | statements first isLiteralNode ]
ifNotEmpty: [:statements | statements size = 1 and: [statements first isLiteralNode] ]
]

{ #category : 'errors' }
Expand Down

0 comments on commit 5fcb57b

Please sign in to comment.