Method.st
branchjv
changeset 18070 d262e3aecaca
parent 18067 27352a7171ab
parent 15445 707b77342862
child 18079 7b5afc0ad3d5
--- a/Method.st	Fri Jun 28 11:29:14 2013 +0100
+++ b/Method.st	Mon Jul 01 22:14:20 2013 +0100
@@ -1910,151 +1910,6 @@
     "Modified: / 22-10-2010 / 12:07:25 / cg"
 !
 
-printStringForBrowserWithSelector:selector inClass:aClass
-    "return a printString to represent myself to the user in a browser.
-     Defined here to allow for browsers to deal with nonStandard pseudoMethods"
-
-    |s privInfo moreInfo p info n cls ns currentChangeSet isInChangeSet mthdPackage
-     userPreferences shownSelector suppressPackage timeRounded shadowsOrNot 
-     overAllCount counts|
-
-    moreInfo := ''.
-    privInfo := ''.
-    userPreferences := UserPreferences current.
-
-    ns := self nameSpace.
-    (ns notNil and:[ns isNameSpace]) ifTrue:[
-        moreInfo := moreInfo , 
-            ((' < %1 >' bindWith: ns name) asText emphasisAllAdd:
-                userPreferences emphasisForNamespacedCode)
-
-    ].
-
-    self isWrapped ifTrue:[
-        (MessageTracer isCounting:self) ifTrue:[
-            (MessageTracer isCountingByReceiverClass:self) ifTrue:[
-                overAllCount := (MessageTracer executionCountOfMethod:self).
-                moreInfo := moreInfo , (' (cnt: %1' bindWith:overAllCount printString allBold).
-                overAllCount ~~ 0 ifTrue:[
-                    counts := MessageTracer executionCountsByReceiverClassOfMethod:self.
-                    (counts keysSorted:[:a :b | (counts at:a) < (counts at:b)]) reverseDo:[:cls |
-                        |cnt clsName percentage|
-
-                        clsName := cls name.
-                        cnt := counts at:cls.
-                        percentage := ((cnt / overAllCount) * 100) rounded.
-                        moreInfo := moreInfo , ('; %1->%2%%' bindWith:clsName with:percentage).
-                    ].
-                ].
-                moreInfo := moreInfo , ')'.
-            ] ifFalse:[
-                (MessageTracer isCountingMemoryUsage:self) ifTrue:[
-                    moreInfo := moreInfo , (' (mem: %1 bytes avg)' bindWith:(MessageTracer memoryUsageOfMethod:self) printString allBold).
-                ] ifFalse:[
-                    moreInfo := moreInfo , (' (cnt: %1)' bindWith:(MessageTracer executionCountOfMethod:self) printString allBold).
-                ]
-            ].
-        ] ifFalse:[
-            (MessageTracer isTiming:self) ifTrue:[
-                info := MessageTracer executionTimesOfMethod:self.
-                ((n := info count) == 0) ifTrue:[
-                    moreInfo := moreInfo , (' (cnt: %1)' bindWith:n)
-                ] ifFalse:[
-                    timeRounded := [:millis |
-                        |rnd|
-                        rnd := (millis > 100)
-                                 ifTrue:[ 1 ]
-                                 ifFalse:[
-                                     (millis > 10)
-                                        ifTrue:[ 0.1 ]
-                                        ifFalse:[
-                                            (millis > 1)
-                                                ifTrue:[ 0.01 ]
-                                                ifFalse:[ 0.001 ]]].
-                        millis roundTo:rnd
-                    ].
-
-                    (n == 1 or:[ info avgTimeRounded = info minTimeRounded  ]) ifTrue:[
-                        moreInfo := moreInfo ,
-                                    (' (t: %1ms cnt: %2)'
-                                        bindWith:((timeRounded value:info avgTimeRounded) printString allBold)
-                                        with:n)
-                    ] ifFalse:[
-                        moreInfo := moreInfo ,
-                                    (' (avg: %1ms min: %2 max: %3 cnt: %4)'
-                                        bindWith:((timeRounded value:info avgTimeRounded) printString allBold)
-                                        with:((timeRounded value:info minTimeRounded) printString)
-                                        with:((timeRounded value:info maxTimeRounded) printString)
-                                        with:n)
-                    ].
-                ].
-            ] ifFalse:[
-                moreInfo := ' !!'
-            ]
-        ].
-    ].
-    p := self privacy.
-
-    p ~~ #public ifTrue:[
-        privInfo := (' (* ' , p , ' *)') allItalic.
-    ].
-
-"/    self isInvalid ifTrue:[
-"/        moreInfo := ' (** not executable **)'.
-"/    ].
-
-    (self isLazyMethod not and:[self isUnloaded]) ifTrue:[
-        moreInfo := ' (** unloaded **)'
-    ].
-
-    privInfo size ~~ 0 ifTrue:[
-        moreInfo := privInfo , ' ' , moreInfo
-    ].
-
-    s := shownSelector := (self selectorPrintStringInBrowserFor:selector class:aClass).
-
-    (cls := aClass) isNil ifTrue:[
-        cls := self containingClass
-    ].
-
-    currentChangeSet := ChangeSet current.
-    isInChangeSet := currentChangeSet includesChangeForClass:cls selector:selector.
-
-    isInChangeSet ifTrue:[
-        s := s asText emphasisAllAdd:(userPreferences emphasisForChangedCode)
-    ].
-
-    (cls isNil or:[(mthdPackage := self package) ~= cls package]) ifTrue:[
-        suppressPackage := false.
-        mthdPackage = PackageId noProjectID ifTrue:[
-            mthdPackage := '+'.
-            "/ suppressPackage := true
-        ].
-        suppressPackage ifFalse:[
-            shadowsOrNot := (self isShadowingExtension)
-                                ifTrue:[' shadowed' ]
-                                ifFalse:[ '' ].
-            p := ' [' , ((mthdPackage ? '?'), shadowsOrNot allBold) allItalic , '] '.
-            p := p asText emphasisAllAdd:(userPreferences emphasisForDifferentPackage).
-            s := s , ' ' , p
-        ].
-    ].
-
-    moreInfo size == 0 ifTrue:[^ s].
-
-    s := shownSelector , moreInfo.
-
-    self isInvalid ifTrue:[
-        s := s asText emphasizeAllWith:(userPreferences emphasisForObsoleteCode).
-    ].
-    ^ s
-
-    "Modified: / 23-01-1998 / 13:15:15 / stefan"
-    "Created: / 05-02-2000 / 22:55:56 / cg"
-    "Modified: / 05-03-2007 / 16:18:53 / cg"
-    "Modified: / 20-07-2010 / 15:39:06 / Jan Vrany <jan.vrany@fit.cvut.cz>"
-!
-
 whoString
     "return a string as className>>selector, if this is not an unbound
      method. Otherwise return 'unbound'. Used with debugging."
