<div dir="ltr"><div>Ah yes, I see a related issue now for the simple ifTrue: / or ifFalse:</div><div><br></div><div>    x := self check ifTrue: [ 2 ]</div><div><br></div><div>will be transformed into</div><div><br></div><div>    self check ifTrue: [x := 2]</div><div><br></div><div>missing the implicit  x := nil in the false branch!</div><div><br></div><div>Also we lost many valid ()?: for some reason to be inquired.<br></div><div><br></div><div><br></div></div><br><div class="gmail_quote"><div dir="ltr" class="gmail_attr">Le mar. 23 juin 2020 à 20:25, Nicolas Cellier <<a href="mailto:nicolas.cellier.aka.nice@gmail.com">nicolas.cellier.aka.nice@gmail.com</a>> a écrit :<br></div><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex"><div dir="ltr"><div dir="ltr"><br></div><br><div class="gmail_quote"><div dir="ltr" class="gmail_attr">Le mar. 23 juin 2020 à 19:32, Eliot Miranda <<a href="mailto:eliot.miranda@gmail.com" target="_blank">eliot.miranda@gmail.com</a>> a écrit :<br></div><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex"> <div dir="ltr"><div dir="ltr"><div dir="ltr"><div dir="ltr">Hi Nicolas,<br><div><br></div><div>   on reviewing this code first I really like transformInAssignmentTo: ; it's a much nicer design than my hack.  Now, a specific issue...</div><div><br></div><div>I see </div><div><div>TReturnNode>>transformInAssignmentTo: aTVariableNode</div><div><span style="white-space:pre-wrap">  </span>"a return shall not be assigned:</div><div><span style="white-space:pre-wrap">            </span>x := condition ifTrue: [^nil] ifFalse: [2]</div><div><span style="white-space:pre-wrap">       </span>shall be transformed into:</div><div><span style="white-space:pre-wrap">               </span>condition ifTrue: [^nil] ifFalse: [x := 2]"</div><div><span style="white-space:pre-wrap"> </span></div><div><span style="white-space:pre-wrap"> </span>^self</div></div><div><br></div><div>The issue here is that if x is a global variable then a necessary side-effect will be lost.  Hence I think we need to refactor transformInAssignmentTo: to transformInAssignmentTo:codeGen: so that we can query whether the variable is in fact global in the current scope.</div></div></div></div></div><br></blockquote><div>Hi Eliot,</div><div>I do not really understand the concern here...</div><div>I fail to see the relation with the lifetime of the variable</div>Do you have an example?</div><div class="gmail_quote">Or does it interfere with some inlining tricks?<br></div></div>
</blockquote></div>