#DOCUMENTATION by cg
class: Method
comment/format in:
#asExecutableMethodWithSource:
#documentation
#parseAnnotations
#parseResources
--- a/Method.st Fri Nov 04 16:09:33 2016 +0100
+++ b/Method.st Fri Nov 04 16:10:35 2016 +0100
@@ -115,7 +115,7 @@
LastFileReference weak reference to the last sourceFile
LastSourceFileName to speedup source access via NFS
- WARNING: layout known by compiler and runtime system - dont change
+ WARNING: layout known by compiler and runtime system - don't change
[author:]
Claus Gittinger
@@ -1058,7 +1058,6 @@
"Modified (format): / 18-11-2011 / 14:47:06 / cg"
! !
-
!Method methodsFor:'accessing-visibility'!
isIgnored
@@ -1462,8 +1461,8 @@
cls := self containingClass.
cls isNil ifTrue:[
- 'Method [warning]: cannot generate bytecode (no class for compilation)' errorPrintCR.
- ^ nil
+ 'Method [warning]: cannot generate bytecode (no class for compilation)' errorPrintCR.
+ ^ nil
].
"we have to sequentialize this using a lock-semaphore,
@@ -1473,60 +1472,60 @@
(happened when autoloading animation demos)
"
CompilationLock critical:[
- "
- dont want this to go into the changes file,
- dont want output on Transcript and definitely
- dont want a lazy method ...
- "
- Class withoutUpdatingChangesDo:[
- |silent lazy|
-
- silent := Smalltalk silentLoading:true.
- lazy := Compiler compileLazy:false.
-
- [
- |compiler|
-
- Class nameSpaceQuerySignal answer:(cls nameSpace)
- do:[
- compiler := cls compilerClass.
-
- "/
- "/ kludge - have to make ST/X's compiler protocol
- "/ be compatible to ST-80's
- "/
- (compiler respondsTo:#compile:forClass:inCategory:notifying:install:)
- ifTrue:[
- temporaryMethod := compiler
- compile:newSource
- forClass:cls
- inCategory:(self category)
- notifying:nil
- install:false.
- ] ifFalse:[
- temporaryMethod := compiler new
- compile:newSource
- in:cls
- notifying:nil
- ifFail:nil
- ].
- ].
- ] ensure:[
- Compiler compileLazy:lazy.
- Smalltalk silentLoading:silent.
- ]
- ].
+ "
+ don't want this to go into the changes file,
+ don't want output on Transcript and definitely
+ don't want a lazy method ...
+ "
+ Class withoutUpdatingChangesDo:[
+ |silent lazy|
+
+ silent := Smalltalk silentLoading:true.
+ lazy := Compiler compileLazy:false.
+
+ [
+ |compiler|
+
+ Class nameSpaceQuerySignal answer:(cls nameSpace)
+ do:[
+ compiler := cls compilerClass.
+
+ "/
+ "/ kludge - have to make ST/X's compiler protocol
+ "/ be compatible to ST-80's
+ "/
+ (compiler respondsTo:#compile:forClass:inCategory:notifying:install:)
+ ifTrue:[
+ temporaryMethod := compiler
+ compile:newSource
+ forClass:cls
+ inCategory:(self category)
+ notifying:nil
+ install:false.
+ ] ifFalse:[
+ temporaryMethod := compiler new
+ compile:newSource
+ in:cls
+ notifying:nil
+ ifFail:nil
+ ].
+ ].
+ ] ensure:[
+ Compiler compileLazy:lazy.
+ Smalltalk silentLoading:silent.
+ ]
+ ].
].
(temporaryMethod isNil or:[temporaryMethod == #Error]) ifTrue:[
- 'Method [warning]: cannot generate bytecode (contains primitive code or error)' errorPrintCR.
- ^ nil.
+ 'Method [warning]: cannot generate bytecode (contains primitive code or error)' errorPrintCR.
+ ^ nil.
].
"/
"/ try to save a bit of memory, by sharing the source (whatever it is)
"/
temporaryMethod source:newSource.
"/
- "/ dont forget the methods class & package ...
+ "/ don't forget the methods class & package ...
"/
temporaryMethod setPackage:package.
temporaryMethod mclass:(self getMclass).
@@ -3142,15 +3141,15 @@
src := self source.
src isNil ifTrue:[
- ^ nil "/ actually: dont know
+ ^ nil "/ actually: don't know
].
self parserClass isNil ifTrue:[
- ^ nil
+ ^ nil
].
parser := self parserClass parseMethod: src.
(parser isNil or: [parser == #Error]) ifTrue:[
- ^ nil "/ actually error
+ ^ nil "/ actually error
].
^ annotations := parser annotations.
@@ -3160,26 +3159,26 @@
parseResources
"return the method's resource spec; either nil or a collection of symbols.
Resources are a special kind of annotation, of the form:
- <resource: #symbol...>
+ <resource: #symbol...>
and flags methods which depend on keyboard bindings or provide menus, specs or bitmap images"
|src parser|
src := self source.
src isNil ifTrue:[
- ^ nil "/ actually: dont know
+ ^ nil "/ actually: don't know
].
(src findString:'resource:') == 0 ifTrue:[
- ^ nil "/ actually: error
+ ^ nil "/ actually: error
].
"/ no need to parse all - only interested in resource-info
self parserClass isNil ifTrue:[
- ^ nil
+ ^ nil
].
parser := self parserClass parseMethodArgAndVarSpecificationSilent:src in:nil.
parser isNil ifTrue:[
- ^ nil "/ actually error
+ ^ nil "/ actually error
].
^ parser primitiveResources.
!
@@ -3729,7 +3728,6 @@
"Created: / 23-07-2012 / 11:16:36 / cg"
! !
-
!Method methodsFor:'source management'!
revisionInfo