#REFACTORING by cg
authorClaus Gittinger <cg@exept.de>
Fri, 06 May 2016 04:57:10 +0200
changeset 19716 34387335cbba
parent 19715 58d5215c623e
child 19717 78a27db0fdb6
#REFACTORING by cg class: Method changed: #parse:with:return:or: parserClass is not needed in cacheEntry (have parser)
Method.st
--- a/Method.st	Fri May 06 04:52:00 2016 +0200
+++ b/Method.st	Fri May 06 04:57:10 2016 +0200
@@ -38,7 +38,7 @@
 !
 
 Object subclass:#ParserCacheEntry
-	instanceVariableNames:'parserClass method parser'
+	instanceVariableNames:'method parser'
 	classVariableNames:''
 	poolDictionaries:''
 	privateIn:Method
@@ -3075,35 +3075,35 @@
     "/ is very common with the new browser's info displays, we cache a few
     "/ of them. If the same is parsed soon after, we do not have to parse again.
     LastParseTreeCache notNil ifTrue:[
-	"/ to flush: LastParseTreeCache removeAll.
-	cachedInfo := LastParseTreeCache at:self ifAbsent:nil.
-	cachedInfo notNil ifTrue:[
-	    cachedInfo method == self ifTrue:[
-		cachedInfo parserClass == parserClass ifTrue:[
-		    "/ Transcript show:'hit '; showCR:self.
-		    ^ cachedInfo parser perform:accessSelector
-		]
-	    ].
-	    LastParseTreeCache removeKey:self
-	]
+        "/ to flush: LastParseTreeCache removeAll.
+        cachedInfo := LastParseTreeCache at:self ifAbsent:nil.
+        cachedInfo notNil ifTrue:[
+            cachedInfo method == self ifTrue:[
+                cachedInfo parser class == parserClass ifTrue:[
+                    "/ Transcript show:'hit '; showCR:self.
+                    ^ cachedInfo parser perform:accessSelector
+                ]
+            ].
+            LastParseTreeCache removeKey:self
+        ]
     ].
 
     sourceString := self source.
     (parserClass notNil and:[sourceString notNil]) ifTrue:[
-	parseSelector argumentCount == 2 ifTrue:[
-	    parser := parserClass perform:parseSelector with:sourceString with:arg2.
-	] ifFalse:[
-	    parser := parserClass perform:parseSelector with:sourceString.
-	].
-	(parser isNil or:[parser == #Error]) ifTrue:[^ valueIfNoSource].
-	"do not cache the parser, if it was parsing for code - a lot of information is missing then"
-	(self mclass notNil and:[parser wasParsedForCode not]) ifTrue:[
-	    LastParseTreeCache isNil ifTrue:[
-		LastParseTreeCache := CacheDictionary new:500.
-	    ].
-	    LastParseTreeCache at:self put:(ParserCacheEntry new parserClass:parserClass method:self parser:parser).
-	].
-	^ parser perform:accessSelector
+        parseSelector argumentCount == 2 ifTrue:[
+            parser := parserClass perform:parseSelector with:sourceString with:arg2.
+        ] ifFalse:[
+            parser := parserClass perform:parseSelector with:sourceString.
+        ].
+        (parser isNil or:[parser == #Error]) ifTrue:[^ valueIfNoSource].
+        "do not cache the parser, if it was parsing for code - a lot of information is missing then"
+        (self mclass notNil and:[parser wasParsedForCode not]) ifTrue:[
+            LastParseTreeCache isNil ifTrue:[
+                LastParseTreeCache := CacheDictionary new:500.
+            ].
+            LastParseTreeCache at:self put:(ParserCacheEntry new method:self parser:parser).
+        ].
+        ^ parser perform:accessSelector
     ].
     ^ valueIfNoSource
 
@@ -3111,7 +3111,7 @@
      LastParseTreeCache removeAll.
 
      (Method compiledMethodAt:#parse:return:or:)
-	parse:#'parseMethodSilent:' return:#sentMessages or:#()
+        parse:#'parseMethodSilent:' return:#sentMessages or:#()
     "
 
     "Modified: / 01-03-2012 / 14:30:50 / cg"
@@ -3904,33 +3904,19 @@
     method := something.
 !
 
+method:methodArg parser:parserArg
+    method := methodArg.
+    parser := parserArg.
+
+    "Created: / 08-08-2011 / 19:05:02 / cg"
+!
+
 parser
     ^ parser
 !
 
 parser:something
     parser := something.
-!
-
-parserClass
-    ^ parserClass
-!
-
-parserClass:something
-    parserClass := something.
-!
-
-parserClass:parserClassArg method:methodArg
-    parserClass := parserClassArg.
-    method := methodArg.
-!
-
-parserClass:parserClassArg method:methodArg parser:parserArg
-    parserClass := parserClassArg.
-    method := methodArg.
-    parser := parserArg.
-
-    "Created: / 08-08-2011 / 19:05:02 / cg"
 ! !
 
 !Method class methodsFor:'documentation'!