'From etoys2.1 of 26 July 2007 [latest update: #1596] on 7 September 2007 at 3:50:02 pm'! "Change Set: EmptyConditional-yo Date: 7 September 2007 Author: Yoshiki Ohshima Make Sexp form work when testPart is empty."! !CompoundTileMorph methodsFor: 'code generation' stamp: 'yo 9/7/2007 15:31'! sexpWith: dictionary | n elements test | n _ SExpElement keyword: #condition. test _ self sexpBlockElementsFor: testPart with: dictionary. test ifEmpty: [test _ SExpElement keyword: #sequence elements: #()] ifNotEmpty: [test _ test first]. elements _ Array with: test with: (self sexpBlockFor: yesPart with: dictionary) with: (self sexpBlockFor: noPart with: dictionary). ^ n elements: elements. ! ! !PhraseTileMorph methodsFor: 'code generation' stamp: 'yo 9/7/2007 15:42'! sexpOperatorWith: dictionary | op n elements sel | n _ SExpElement keyword: #send. op _ submorphs second operatorOrExpression. (self owner isKindOf: TilePadMorph) ifTrue: [ n attributeAt: #type put: owner type. ] ifFalse: [ (#(< > = <= >= ~= isDivisibleBy:) includes: op) ifTrue: [ "op _ (TileMorph classPool at: #EqualityOperators) at: op ifAbsent: [op]." n attributeAt: #type put: 'Boolean'. ] ifFalse: [ n attributeAt: #type put: 'unknown'. "this had some scary consequence". ]. ]. elements _ OrderedCollection new: 3. sel _ SExpElement keyword: #selector. (self isGetter: op) ifTrue: [ sel attributeAt: #getter put: (Utilities inherentSelectorForGetter: op). ] ifFalse: [ sel attributeAt: #selector put: op. ]. elements add: sel. elements add: (submorphs first sexpWith: dictionary). ((submorphs second isMemberOf: TileCommandWithArgumentMorph) or: [ submorphs second isMemberOf: KedamaGetColorComponentTile]) ifTrue: [ elements add: (submorphs second sexpWith: dictionary) ]. (3 to: submorphs size) do: [:e | elements add: ((submorphs at: e) sexpWith: dictionary). ]. n elements: elements asArray. ^ n. ! ! !ScriptEditorMorphBuilder methodsFor: 'reconstituting scripting tiles ' stamp: 'yo 9/7/2007 15:37'! condition: sexp | p testPart yesPart noPart n | testPart _ self fromSexp: (sexp elements first). yesPart _ self fromSexp: (sexp elements second). noPart _ self fromSexp: (sexp elements third). p _ CompoundTileMorph new. testPart = #() ifFalse: [ p submorphs first submorphs last addNewRow addMorph: testPart. ]. yesPart do: [:e | n _ p submorphs second submorphs last addNewRow. n addMorph: e. ]. noPart do: [:e | n _ p submorphs third submorphs last addNewRow. n addMorph: e. ]. ^ p. ! !