Tools__MethodList.st
branchjv
changeset 13470 b79cb1799851
parent 13358 d85583969b17
child 13530 2269bce1636d
equal deleted inserted replaced
13469:544e7ced18a0 13470:b79cb1799851
  1305     cls := mthd mclass.
  1305     cls := mthd mclass.
  1306     cls isNil ifTrue:[^ false].
  1306     cls isNil ifTrue:[^ false].
  1307 
  1307 
  1308     anyVarNameAccessable := cls allInstVarNames includesAny:variablesToHighLight.
  1308     anyVarNameAccessable := cls allInstVarNames includesAny:variablesToHighLight.
  1309     anyVarNameAccessable ifFalse:[
  1309     anyVarNameAccessable ifFalse:[
  1310 	anyVarNameAccessable := cls theNonMetaclass allClassVarNames includesAny:variablesToHighLight.
  1310         anyVarNameAccessable := cls theNonMetaclass allClassVarNames includesAny:variablesToHighLight.
  1311     ].
  1311     ].
  1312     anyVarNameAccessable ifFalse:[
  1312     anyVarNameAccessable ifFalse:[
  1313 	"/ no need to parse
  1313         "/ no need to parse
  1314 	^ false
  1314         ^ false
       
  1315     ].
       
  1316 
       
  1317     "/ JV Following code is just very bad. It assumes that method is a Smalltalk method.
       
  1318     "/ But it may not, it could be JavaScript method, Java method or whatever fancy language 
       
  1319     "/ method. Should be actually delegated to the method itself, just as #messagesSend & co.
       
  1320 
       
  1321     "/ I'm not going to refactor now to keep the differences between jv-branch and CVS 
       
  1322     "/ ss small as possible. This interface is bad anyway as method is parsed several times
       
  1323     "/ to check different things. Once should be enough.
       
  1324 
       
  1325     "/ Hack:
       
  1326 
       
  1327     mthd programmingLanguage isSmalltalk ifFalse:[
       
  1328         ^ [
       
  1329             usedVars := mthd perform:querySelector.
       
  1330             usedVars includesAny:variablesToHighLight
       
  1331         ] on: Error do:[
       
  1332             false
       
  1333         ]
  1315     ].
  1334     ].
  1316 
  1335 
  1317     src := mthd source.
  1336     src := mthd source.
  1318     src notNil ifTrue:[
  1337     src notNil ifTrue:[
  1319 	"
  1338         "
  1320 	 before doing a slow parse, quickly scan the
  1339          before doing a slow parse, quickly scan the
  1321 	 methods source for the variables name ...
  1340          methods source for the variables name ...
  1322 	"
  1341         "
  1323 	(variablesToHighLight contains:[:varName | (src findString:varName) ~~ 0]) ifTrue:[
  1342         (variablesToHighLight contains:[:varName | (src findString:varName) ~~ 0]) ifTrue:[
  1324 	    parser := Parser
  1343             parser := Parser
  1325 			    parseMethod:src
  1344                             parseMethod:src
  1326 			    in:cls
  1345                             in:cls
  1327 			    ignoreErrors:true
  1346                             ignoreErrors:true
  1328 			    ignoreWarnings:true.
  1347                             ignoreWarnings:true.
  1329 	    (parser notNil and:[parser ~~ #Error]) ifTrue:[
  1348             (parser notNil and:[parser ~~ #Error]) ifTrue:[
  1330 		usedVars := parser perform:querySelector.
  1349                 usedVars := parser perform:querySelector.
  1331 		(usedVars includesAny:variablesToHighLight)
  1350                 (usedVars includesAny:variablesToHighLight)
  1332 		ifTrue:[
  1351                 ifTrue:[
  1333 		    ^  true
  1352                     ^  true
  1334 		]
  1353                 ]
  1335 	    ]
  1354             ]
  1336 	]
  1355         ]
  1337     ].
  1356     ].
  1338     ^ false
  1357     ^ false
       
  1358 
       
  1359     "Modified: / 30-08-2013 / 13:46:24 / Jan Vrany <jan.vrany@fit.cvut.cz>"
  1339 !
  1360 !
  1340 
  1361 
  1341 methodIsInheritedFromAbove:aMethod
  1362 methodIsInheritedFromAbove:aMethod
  1342     |mClass|
  1363     |mClass|
  1343 
  1364