# HG changeset patch # User Claus Gittinger # Date 974849510 -3600 # Node ID 5f97733ff519b5f3765d06c1678bec305d2deb10 # Parent 0ddf31b08b3bb4bd482599683bc7240f65f71b2b methods now send change-notifications when the category changes faster resources-parsing diff -r 0ddf31b08b3b -r 5f97733ff519 Method.st --- a/Method.st Tue Nov 21 16:16:25 2000 +0100 +++ b/Method.st Wed Nov 22 00:31:50 2000 +0100 @@ -237,23 +237,23 @@ sourceFilename := manager nextObject. sourcePos := manager nextObject. sourcePos isNil ifTrue:[ - source := manager nextObject. + source := manager nextObject. ]. code := manager nextObject. snapId == ObjectMemory snapshotID ifTrue:[ - ObjectMemory incrementSnapshotID + ObjectMemory incrementSnapshotID ]. m := Method basicNew:(lits size). - cat notNil ifTrue:[m category:cat]. + cat notNil ifTrue:[m setCategory:cat]. m flags:flags. m literals:lits. m byteCode:code. sourcePos isNil ifTrue:[ - m source:source + m source:source ] ifFalse:[ - m sourceFilename:sourceFilename position:sourcePos + m sourceFilename:sourceFilename position:sourcePos ]. ^ m @@ -315,8 +315,16 @@ category:aStringOrSymbol "set the methods category" + |newCategory oldCategory| + aStringOrSymbol notNil ifTrue:[ - category := aStringOrSymbol asSymbol + newCategory := aStringOrSymbol. + newCategory ~= (oldCategory := category) ifTrue:[ + self setCategory:newCategory. + self changed:#category with:oldCategory. + self mclass changed:#organization with:self selector. + Smalltalk changed:#methodCategory with:(Array with:self mclass with:self with:oldCategory). + ] ] "Modified: / 13.11.1998 / 23:55:05 / cg" @@ -447,6 +455,16 @@ package := aSymbol ! +setCategory:aStringOrSymbol + "set the methods category (without change notification)" + + aStringOrSymbol notNil ifTrue:[ + category := aStringOrSymbol asSymbol + ] + + "Modified: / 13.11.1998 / 23:55:05 / cg" +! + setPackage:aSymbol "set the package-symbol" @@ -2226,6 +2244,28 @@ " ! +parseResources + "return the methods resource spec; either nil, a single symbol + or a collection of symbols." + + |src parser| + + src := self source. + src isNil ifTrue:[ + ^ nil "/ actually: dont know + ]. + + (src findString:'resource:') == 0 ifTrue:[ + ^ nil "/ actually: error + ]. + "/ no need to parse all - only interested in resource-info + parser := Parser parseMethodArgAndVarSpecificationSilent:src in:nil. + parser isNil ifTrue:[ + ^ nil "/ actually error + ]. + ^ parser primitiveResources. +! + previousVersion |history entry| @@ -2285,26 +2325,29 @@ |src parser| self hasResource ifFalse:[^ nil]. - - src := self source. - src isNil ifTrue:[ - ^ nil "/ actually: dont know - ]. - - (src findString:'resource:') == 0 ifTrue:[ - ^ nil "/ actually: error - ]. - parser := Parser - parseMethod:src - in:nil - ignoreErrors:true - ignoreWarnings:true. - parser isNil ifTrue:[ - ^ nil "/ actually error - ]. - ^ parser primitiveResources. - - "Created: / 26.10.1997 / 16:23:18 / cg" + ^ self parseResources. + +"/ src := self source. +"/ src isNil ifTrue:[ +"/ ^ nil "/ actually: dont know +"/ ]. +"/ +"/ (src findString:'resource:') == 0 ifTrue:[ +"/ ^ nil "/ actually: error +"/ ]. +"/ "/ no need to parse all - only interested in resource-info +"/ parser := Parser parseMethodArgAndVarSpecificationSilent:src in:nil. +"/"/ parser := Parser +"/"/ parseMethod:src +"/"/ in:nil +"/"/ ignoreErrors:true +"/"/ ignoreWarnings:true. +"/ parser isNil ifTrue:[ +"/ ^ nil "/ actually error +"/ ]. +"/ ^ parser primitiveResources. +"/ +"/ "Created: / 26.10.1997 / 16:23:18 / cg" ! selector @@ -2763,6 +2806,6 @@ !Method class methodsFor:'documentation'! version - ^ '$Header: /cvs/stx/stx/libbasic/Method.st,v 1.216 2000-11-14 14:04:56 cg Exp $' + ^ '$Header: /cvs/stx/stx/libbasic/Method.st,v 1.217 2000-11-21 23:31:50 cg Exp $' ! ! Method initialize!