Spaces:
Running
Running
File size: 929 Bytes
8f3f8db |
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 |
transformations
extractExportDirective
"Scan the top-level statements for an inlining directive of the form:
self export: <boolean>
and remove the directive from the method body. Return the argument of the directive or false if there is no export directive."
| result newStatements methodDirectiveFound |
result := false.
methodDirectiveFound := false.
newStatements := OrderedCollection new: parseTree statements size.
parseTree statements do: [ :stmt |
(stmt isSend and: [stmt selector = #export:]) ifTrue: [
methodDirectiveFound := true.
result := stmt args first value = true.
] ifFalse: [
newStatements add: stmt.
].
].
parseTree setStatements: newStatements asArray.
methodDirectiveFound ifTrue: [^ result].
"no method declaration was used, so check for a pragma declaration"
^self
extractDirective: #export:
valueBlock: [:sendNode| sendNode args first value ~= false]
default: false
|