Groovy evaluator: fix in workspace variables management
When updating workspace variables from Groovy's Binding object, only update
those that really changed. This avoids unnecessary unwrap and - more importantly,
identity is preserved in case the variable is not touched by the evaluated code.
--- a/GroovyEvaluator.st Wed Apr 22 11:24:11 2015 +0100
+++ b/GroovyEvaluator.st Sat Apr 25 12:05:13 2015 +0100
@@ -20,6 +20,8 @@
"
"{ Package: 'stx:libjava' }"
+"{ NameSpace: Smalltalk }"
+
Object subclass:#GroovyEvaluator
instanceVariableNames:'requestor source'
classVariableNames:'WorkspaceShell'
@@ -257,7 +259,11 @@
| value |
value := context getVariable: name.
- pair second value: (value class javaUnwrap: value).
+ "/ Update variable if it has been changed during
+ "/ evaluation
+ value ~~ pair second value ifTrue:[
+ pair second value: (value class javaUnwrap: value).
+ ].
].
].
] on: JAVA org codehaus groovy control CompilationFailedException do:[:ex|
@@ -267,7 +273,7 @@
^ result class javaUnwrap: result.
"Created: / 19-02-2014 / 09:13:06 / Jan Vrany <jan.vrany@fit.cvut.cz>"
- "Modified: / 06-08-2014 / 14:01:04 / Jan Vrany <jan.vrany@fit.cvut.cz>"
+ "Modified: / 25-04-2015 / 11:58:34 / Jan Vrany <jan.vrany@fit.cvut.cz>"
! !
!GroovyEvaluator methodsFor:'error reporting'!