class: Builder::CoverageReport
authorStefan Vogel <sv@exept.de>
Fri, 17 Apr 2015 17:17:05 +0200
changeset 290c5fdcba3c682
parent 289 258f98c24a4e
child 293 7798bf9ef44b
class: Builder::CoverageReport
changed: #excludedFromCoverage:
reports/Builder__CoverageReport.st
     1.1 --- a/reports/Builder__CoverageReport.st	Thu Mar 12 22:22:35 2015 +0100
     1.2 +++ b/reports/Builder__CoverageReport.st	Fri Apr 17 17:17:05 2015 +0200
     1.3 @@ -120,7 +120,7 @@
     1.4       version methods, printOn: and so on are exluded. Also, testcases
     1.5       and test resources are ommited"
     1.6  
     1.7 -    | mclass mselector parser tree pkgdef |
     1.8 +    | mclass mselector tree pkgdef |
     1.9  
    1.10      mclass := aMethod mclass.
    1.11      mselector := aMethod selector.
    1.12 @@ -142,35 +142,29 @@
    1.13          ) includes: mselector) ifTrue:[ ^ true ].    
    1.14      ].
    1.15  
    1.16 -    tree := (parser := Parser parseMethod: aMethod source in: mclass) tree.
    1.17 +    tree := (Parser parseMethod: aMethod source in: mclass) tree.
    1.18      tree isNil ifTrue:[ ^ true ]. "/ empty method?
    1.19      (tree isStatement and:[tree isReturnNode not and:[tree nextStatement isNil]]) ifTrue:[
    1.20          tree := tree expression.
    1.21      ].
    1.22  
    1.23      "/ Exclude all getters/return constants...
    1.24 -    (aMethod numArgs == 0 and:[tree isReturnNode and:[tree expression isVariable or:[tree expression isConstant]]]) ifTrue:[ ^ true ].
    1.25 +    (aMethod numArgs == 0 
    1.26 +        and:[tree isReturnNode 
    1.27 +        and:[tree expression isVariable or:[tree expression isConstant]]]) ifTrue:[ ^ true ].
    1.28  
    1.29      "/ Exclude all setters
    1.30      (aMethod numArgs == 1 
    1.31          and:[tree isAssignment 
    1.32 -        and:[tree variable type == #InstanceVariable
    1.33 +        and:[(tree variable isInstanceVariable or:[tree variable isClassVariable])
    1.34          and:[tree expression isVariable
    1.35 -        and:[tree expression type == #MethodArg]]]]) ifTrue:[ ^ true ].
    1.36 +        and:[tree expression isMethodArg]]]]) ifTrue:[ ^ true ].
    1.37  
    1.38      pkgdef := ProjectDefinition definitionClassForPackage: aMethod package.
    1.39      pkgdef notNil ifTrue:[
    1.40 -        "/ Use perform: because eXept HEAD does not have excludedFromCoverage...
    1.41 -        (pkgdef perform:#excludedFromCoverage ifNotUnderstood:[#()]) do:[:spec|
    1.42 -            spec isArray ifTrue:[
    1.43 -                (spec first = mclass name and:[spec second == mselector]) ifTrue:[ ^ true ].
    1.44 -            ].
    1.45 -            spec = mclass name ifTrue:[ ^ true ].                
    1.46 -        ].
    1.47 -        "/ Use perform: because eXept HEAD does not have excludedFromCoverage:...
    1.48 -        (pkgdef perform:#excludedFromCoverage: with: aMethod ifNotUnderstood:[false]) ifTrue:[ ^ true ].
    1.49 +        ^ pkgdef excludedFromCoverage:aMethod.
    1.50      ].
    1.51 -    ^false
    1.52 +    ^ false
    1.53  
    1.54      "Created: / 28-06-2013 / 02:20:11 / Jan Vrany <jan.vrany@fit.cvut.cz>"
    1.55      "Modified (comment): / 28-06-2013 / 11:31:10 / Jan Vrany <jan.vrany@fit.cvut.cz>"