author | Claus Gittinger <cg@exept.de> |
Sat, 31 Aug 2013 13:30:27 +0200 | |
changeset 3309 | cea9c487db04 |
parent 2978 | 726eee43543f |
child 3558 | c6e1036e6597 |
permissions | -rw-r--r-- |
2355 | 1 |
" |
2 |
COPYRIGHT (c) 2010 by eXept Software AG |
|
3 |
All Rights Reserved |
|
4 |
||
5 |
This software is furnished under a license and may be used |
|
6 |
only in accordance with the terms of that license and with the |
|
7 |
inclusion of the above copyright notice. This software may not |
|
8 |
be provided or otherwise made available to, or used by, any |
|
9 |
other person. No title to or ownership of the software is |
|
10 |
hereby transferred. |
|
11 |
" |
|
12 |
"{ Package: 'stx:libcomp' }" |
|
13 |
||
14 |
Method variableSubclass:#InstrumentedMethod |
|
15 |
instanceVariableNames:'' |
|
16 |
classVariableNames:'' |
|
17 |
poolDictionaries:'' |
|
18 |
category:'System-Compiler-Instrumentation' |
|
19 |
! |
|
20 |
||
21 |
!InstrumentedMethod class methodsFor:'documentation'! |
|
22 |
||
23 |
copyright |
|
24 |
" |
|
25 |
COPYRIGHT (c) 2010 by eXept Software AG |
|
26 |
All Rights Reserved |
|
27 |
||
28 |
This software is furnished under a license and may be used |
|
29 |
only in accordance with the terms of that license and with the |
|
30 |
inclusion of the above copyright notice. This software may not |
|
31 |
be provided or otherwise made available to, or used by, any |
|
32 |
other person. No title to or ownership of the software is |
|
33 |
hereby transferred. |
|
34 |
" |
|
35 |
! |
|
36 |
||
37 |
documentation |
|
38 |
" |
|
39 |
Instances of me are created by the instrumenting compiler. |
|
40 |
||
41 |
[author:] |
|
42 |
Claus Gittinger |
|
43 |
" |
|
44 |
! ! |
|
45 |
||
2367 | 46 |
!InstrumentedMethod class methodsFor:'cleanup'! |
47 |
||
2572 | 48 |
cleanAllInfoWithChange:withChange |
2707
f9eb45d7729d
changed: #cleanAllInfoWithChange:
Claus Gittinger <cg@exept.de>
parents:
2631
diff
changeset
|
49 |
InstrumentationInfo cleanAllInfoWithChange:withChange |
2367 | 50 |
|
2572 | 51 |
"Created: / 20-07-2011 / 19:01:21 / cg" |
2367 | 52 |
! ! |
53 |
||
2358 | 54 |
!InstrumentedMethod methodsFor:'accessing'! |
55 |
||
56 |
blockInvocationInfo |
|
2631 | 57 |
"return a collection of all block-info objects" |
58 |
||
2358 | 59 |
|info| |
60 |
||
61 |
info := OrderedCollection new. |
|
2631 | 62 |
self literalsDo:[:lit | |
2978 | 63 |
(lit isSpecialInstrumentationInfoLiteral |
64 |
and:[ lit isBlockExecutionInfo ]) ifTrue:[ |
|
65 |
info add:lit |
|
2358 | 66 |
] |
67 |
]. |
|
68 |
^ info |
|
69 |
||
70 |
"Created: / 27-04-2010 / 13:47:21 / cg" |
|
2631 | 71 |
"Modified: / 07-08-2011 / 17:05:02 / cg" |
2358 | 72 |
! |
73 |
||
2367 | 74 |
invokedViaPerform |
75 |
"true if the method is ever invoked via perform" |
|
76 |
||
77 |
|info| |
|
78 |
||
79 |
info := self methodInvocationInfo. |
|
80 |
^ info notNil and:[info invokedViaPerform] |
|
81 |
||
82 |
"Created: / 27-04-2010 / 18:23:10 / cg" |
|
83 |
! |
|
84 |
||
2358 | 85 |
methodInvocationInfo |
2978 | 86 |
"return the one and only method-invocatin info" |
2631 | 87 |
|
88 |
^ self |
|
2978 | 89 |
literalsDetect:[:lit | |
90 |
lit isSpecialInstrumentationInfoLiteral |
|
91 |
and:[ lit isMethodInvocationInfo]] |
|
2631 | 92 |
ifNone:nil |
2358 | 93 |
|
94 |
"Created: / 27-04-2010 / 13:34:01 / cg" |
|
2389 | 95 |
! |
96 |
||
97 |
statementInvocationInfo |
|
2978 | 98 |
"return all statement infos (but not block infos)" |
2725
86bbe6e76648
comment/format in: #statementInvocationInfo
Claus Gittinger <cg@exept.de>
parents:
2707
diff
changeset
|
99 |
|
2389 | 100 |
|info| |
101 |
||
102 |
info := OrderedCollection new. |
|
103 |
self literalsDo:[:lit | |
|
2978 | 104 |
(lit isSpecialInstrumentationInfoLiteral |
105 |
and:[ lit isStatementExecutionInfo |
|
106 |
and:[ lit isBlockExecutionInfo not]]) ifTrue:[ |
|
2389 | 107 |
info add:lit |
108 |
] |
|
109 |
]. |
|
110 |
^ info |
|
2725
86bbe6e76648
comment/format in: #statementInvocationInfo
Claus Gittinger <cg@exept.de>
parents:
2707
diff
changeset
|
111 |
|
86bbe6e76648
comment/format in: #statementInvocationInfo
Claus Gittinger <cg@exept.de>
parents:
2707
diff
changeset
|
112 |
"Modified (comment): / 30-09-2011 / 12:05:06 / cg" |
2358 | 113 |
! ! |
114 |
||
2355 | 115 |
!InstrumentedMethod methodsFor:'queries'! |
116 |
||
2358 | 117 |
hasBeenCalled |
2950 | 118 |
"return true, if I have been called" |
119 |
||
2358 | 120 |
|info| |
121 |
||
122 |
^ (info := self methodInvocationInfo) notNil |
|
123 |
and:[ info hasBeenCalled ] |
|
124 |
||
125 |
"Created: / 27-04-2010 / 13:03:33 / cg" |
|
126 |
! |
|
127 |
||
128 |
haveAllBlocksBeenExecuted |
|
2950 | 129 |
"return true if all of my blocks have been called" |
130 |
||
2358 | 131 |
^ self blockInvocationInfo conform:[:eachBlockInfo | eachBlockInfo callCount > 0] |
132 |
||
133 |
"Modified: / 27-04-2010 / 13:44:46 / cg" |
|
134 |
! |
|
135 |
||
2355 | 136 |
isInstrumented |
137 |
^ true |
|
138 |
||
139 |
"Created: / 27-04-2010 / 12:25:39 / cg" |
|
140 |
! ! |
|
141 |
||
142 |
!InstrumentedMethod class methodsFor:'documentation'! |
|
143 |
||
144 |
version_CVS |
|
2978 | 145 |
^ '$Header: /cvs/stx/stx/libcomp/InstrumentedMethod.st,v 1.11 2012-11-07 22:33:51 cg Exp $' |
2355 | 146 |
! ! |