118 |
118 |
119 Here, certain 'metadata' method like documentation, copyright, |
119 Here, certain 'metadata' method like documentation, copyright, |
120 version methods, printOn: and so on are exluded. Also, testcases |
120 version methods, printOn: and so on are exluded. Also, testcases |
121 and test resources are ommited" |
121 and test resources are ommited" |
122 |
122 |
123 | mclass mselector parser tree pkgdef | |
123 | mclass mselector tree pkgdef | |
124 |
124 |
125 mclass := aMethod mclass. |
125 mclass := aMethod mclass. |
126 mselector := aMethod selector. |
126 mselector := aMethod selector. |
127 |
127 |
128 aMethod hasPrimitiveCode ifTrue:[ ^ true ]. |
128 aMethod hasPrimitiveCode ifTrue:[ ^ true ]. |
140 printString printOn: |
140 printString printOn: |
141 inspectorExtraAttributes inspectorClass |
141 inspectorExtraAttributes inspectorClass |
142 ) includes: mselector) ifTrue:[ ^ true ]. |
142 ) includes: mselector) ifTrue:[ ^ true ]. |
143 ]. |
143 ]. |
144 |
144 |
145 tree := (parser := Parser parseMethod: aMethod source in: mclass) tree. |
145 tree := (Parser parseMethod: aMethod source in: mclass) tree. |
146 tree isNil ifTrue:[ ^ true ]. "/ empty method? |
146 tree isNil ifTrue:[ ^ true ]. "/ empty method? |
147 (tree isStatement and:[tree isReturnNode not and:[tree nextStatement isNil]]) ifTrue:[ |
147 (tree isStatement and:[tree isReturnNode not and:[tree nextStatement isNil]]) ifTrue:[ |
148 tree := tree expression. |
148 tree := tree expression. |
149 ]. |
149 ]. |
150 |
150 |
151 "/ Exclude all getters/return constants... |
151 "/ Exclude all getters/return constants... |
152 (aMethod numArgs == 0 and:[tree isReturnNode and:[tree expression isVariable or:[tree expression isConstant]]]) ifTrue:[ ^ true ]. |
152 (aMethod numArgs == 0 |
|
153 and:[tree isReturnNode |
|
154 and:[tree expression isVariable or:[tree expression isConstant]]]) ifTrue:[ ^ true ]. |
153 |
155 |
154 "/ Exclude all setters |
156 "/ Exclude all setters |
155 (aMethod numArgs == 1 |
157 (aMethod numArgs == 1 |
156 and:[tree isAssignment |
158 and:[tree isAssignment |
157 and:[tree variable type == #InstanceVariable |
159 and:[(tree variable isInstanceVariable or:[tree variable isClassVariable]) |
158 and:[tree expression isVariable |
160 and:[tree expression isVariable |
159 and:[tree expression type == #MethodArg]]]]) ifTrue:[ ^ true ]. |
161 and:[tree expression isMethodArg]]]]) ifTrue:[ ^ true ]. |
160 |
162 |
161 pkgdef := ProjectDefinition definitionClassForPackage: aMethod package. |
163 pkgdef := ProjectDefinition definitionClassForPackage: aMethod package. |
162 pkgdef notNil ifTrue:[ |
164 pkgdef notNil ifTrue:[ |
163 "/ Use perform: because eXept HEAD does not have excludedFromCoverage... |
165 ^ pkgdef excludedFromCoverage:aMethod. |
164 (pkgdef perform:#excludedFromCoverage ifNotUnderstood:[#()]) do:[:spec| |
|
165 spec isArray ifTrue:[ |
|
166 (spec first = mclass name and:[spec second == mselector]) ifTrue:[ ^ true ]. |
|
167 ]. |
|
168 spec = mclass name ifTrue:[ ^ true ]. |
|
169 ]. |
|
170 "/ Use perform: because eXept HEAD does not have excludedFromCoverage:... |
|
171 (pkgdef perform:#excludedFromCoverage: with: aMethod ifNotUnderstood:[false]) ifTrue:[ ^ true ]. |
|
172 ]. |
166 ]. |
173 ^false |
167 ^ false |
174 |
168 |
175 "Created: / 28-06-2013 / 02:20:11 / Jan Vrany <jan.vrany@fit.cvut.cz>" |
169 "Created: / 28-06-2013 / 02:20:11 / Jan Vrany <jan.vrany@fit.cvut.cz>" |
176 "Modified (comment): / 28-06-2013 / 11:31:10 / Jan Vrany <jan.vrany@fit.cvut.cz>" |
170 "Modified (comment): / 28-06-2013 / 11:31:10 / Jan Vrany <jan.vrany@fit.cvut.cz>" |
177 ! ! |
171 ! ! |
178 |
172 |