File tree Expand file tree Collapse file tree 3 files changed +20
-3
lines changed Expand file tree Collapse file tree 3 files changed +20
-3
lines changed Original file line number Diff line number Diff line change @@ -24,6 +24,14 @@ MethodMapExamples >> exampleAccessOuterFromCleanBlock [
24
24
^ [ thisContext tempNamed: ' b' ] value
25
25
]
26
26
27
+ { #category : ' examples' }
28
+ MethodMapExamples >> exampleAccessOuterFromFullBlock [
29
+ < compilerOptions: #(- optionCleanBlockClosure) >
30
+ | b |
31
+ b := 1 .
32
+ ^ [ thisContext tempNamed: ' b' ] value
33
+ ]
34
+
27
35
{ #category : ' examples' }
28
36
MethodMapExamples >> exampleConstantBlock [
29
37
Original file line number Diff line number Diff line change @@ -113,7 +113,16 @@ MethodMapTest >> testDeadContextSourceNode [
113
113
114
114
{ #category : ' tests - temp access' }
115
115
MethodMapTest >> testExampleAccessOuterFromCleanBlock [
116
- self assert: (self compileAndRunExample: #exampleAccessOuterFromCleanBlock ) equals: 1
116
+ " Should rise an exception since we are trying to access outerContext from a clean block"
117
+ self should: [(self compileAndRunExample: #exampleAccessOuterFromCleanBlock )] raise: Exception .
118
+
119
+ ]
120
+
121
+ { #category : ' tests - temp access' }
122
+ MethodMapTest >> testExampleAccessOuterFromFullBLock [
123
+
124
+ self assert: (self compileAndRunExample: #exampleAccessOuterFromFullBlock ) equals: 1
125
+
117
126
]
118
127
119
128
{ #category : ' tests - temp access' }
Original file line number Diff line number Diff line change @@ -33,15 +33,15 @@ OCContextTempMappingTest >> fetchArgFromOptimizedBlockInsideFullBlock: anArg ext
33
33
34
34
{ #category : ' tests' }
35
35
OCContextTempMappingTest >> testAccessingArgOfOuterBlockFromAnotherDeepBlock [
36
-
36
+ < compilerOptions: #(- optionCleanBlockClosure) >
37
37
| actual |
38
38
39
39
" Check the source code availability to do not fail on images without sources"
40
40
thisContext method hasSourceCode ifFalse: [ ^ self skip ].
41
41
42
42
actual := [:outerArg |
43
43
outerArg asString.
44
- [ :innerArg | innerArg asString. thisContext tempNamed: #outerArg ] value: #innerValue .
44
+ [ :innerArg | innerArg asString.thisContext tempNamed: #outerArg ] value: #innerValue .
45
45
] value: #outerValue .
46
46
47
47
self assert: actual equals: #outerValue
You can’t perform that action at this time.
0 commit comments