--- a/ClassBuilder.st Tue Sep 25 10:35:22 2018 +0200
+++ b/ClassBuilder.st Tue Sep 25 12:25:08 2018 +0200
@@ -1,5 +1,3 @@
-"{ Encoding: utf8 }"
-
"
COPYRIGHT (c) 2001 by eXept Software AG
All Rights Reserved
@@ -235,34 +233,40 @@
methodDict keysAndValuesDo:[:selector :method |
oldMethod := method originalMethodIfWrapped.
-
- "before parsing (which may take some time),
- do a string search if it's only one variable,
- we are looking for.
- Could look for more than one variable by string compare, but then
- parsing it right away may be faster ..."
-
- source := oldMethod source.
- ((nNames == 1) and:[superBoolean not]) ifTrue:[
- mustInvalidate := (source findString:(setOfNames first)) ~~ 0.
- ] ifFalse:[
- ((nNames == 0) and:[superBoolean]) ifTrue:[
- mustInvalidate := (source findString:'super') ~~ 0.
+ mustInvalidate := false.
+
+ "if we have no source, assume (hope) that the method is still valid.
+ When patching deployed systems without source, we
+ add instvar only to final classes at the end, so existing methods
+ should still be valid."
+ source notNil ifTrue:[
+ "before parsing (which may take some time),
+ do a string search if it's only one variable,
+ we are looking for.
+ Could look for more than one variable by string compare, but then
+ parsing it right away may be faster ..."
+
+ source := oldMethod source.
+ ((nNames == 1) and:[superBoolean not]) ifTrue:[
+ mustInvalidate := (source findString:(setOfNames first)) ~~ 0.
] ifFalse:[
- mustInvalidate := true
+ ((nNames == 0) and:[superBoolean]) ifTrue:[
+ mustInvalidate := (source findString:'super') ~~ 0.
+ ] ifFalse:[
+ mustInvalidate := true
+ ].
+ ].
+
+ mustInvalidate ifTrue:[
+ "we have to parse it ..."
+ p := newClass parserClass parseMethod:source in:newClass.
+ (p isNil
+ or:[(p usedVars includesAny:setOfNames)
+ or:[superBoolean and:[p usesSuper]]]) ifFalse:[
+ mustInvalidate := false
+ ]
].
].
-
- mustInvalidate ifTrue:[
- "we have to parse it ..."
- p := newClass parserClass parseMethod:source in:newClass.
- (p isNil
- or:[(p usedVars includesAny:setOfNames)
- or:[superBoolean and:[p usesSuper]]]) ifFalse:[
- mustInvalidate := false
- ]
- ].
-
mustInvalidate ifTrue:[
newMethod := oldMethod copy.
"/ Smalltalk silentLoading ifFalse:[