@@ -2833,8 +2688,9 @@
     myClass := myClass theNonMetaclass.
     ^ myClass notNil
         and:[ package ~= myClass package
+        and:[ package ~= PackageId noProjectID
         and:[ (myProjectDefinition := myClass projectDefinitionClass) notNil
-        and:[ (myProjectDefinition savedOverwrittenMethodForClass:self mclass selector:self selector) notNil ]]]
+        and:[ (myProjectDefinition savedOverwrittenMethodForClass:self mclass selector:self selector) notNil ]]]]
 !
 
 isSynthetic
@@ -3086,6 +2942,13 @@
     "Modified: 4.11.1996 / 22:28:17 / cg"
 !
 
+modifiedInstVars
+    "returns a collection of instance variables which are modified by this method.
+     Uses parser (for now); could look at bytecode as well here..."
+
+    ^ self parse:#'parseMethodSilent:in:' with:self mclass  return:#modifiedInstVars or:#().
+!
+
 name
     "for compatibility with javaMethods"
 
@@ -3163,10 +3026,12 @@
             parser := parserClass perform:parseSelector with:sourceString.
         ].
         (parser isNil or:[parser == #Error]) ifTrue:[^ valueIfNoSource].
-        LastParseTreeCache isNil ifTrue:[
-            LastParseTreeCache := CacheDictionary new:500.
+        self mclass notNil ifTrue:[
+            LastParseTreeCache isNil ifTrue:[
+                LastParseTreeCache := CacheDictionary new:500.
+            ].
+            LastParseTreeCache at:self put:(ParserCacheEntry new parserClass:parserClass method:self parser:parser).
         ].
-        LastParseTreeCache at:self put:(ParserCacheEntry new parserClass:parserClass method:self parser:parser).
         ^ parser perform:accessSelector
     ].
     ^ valueIfNoSource
@@ -3980,11 +3845,11 @@
 !Method class methodsFor:'documentation'!
 
 version
-    ^ '$Header: /cvs/stx/stx/libbasic/Method.st,v 1.417 2013-06-20 23:00:55 cg Exp $'
+    ^ '$Header: /cvs/stx/stx/libbasic/Method.st,v 1.420 2013-06-29 11:28:21 cg Exp $'
 !
 
 version_CVS
-    ^ '$Header: /cvs/stx/stx/libbasic/Method.st,v 1.417 2013-06-20 23:00:55 cg Exp $'
+    ^ '$Header: /cvs/stx/stx/libbasic/Method.st,v 1.420 2013-06-29 11:28:21 cg Exp $'
 !
 
 version_HG