Eliot Miranda uploaded a new version of VMMaker to project VM Maker: http://source.squeak.org/VMMaker/VMMaker.oscog-eem.2494.mcz ==================== Summary ==================== Name: VMMaker.oscog-eem.2494 Author: eem Time: 18 December 2018, 8:59:49.849545 pm UUID: 58de0292-515b-421f-873a-167c18fb7c92 Ancestors: VMMaker.oscog-eem.2493 Fix a regression in VMMaker.oscog-eem.2493 when generating returns of variables or constants. =============== Diff against VMMaker.oscog-eem.2493 =============== Item was changed: ----- Method: SmartSyntaxPluginTMethod>>fixUpReturnOneStmt:on: (in category 'transforming') ----- fixUpReturnOneStmt: stmt on: sStream | expr exprRetStmts "p t" | stmt isReturn ifFalse: [^sStream nextPut: stmt]. expr := stmt expression. (expr isSend + and: [self resultSendAlwaysFails: expr]) ifTrue: - and: [self resultSendAlwaysFails: expr]) ifTrue: ["failure returns" sStream nextPut: expr; nextPut: self nullReturnExpr. ^nil]. + (expr isVariable and: ['nil' = expr name]) ifTrue: - (expr isVariable and: ['nil' = expr name]) ifTrue: ["^ nil -- this is never right unless automatically generated" sStream nextPut: stmt. ^nil]. + (expr isVariable and: ['self' = expr name]) ifTrue: - (expr isVariable and: ['self' = expr name]) ifTrue: ["^ self" fullArgs isEmpty ifFalse: [sStream nextPut: (self statementGuardedWithSuccess: (self popExpr: fullArgs size))]. sStream nextPut: self nullReturnExpr. ^nil]. (expr isVariable or: [expr isConstant]) ifTrue: + ["^ variable or ^ constant without guardchecking" + sStream + nextPut: (sStream isEmpty "No statements to cause failure, therefore no need for failure guard." + ifTrue: + [self pop: fullArgs size + 1 thenReturnExpr: expr] + ifFalse: + [self statementGuardedWithSuccess: + (self pop: fullArgs size + 1 thenReturnExpr: expr)]); + nextPut: self nullReturnExpr. - ["^ variable or ^ constant or ^ expr without guardchecking" - fullArgs isEmpty ifFalse: - [sStream nextPut: (self statementGuardedWithSuccess: (self pop: fullArgs size + 1 thenReturnExpr: expr))]. - sStream nextPut: self nullReturnExpr. ^nil]. "^ expr with necessary guard checking" "p := sStream position." exprRetStmts := Array streamContents: [:ersStream| (self resultExpressionCanFail: expr) ifTrue: ["t := 1." ersStream nextPut: (self assign: (self oopVariable: '_return_value') expression: expr); nextPut: (self statementGuardedWithSuccess: (self pop: fullArgs size + 1 thenReturnExpr: (self oopVariable: '_return_value')))] ifFalse: ["t := 2." ersStream nextPut: (self pop: fullArgs size + 1 thenReturnExpr: expr)]]. sStream isEmpty "No statements to cause failure, therefore no need for an initial failure guard." ifTrue: [sStream nextPutAll: exprRetStmts] ifFalse: ["t := t + 2." sStream nextPut: (self statementGuardedWithSuccess: exprRetStmts)]. sStream nextPut: self nullReturnExpr. "Them := Dictionary new" "(Them at: t ifAbsentPut: [Dictionary new]) at: self selector put: (sStream originalContents copyFrom: p + 1 to: sStream position)"! |
Free forum by Nabble | Edit this page |