Method.st
author Claus Gittinger <cg@exept.de>
Mon, 04 Mar 2019 09:45:05 +0100
changeset 23830 802fef671b06
parent 23827 d9f5a3454db2
child 23908 a6810b64f5d2
permissions -rw-r--r--
#REFACTORING by cg class: Method changed: #externalLibraryFunction
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
21937
2cea97649a40 #DOCUMENTATION by cg
Claus Gittinger <cg@exept.de>
parents: 21765
diff changeset
     1
"{ Encoding: utf8 }"
2cea97649a40 #DOCUMENTATION by cg
Claus Gittinger <cg@exept.de>
parents: 21765
diff changeset
     2
1
a27a279701f8 Initial revision
claus
parents:
diff changeset
     3
"
5
67342904af11 *** empty log message ***
claus
parents: 3
diff changeset
     4
 COPYRIGHT (c) 1989 by Claus Gittinger
18620
b4e9f25d6ce6 preparations for lined index list in WeakArray
Claus Gittinger <cg@exept.de>
parents: 18462
diff changeset
     5
	      All Rights Reserved
1
a27a279701f8 Initial revision
claus
parents:
diff changeset
     6
a27a279701f8 Initial revision
claus
parents:
diff changeset
     7
 This software is furnished under a license and may be used
a27a279701f8 Initial revision
claus
parents:
diff changeset
     8
 only in accordance with the terms of that license and with the
a27a279701f8 Initial revision
claus
parents:
diff changeset
     9
 inclusion of the above copyright notice.   This software may not
a27a279701f8 Initial revision
claus
parents:
diff changeset
    10
 be provided or otherwise made available to, or used by, any
a27a279701f8 Initial revision
claus
parents:
diff changeset
    11
 other person.  No title to or ownership of the software is
a27a279701f8 Initial revision
claus
parents:
diff changeset
    12
 hereby transferred.
a27a279701f8 Initial revision
claus
parents:
diff changeset
    13
"
5385
7637332d7b38 care for nil package
Claus Gittinger <cg@exept.de>
parents: 5339
diff changeset
    14
"{ Package: 'stx:libbasic' }"
7637332d7b38 care for nil package
Claus Gittinger <cg@exept.de>
parents: 5339
diff changeset
    15
17278
7813956ffab4 class: Method
Claus Gittinger <cg@exept.de>
parents: 17254
diff changeset
    16
"{ NameSpace: Smalltalk }"
7813956ffab4 class: Method
Claus Gittinger <cg@exept.de>
parents: 17254
diff changeset
    17
3934
a8c6075f9988 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 3845
diff changeset
    18
CompiledCode variableSubclass:#Method
16261
52a0604a7b95 class: Method
Stefan Vogel <sv@exept.de>
parents: 16221
diff changeset
    19
	instanceVariableNames:'source sourcePosition category package mclass lookupObject
52a0604a7b95 class: Method
Stefan Vogel <sv@exept.de>
parents: 16221
diff changeset
    20
		annotations'
52a0604a7b95 class: Method
Stefan Vogel <sv@exept.de>
parents: 16221
diff changeset
    21
	classVariableNames:'PrivateMethodSignal LastFileReference LastSourceFileName
52a0604a7b95 class: Method
Stefan Vogel <sv@exept.de>
parents: 16221
diff changeset
    22
		LastWhoClass LastFileLock LastMethodSources LastMethodSourcesLock
17254
053fe5d7fec8 class: Method
Claus Gittinger <cg@exept.de>
parents: 17250
diff changeset
    23
		CompilationLock Overrides LastParseTreeCache'
16261
52a0604a7b95 class: Method
Stefan Vogel <sv@exept.de>
parents: 16221
diff changeset
    24
	poolDictionaries:''
52a0604a7b95 class: Method
Stefan Vogel <sv@exept.de>
parents: 16221
diff changeset
    25
	category:'Kernel-Methods'
1
a27a279701f8 Initial revision
claus
parents:
diff changeset
    26
!
a27a279701f8 Initial revision
claus
parents:
diff changeset
    27
1851
4accc9fafd19 change #who to return a proper object
Claus Gittinger <cg@exept.de>
parents: 1813
diff changeset
    28
Object subclass:#MethodWhoInfo
16261
52a0604a7b95 class: Method
Stefan Vogel <sv@exept.de>
parents: 16221
diff changeset
    29
	instanceVariableNames:'myClass mySelector'
52a0604a7b95 class: Method
Stefan Vogel <sv@exept.de>
parents: 16221
diff changeset
    30
	classVariableNames:''
52a0604a7b95 class: Method
Stefan Vogel <sv@exept.de>
parents: 16221
diff changeset
    31
	poolDictionaries:''
52a0604a7b95 class: Method
Stefan Vogel <sv@exept.de>
parents: 16221
diff changeset
    32
	privateIn:Method
1851
4accc9fafd19 change #who to return a proper object
Claus Gittinger <cg@exept.de>
parents: 1813
diff changeset
    33
!
4accc9fafd19 change #who to return a proper object
Claus Gittinger <cg@exept.de>
parents: 1813
diff changeset
    34
13570
382db10e848d changed: #parse:with:return:or:
Claus Gittinger <cg@exept.de>
parents: 13569
diff changeset
    35
Object subclass:#ParseTreeCacheEntry
16261
52a0604a7b95 class: Method
Stefan Vogel <sv@exept.de>
parents: 16221
diff changeset
    36
	instanceVariableNames:'parserClass method parser'
52a0604a7b95 class: Method
Stefan Vogel <sv@exept.de>
parents: 16221
diff changeset
    37
	classVariableNames:''
52a0604a7b95 class: Method
Stefan Vogel <sv@exept.de>
parents: 16221
diff changeset
    38
	poolDictionaries:''
52a0604a7b95 class: Method
Stefan Vogel <sv@exept.de>
parents: 16221
diff changeset
    39
	privateIn:Method
13570
382db10e848d changed: #parse:with:return:or:
Claus Gittinger <cg@exept.de>
parents: 13569
diff changeset
    40
!
382db10e848d changed: #parse:with:return:or:
Claus Gittinger <cg@exept.de>
parents: 13569
diff changeset
    41
382db10e848d changed: #parse:with:return:or:
Claus Gittinger <cg@exept.de>
parents: 13569
diff changeset
    42
Object subclass:#ParserCacheEntry
19716
34387335cbba #REFACTORING by cg
Claus Gittinger <cg@exept.de>
parents: 19699
diff changeset
    43
	instanceVariableNames:'method parser'
16261
52a0604a7b95 class: Method
Stefan Vogel <sv@exept.de>
parents: 16221
diff changeset
    44
	classVariableNames:''
52a0604a7b95 class: Method
Stefan Vogel <sv@exept.de>
parents: 16221
diff changeset
    45
	poolDictionaries:''
52a0604a7b95 class: Method
Stefan Vogel <sv@exept.de>
parents: 16221
diff changeset
    46
	privateIn:Method
13570
382db10e848d changed: #parse:with:return:or:
Claus Gittinger <cg@exept.de>
parents: 13569
diff changeset
    47
!
382db10e848d changed: #parse:with:return:or:
Claus Gittinger <cg@exept.de>
parents: 13569
diff changeset
    48
1775
6892b91ddc0b F_CALLED flag is no longer present
Claus Gittinger <cg@exept.de>
parents: 1692
diff changeset
    49
!Method class methodsFor:'documentation'!
42
e33491f6f260 *** empty log message ***
claus
parents: 39
diff changeset
    50
88
81dacba7a63a *** empty log message ***
claus
parents: 85
diff changeset
    51
copyright
81dacba7a63a *** empty log message ***
claus
parents: 85
diff changeset
    52
"
81dacba7a63a *** empty log message ***
claus
parents: 85
diff changeset
    53
 COPYRIGHT (c) 1989 by Claus Gittinger
18620
b4e9f25d6ce6 preparations for lined index list in WeakArray
Claus Gittinger <cg@exept.de>
parents: 18462
diff changeset
    54
	      All Rights Reserved
88
81dacba7a63a *** empty log message ***
claus
parents: 85
diff changeset
    55
81dacba7a63a *** empty log message ***
claus
parents: 85
diff changeset
    56
 This software is furnished under a license and may be used
81dacba7a63a *** empty log message ***
claus
parents: 85
diff changeset
    57
 only in accordance with the terms of that license and with the
81dacba7a63a *** empty log message ***
claus
parents: 85
diff changeset
    58
 inclusion of the above copyright notice.   This software may not
81dacba7a63a *** empty log message ***
claus
parents: 85
diff changeset
    59
 be provided or otherwise made available to, or used by, any
81dacba7a63a *** empty log message ***
claus
parents: 85
diff changeset
    60
 other person.  No title to or ownership of the software is
81dacba7a63a *** empty log message ***
claus
parents: 85
diff changeset
    61
 hereby transferred.
81dacba7a63a *** empty log message ***
claus
parents: 85
diff changeset
    62
"
81dacba7a63a *** empty log message ***
claus
parents: 85
diff changeset
    63
!
81dacba7a63a *** empty log message ***
claus
parents: 85
diff changeset
    64
42
e33491f6f260 *** empty log message ***
claus
parents: 39
diff changeset
    65
documentation
e33491f6f260 *** empty log message ***
claus
parents: 39
diff changeset
    66
"
68
59faa75185ba *** empty log message ***
claus
parents: 56
diff changeset
    67
    this class defines protocol for executable methods;
59faa75185ba *** empty log message ***
claus
parents: 56
diff changeset
    68
    both compiled and interpreted methods are represented by this class.
59faa75185ba *** empty log message ***
claus
parents: 56
diff changeset
    69
    Compiled methods have a non-nil code field, while interpreted methods have
59faa75185ba *** empty log message ***
claus
parents: 56
diff changeset
    70
    a nil code field and non-nil byteCode field.
88
81dacba7a63a *** empty log message ***
claus
parents: 85
diff changeset
    71
    If there are both non-nil code and bytecode fields, the VM will execute
18417
ae2934928225 class: Method
Claus Gittinger <cg@exept.de>
parents: 18411
diff changeset
    72
    the machine-code of a method. If both are nil when executed, a #noByteCode
ae2934928225 class: Method
Claus Gittinger <cg@exept.de>
parents: 18411
diff changeset
    73
    message is sent (by the VM) to the method, where a signal is raised.
ae2934928225 class: Method
Claus Gittinger <cg@exept.de>
parents: 18411
diff changeset
    74
    (or, a user defined interpreter can be invoked on the smalltalk level)
ae2934928225 class: Method
Claus Gittinger <cg@exept.de>
parents: 18411
diff changeset
    75
ae2934928225 class: Method
Claus Gittinger <cg@exept.de>
parents: 18411
diff changeset
    76
    The method's sourcecode is represented by source and sourcePosition:
227
23b1c4de3402 package & cleanup
claus
parents: 216
diff changeset
    77
    - if sourcePosition is a Number, the source-field is the fileName and
23b1c4de3402 package & cleanup
claus
parents: 216
diff changeset
    78
      sourcePosition is the character offset of the source-chunk in this source file.
18417
ae2934928225 class: Method
Claus Gittinger <cg@exept.de>
parents: 18411
diff changeset
    79
    - If sourcePosition is nil, the source fields holds the source string.
227
23b1c4de3402 package & cleanup
claus
parents: 216
diff changeset
    80
    (an old version used ExternalString instances here, but that lead to
18417
ae2934928225 class: Method
Claus Gittinger <cg@exept.de>
parents: 18411
diff changeset
    81
     10000's of additional little objects ...)
1
a27a279701f8 Initial revision
claus
parents:
diff changeset
    82
68
59faa75185ba *** empty log message ***
claus
parents: 56
diff changeset
    83
    The flags field defines things like the number of method-locals,
227
23b1c4de3402 package & cleanup
claus
parents: 216
diff changeset
    84
    method arguments and stack requirements (for interpreted methods).
68
59faa75185ba *** empty log message ***
claus
parents: 56
diff changeset
    85
    Do not depend on any value in the flags field - it may change without
59faa75185ba *** empty log message ***
claus
parents: 56
diff changeset
    86
    notice.
1
a27a279701f8 Initial revision
claus
parents:
diff changeset
    87
438
claus
parents: 423
diff changeset
    88
    Notice, that in ST/X, method can be subclassed; executable code is
5277
d457937a69e5 comments & code-cleanup in #who
Claus Gittinger <cg@exept.de>
parents: 5241
diff changeset
    89
    identified not by being an instance of Block or Method, but instead by
438
claus
parents: 423
diff changeset
    90
    having the executable flag bit set in the class. The VM can execute anything
claus
parents: 423
diff changeset
    91
    which is identified as executable (assuming that the first instance variable
claus
parents: 423
diff changeset
    92
    is the machine-code address) - this allows for easy future extension.
claus
parents: 423
diff changeset
    93
19732
171048f57a34 #DOCUMENTATION by cg
Claus Gittinger <cg@exept.de>
parents: 19716
diff changeset
    94
    Literals:
171048f57a34 #DOCUMENTATION by cg
Claus Gittinger <cg@exept.de>
parents: 19716
diff changeset
    95
        Notice that stc compiled methods do not list all of their used literals.
171048f57a34 #DOCUMENTATION by cg
Claus Gittinger <cg@exept.de>
parents: 19716
diff changeset
    96
        In fact, stc-code uses a kind of class-constant-table,
171048f57a34 #DOCUMENTATION by cg
Claus Gittinger <cg@exept.de>
parents: 19716
diff changeset
    97
        and only message-send symbols are found in the literal array.
171048f57a34 #DOCUMENTATION by cg
Claus Gittinger <cg@exept.de>
parents: 19716
diff changeset
    98
        Thus, in order to find constants (literals) used by a method,
171048f57a34 #DOCUMENTATION by cg
Claus Gittinger <cg@exept.de>
parents: 19716
diff changeset
    99
        you have to parse its source.
20208
79b24601b7d6 #OTHER by mawalch
mawalch
parents: 20035
diff changeset
   100
1293
02fb05148c98 documentation
Claus Gittinger <cg@exept.de>
parents: 1264
diff changeset
   101
    [Instance variables:]
93
e31220cb391f *** empty log message ***
claus
parents: 88
diff changeset
   102
19732
171048f57a34 #DOCUMENTATION by cg
Claus Gittinger <cg@exept.de>
parents: 19716
diff changeset
   103
        source          <String>        the source itself (if sourcePosition isNil)
171048f57a34 #DOCUMENTATION by cg
Claus Gittinger <cg@exept.de>
parents: 19716
diff changeset
   104
                                        or the fileName where the source is found
171048f57a34 #DOCUMENTATION by cg
Claus Gittinger <cg@exept.de>
parents: 19716
diff changeset
   105
22372
72db331204d4 #DOCUMENTATION by cg
Claus Gittinger <cg@exept.de>
parents: 22188
diff changeset
   106
        sourcePosition  <Integer>       the position of the method's chunk in the file
72db331204d4 #DOCUMENTATION by cg
Claus Gittinger <cg@exept.de>
parents: 22188
diff changeset
   107
72db331204d4 #DOCUMENTATION by cg
Claus Gittinger <cg@exept.de>
parents: 22188
diff changeset
   108
        category        <Symbol>        the method's category
72db331204d4 #DOCUMENTATION by cg
Claus Gittinger <cg@exept.de>
parents: 22188
diff changeset
   109
        package         <Symbol>        the package, in which the method was defined
19732
171048f57a34 #DOCUMENTATION by cg
Claus Gittinger <cg@exept.de>
parents: 19716
diff changeset
   110
        mclass          <Class>         the class in which I am defined
171048f57a34 #DOCUMENTATION by cg
Claus Gittinger <cg@exept.de>
parents: 19716
diff changeset
   111
        indexed slots                   literals
227
23b1c4de3402 package & cleanup
claus
parents: 216
diff changeset
   112
1293
02fb05148c98 documentation
Claus Gittinger <cg@exept.de>
parents: 1264
diff changeset
   113
    [Class variables:]
227
23b1c4de3402 package & cleanup
claus
parents: 216
diff changeset
   114
19732
171048f57a34 #DOCUMENTATION by cg
Claus Gittinger <cg@exept.de>
parents: 19716
diff changeset
   115
        PrivateMethodSignal             raised on privacy violation (see docu)
171048f57a34 #DOCUMENTATION by cg
Claus Gittinger <cg@exept.de>
parents: 19716
diff changeset
   116
171048f57a34 #DOCUMENTATION by cg
Claus Gittinger <cg@exept.de>
parents: 19716
diff changeset
   117
        LastFileReference               weak reference to the last sourceFile
171048f57a34 #DOCUMENTATION by cg
Claus Gittinger <cg@exept.de>
parents: 19716
diff changeset
   118
        LastSourceFileName              to speedup source access via NFS
93
e31220cb391f *** empty log message ***
claus
parents: 88
diff changeset
   119
20804
8fc0aa10c3a8 #DOCUMENTATION by cg
Claus Gittinger <cg@exept.de>
parents: 20683
diff changeset
   120
    WARNING: layout known by compiler and runtime system - don't change
1293
02fb05148c98 documentation
Claus Gittinger <cg@exept.de>
parents: 1264
diff changeset
   121
02fb05148c98 documentation
Claus Gittinger <cg@exept.de>
parents: 1264
diff changeset
   122
    [author:]
19732
171048f57a34 #DOCUMENTATION by cg
Claus Gittinger <cg@exept.de>
parents: 19716
diff changeset
   123
        Claus Gittinger
42
e33491f6f260 *** empty log message ***
claus
parents: 39
diff changeset
   124
"
176
48061f8659aa more queries
claus
parents: 159
diff changeset
   125
!
48061f8659aa more queries
claus
parents: 159
diff changeset
   126
952
d600e08a5936 handle the case where a method has a sourceFileInfo, but the class has not
Claus Gittinger <cg@exept.de>
parents: 934
diff changeset
   127
dynamicMethods
d600e08a5936 handle the case where a method has a sourceFileInfo, but the class has not
Claus Gittinger <cg@exept.de>
parents: 934
diff changeset
   128
"
5277
d457937a69e5 comments & code-cleanup in #who
Claus Gittinger <cg@exept.de>
parents: 5241
diff changeset
   129
    On systems which support dynamic loading of stc-compiled machine code (SYS5.4, Linux),
952
d600e08a5936 handle the case where a method has a sourceFileInfo, but the class has not
Claus Gittinger <cg@exept.de>
parents: 934
diff changeset
   130
    methods may now be compiled to machine code from within the browser,
d600e08a5936 handle the case where a method has a sourceFileInfo, but the class has not
Claus Gittinger <cg@exept.de>
parents: 934
diff changeset
   131
    and the resulting machine code object be loaded in.
d600e08a5936 handle the case where a method has a sourceFileInfo, but the class has not
Claus Gittinger <cg@exept.de>
parents: 934
diff changeset
   132
    The ObjectFileLoader keeps (weak) handles to the resulting methods and
d600e08a5936 handle the case where a method has a sourceFileInfo, but the class has not
Claus Gittinger <cg@exept.de>
parents: 934
diff changeset
   133
    invalidates the corresponding method objects, if the underlying methods
d600e08a5936 handle the case where a method has a sourceFileInfo, but the class has not
Claus Gittinger <cg@exept.de>
parents: 934
diff changeset
   134
    object code is unloaded.
d600e08a5936 handle the case where a method has a sourceFileInfo, but the class has not
Claus Gittinger <cg@exept.de>
parents: 934
diff changeset
   135
    Invalid methods will trap into the debugger when executed;
d600e08a5936 handle the case where a method has a sourceFileInfo, but the class has not
Claus Gittinger <cg@exept.de>
parents: 934
diff changeset
   136
    also, the browser marks them as '(* not executable *)' in its method list.
5277
d457937a69e5 comments & code-cleanup in #who
Claus Gittinger <cg@exept.de>
parents: 5241
diff changeset
   137
d457937a69e5 comments & code-cleanup in #who
Claus Gittinger <cg@exept.de>
parents: 5241
diff changeset
   138
    Notice: this has nothing to do with JIT compilation, which is always possible.
d457937a69e5 comments & code-cleanup in #who
Claus Gittinger <cg@exept.de>
parents: 5241
diff changeset
   139
    JIT-compilation is done from bytecodes to a machineCode cache.
d457937a69e5 comments & code-cleanup in #who
Claus Gittinger <cg@exept.de>
parents: 5241
diff changeset
   140
    In contrast, dynamic loading of stc-compiled code goes via intermediate C-code
d457937a69e5 comments & code-cleanup in #who
Claus Gittinger <cg@exept.de>
parents: 5241
diff changeset
   141
    which is compiled by the machines native C-compiler.
d457937a69e5 comments & code-cleanup in #who
Claus Gittinger <cg@exept.de>
parents: 5241
diff changeset
   142
    As opposed to JITted code, this allows for embedded primitive C-code.
952
d600e08a5936 handle the case where a method has a sourceFileInfo, but the class has not
Claus Gittinger <cg@exept.de>
parents: 934
diff changeset
   143
"
d600e08a5936 handle the case where a method has a sourceFileInfo, but the class has not
Claus Gittinger <cg@exept.de>
parents: 934
diff changeset
   144
!
d600e08a5936 handle the case where a method has a sourceFileInfo, but the class has not
Claus Gittinger <cg@exept.de>
parents: 934
diff changeset
   145
12854
3a3d3c02c3bd *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 12695
diff changeset
   146
privacy
176
48061f8659aa more queries
claus
parents: 159
diff changeset
   147
"
48061f8659aa more queries
claus
parents: 159
diff changeset
   148
    ST/X includes an EXPERIMENTAL implementation of method privacy.
48061f8659aa more queries
claus
parents: 159
diff changeset
   149
    Individual methods may be set to private or protected via the
5277
d457937a69e5 comments & code-cleanup in #who
Claus Gittinger <cg@exept.de>
parents: 5241
diff changeset
   150
    privacy:#private and privacy:#protected messages. Also, categories may be
202
40ca7cc6fb9c *** empty log message ***
claus
parents: 192
diff changeset
   151
    filedIn as a whole as private using #privateMethodsFor: or as
40ca7cc6fb9c *** empty log message ***
claus
parents: 192
diff changeset
   152
    protected using #protectedMethodsFor: instead of the well known #methodsFor:.
40ca7cc6fb9c *** empty log message ***
claus
parents: 192
diff changeset
   153
176
48061f8659aa more queries
claus
parents: 159
diff changeset
   154
    The additional #publicMethodsFor: is for documentation purposes, and
227
23b1c4de3402 package & cleanup
claus
parents: 216
diff changeset
   155
    is equivalent to #methodsFor: (also to support fileIn of ENVY methods).
176
48061f8659aa more queries
claus
parents: 159
diff changeset
   156
8518
7dc3f9909640 Interchanged the meaning of method privacy -
Stefan Vogel <sv@exept.de>
parents: 8465
diff changeset
   157
    Protected methods may be executed only when called via a self-send
5277
d457937a69e5 comments & code-cleanup in #who
Claus Gittinger <cg@exept.de>
parents: 5241
diff changeset
   158
    from the superclass-methods and self or super-sends from methods in the
d457937a69e5 comments & code-cleanup in #who
Claus Gittinger <cg@exept.de>
parents: 5241
diff changeset
   159
    class itself or subclasses.
12854
3a3d3c02c3bd *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 12695
diff changeset
   160
    Private methods may not be called from subclasses-methods,
5277
d457937a69e5 comments & code-cleanup in #who
Claus Gittinger <cg@exept.de>
parents: 5241
diff changeset
   161
    i.e. they may only be called via self sends from within the current class.
8518
7dc3f9909640 Interchanged the meaning of method privacy -
Stefan Vogel <sv@exept.de>
parents: 8465
diff changeset
   162
    (i.e. protected methods are less private than private ones)
176
48061f8659aa more queries
claus
parents: 159
diff changeset
   163
48061f8659aa more queries
claus
parents: 159
diff changeset
   164
    When such a situation arises, the VM (runtime system) will raise the
48061f8659aa more queries
claus
parents: 159
diff changeset
   165
    PrivateMethodSignal exception (if nonNil), which usually brings you into the
48061f8659aa more queries
claus
parents: 159
diff changeset
   166
    debugger.
48061f8659aa more queries
claus
parents: 159
diff changeset
   167
227
23b1c4de3402 package & cleanup
claus
parents: 216
diff changeset
   168
    If PrivateMethodSignal is nil, the VM will not check for this, and
176
48061f8659aa more queries
claus
parents: 159
diff changeset
   169
    execution is as usual. (you may want to nil-it for production code,
48061f8659aa more queries
claus
parents: 159
diff changeset
   170
    and leave it non nil during development).
48061f8659aa more queries
claus
parents: 159
diff changeset
   171
20208
79b24601b7d6 #OTHER by mawalch
mawalch
parents: 20035
diff changeset
   172
    NOTICE: there is no (not yet?) standard defined for method privacy,
12854
3a3d3c02c3bd *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 12695
diff changeset
   173
    however, the definition protocol was designed to be somewhat ENVY compatible
5277
d457937a69e5 comments & code-cleanup in #who
Claus Gittinger <cg@exept.de>
parents: 5241
diff changeset
   174
    (from what can be deduced by reading PD code).
d457937a69e5 comments & code-cleanup in #who
Claus Gittinger <cg@exept.de>
parents: 5241
diff changeset
   175
176
48061f8659aa more queries
claus
parents: 159
diff changeset
   176
    Also, the usability of privacy is still to be tested.
415
claus
parents: 414
diff changeset
   177
    This interface, the implementation and the rules for when a privacy violation
claus
parents: 414
diff changeset
   178
    may change (in case of some ANSI standard being defined).
227
23b1c4de3402 package & cleanup
claus
parents: 216
diff changeset
   179
    Be warned and send me suggestions & critics (constructive ;-)
5277
d457937a69e5 comments & code-cleanup in #who
Claus Gittinger <cg@exept.de>
parents: 5241
diff changeset
   180
d457937a69e5 comments & code-cleanup in #who
Claus Gittinger <cg@exept.de>
parents: 5241
diff changeset
   181
    Late note (Feb 2000):
20208
79b24601b7d6 #OTHER by mawalch
mawalch
parents: 20035
diff changeset
   182
        the privacy feature has now been in ST/X for some years and was NOT heavily
79b24601b7d6 #OTHER by mawalch
mawalch
parents: 20035
diff changeset
   183
        used - neither at eXept, nor by customers.
79b24601b7d6 #OTHER by mawalch
mawalch
parents: 20035
diff changeset
   184
        In Smalltalk, it seems to be a very questionable feature, actually limiting
79b24601b7d6 #OTHER by mawalch
mawalch
parents: 20035
diff changeset
   185
        code reusability.
79b24601b7d6 #OTHER by mawalch
mawalch
parents: 20035
diff changeset
   186
        The privacy features are left in the system to demonstrate that it can be
79b24601b7d6 #OTHER by mawalch
mawalch
parents: 20035
diff changeset
   187
        done in Smalltalk (for religious C++ fans ... to avoid useless discussions)
79b24601b7d6 #OTHER by mawalch
mawalch
parents: 20035
diff changeset
   188
        (the check is not expensive, w.r.t. the VM runtime behavior).
176
48061f8659aa more queries
claus
parents: 159
diff changeset
   189
"
42
e33491f6f260 *** empty log message ***
claus
parents: 39
diff changeset
   190
! !
1
a27a279701f8 Initial revision
claus
parents:
diff changeset
   191
1775
6892b91ddc0b F_CALLED flag is no longer present
Claus Gittinger <cg@exept.de>
parents: 1692
diff changeset
   192
!Method class methodsFor:'initialization'!
109
1fae65190b17 errors raise signals; check arg-count in valueWith...
claus
parents: 93
diff changeset
   193
1fae65190b17 errors raise signals; check arg-count in valueWith...
claus
parents: 93
diff changeset
   194
initialize
1254
48c2748b5197 commentary
Claus Gittinger <cg@exept.de>
parents: 1236
diff changeset
   195
    "create signals"
48c2748b5197 commentary
Claus Gittinger <cg@exept.de>
parents: 1236
diff changeset
   196
109
1fae65190b17 errors raise signals; check arg-count in valueWith...
claus
parents: 93
diff changeset
   197
    PrivateMethodSignal isNil ifTrue:[
20032
68dbfb9bf2c1 #REFACTORING by stefan
Stefan Vogel <sv@exept.de>
parents: 19868
diff changeset
   198
        "EXPERIMENTAL"
68dbfb9bf2c1 #REFACTORING by stefan
Stefan Vogel <sv@exept.de>
parents: 19868
diff changeset
   199
        PrivateMethodSignal := ExecutionError newSignalMayProceed:true.
68dbfb9bf2c1 #REFACTORING by stefan
Stefan Vogel <sv@exept.de>
parents: 19868
diff changeset
   200
        PrivateMethodSignal nameClass:self message:#privateMethodSignal.
68dbfb9bf2c1 #REFACTORING by stefan
Stefan Vogel <sv@exept.de>
parents: 19868
diff changeset
   201
        PrivateMethodSignal notifierString:'attempt to execute private/protected method'.
2079
bcf84ab30304 Make cached sourcefile thread-protected.
Stefan Vogel <sv@exept.de>
parents: 2066
diff changeset
   202
    ].
bcf84ab30304 Make cached sourcefile thread-protected.
Stefan Vogel <sv@exept.de>
parents: 2066
diff changeset
   203
bcf84ab30304 Make cached sourcefile thread-protected.
Stefan Vogel <sv@exept.de>
parents: 2066
diff changeset
   204
    LastFileLock isNil ifTrue:[
22188
1b876830c38e #TUNING by stefan
Stefan Vogel <sv@exept.de>
parents: 22061
diff changeset
   205
        LastFileLock := RecursionLock name:'Method-LastFile'.
1b876830c38e #TUNING by stefan
Stefan Vogel <sv@exept.de>
parents: 22061
diff changeset
   206
        LastMethodSourcesLock := RecursionLock name:'Method-LastMethodSources'.
20032
68dbfb9bf2c1 #REFACTORING by stefan
Stefan Vogel <sv@exept.de>
parents: 19868
diff changeset
   207
68dbfb9bf2c1 #REFACTORING by stefan
Stefan Vogel <sv@exept.de>
parents: 19868
diff changeset
   208
        LastFileReference := WeakArray new:1.
2079
bcf84ab30304 Make cached sourcefile thread-protected.
Stefan Vogel <sv@exept.de>
parents: 2066
diff changeset
   209
    ].
1254
48c2748b5197 commentary
Claus Gittinger <cg@exept.de>
parents: 1236
diff changeset
   210
22188
1b876830c38e #TUNING by stefan
Stefan Vogel <sv@exept.de>
parents: 22061
diff changeset
   211
    CompilationLock := RecursionLock name:'MethodCompilation'.
4290
5e43473d7a35 moved recompilation semaphore from LazyMethod to Method
Claus Gittinger <cg@exept.de>
parents: 4015
diff changeset
   212
14231
a61fd41fe0d6 variable renamed in: #initialize
Claus Gittinger <cg@exept.de>
parents: 14161
diff changeset
   213
    "Modified: / 03-01-1997 / 16:58:16 / stefan"
a61fd41fe0d6 variable renamed in: #initialize
Claus Gittinger <cg@exept.de>
parents: 14161
diff changeset
   214
    "Modified (comment): / 20-07-2012 / 18:41:11 / cg"
10375
b1558b2e851d care for source access BEFORE being initialized.
ca
parents: 10207
diff changeset
   215
!
b1558b2e851d care for source access BEFORE being initialized.
ca
parents: 10207
diff changeset
   216
b1558b2e851d care for source access BEFORE being initialized.
ca
parents: 10207
diff changeset
   217
lastMethodSourcesLock
b1558b2e851d care for source access BEFORE being initialized.
ca
parents: 10207
diff changeset
   218
    LastMethodSourcesLock isNil ifTrue:[
18620
b4e9f25d6ce6 preparations for lined index list in WeakArray
Claus Gittinger <cg@exept.de>
parents: 18462
diff changeset
   219
	self initialize
10375
b1558b2e851d care for source access BEFORE being initialized.
ca
parents: 10207
diff changeset
   220
    ].
b1558b2e851d care for source access BEFORE being initialized.
ca
parents: 10207
diff changeset
   221
    ^ LastMethodSourcesLock
109
1fae65190b17 errors raise signals; check arg-count in valueWith...
claus
parents: 93
diff changeset
   222
! !
1fae65190b17 errors raise signals; check arg-count in valueWith...
claus
parents: 93
diff changeset
   223
1775
6892b91ddc0b F_CALLED flag is no longer present
Claus Gittinger <cg@exept.de>
parents: 1692
diff changeset
   224
!Method class methodsFor:'Signal constants'!
159
514c749165c3 *** empty log message ***
claus
parents: 142
diff changeset
   225
514c749165c3 *** empty log message ***
claus
parents: 142
diff changeset
   226
privateMethodSignal
176
48061f8659aa more queries
claus
parents: 159
diff changeset
   227
    "return the signal raised when a private/protected method is called
48061f8659aa more queries
claus
parents: 159
diff changeset
   228
     by some other object (i.e. not a self- or super send)"
48061f8659aa more queries
claus
parents: 159
diff changeset
   229
159
514c749165c3 *** empty log message ***
claus
parents: 142
diff changeset
   230
    ^ PrivateMethodSignal
514c749165c3 *** empty log message ***
claus
parents: 142
diff changeset
   231
! !
514c749165c3 *** empty log message ***
claus
parents: 142
diff changeset
   232
11022
8dd9f699915f +shouldBeSkippedInDebuggersWalkBack
Claus Gittinger <cg@exept.de>
parents: 11016
diff changeset
   233
13570
382db10e848d changed: #parse:with:return:or:
Claus Gittinger <cg@exept.de>
parents: 13569
diff changeset
   234
!Method class methodsFor:'cleanup'!
382db10e848d changed: #parse:with:return:or:
Claus Gittinger <cg@exept.de>
parents: 13569
diff changeset
   235
382db10e848d changed: #parse:with:return:or:
Claus Gittinger <cg@exept.de>
parents: 13569
diff changeset
   236
lowSpaceCleanup
22061
6b7d60d13319 #DOCUMENTATION by cg
Claus Gittinger <cg@exept.de>
parents: 22019
diff changeset
   237
    "cleanup in low-memory situations"
6b7d60d13319 #DOCUMENTATION by cg
Claus Gittinger <cg@exept.de>
parents: 22019
diff changeset
   238
13570
382db10e848d changed: #parse:with:return:or:
Claus Gittinger <cg@exept.de>
parents: 13569
diff changeset
   239
    LastParseTreeCache := nil.
13572
c81aeb055fd3 changed: #lowSpaceCleanup
Claus Gittinger <cg@exept.de>
parents: 13571
diff changeset
   240
    LastSourceFileName := LastWhoClass := nil.
14236
d383e9f70795 changed: #lowSpaceCleanup
Claus Gittinger <cg@exept.de>
parents: 14231
diff changeset
   241
    self flushSourceStreamCache.
13570
382db10e848d changed: #parse:with:return:or:
Claus Gittinger <cg@exept.de>
parents: 13569
diff changeset
   242
382db10e848d changed: #parse:with:return:or:
Claus Gittinger <cg@exept.de>
parents: 13569
diff changeset
   243
    "Created: / 08-08-2011 / 19:11:23 / cg"
22061
6b7d60d13319 #DOCUMENTATION by cg
Claus Gittinger <cg@exept.de>
parents: 22019
diff changeset
   244
    "Modified (comment): / 20-07-2017 / 12:06:17 / cg"
13570
382db10e848d changed: #parse:with:return:or:
Claus Gittinger <cg@exept.de>
parents: 13569
diff changeset
   245
! !
382db10e848d changed: #parse:with:return:or:
Claus Gittinger <cg@exept.de>
parents: 13569
diff changeset
   246
1775
6892b91ddc0b F_CALLED flag is no longer present
Claus Gittinger <cg@exept.de>
parents: 1692
diff changeset
   247
!Method class methodsFor:'queries'!
3
24d81bf47225 *** empty log message ***
claus
parents: 2
diff changeset
   248
18462
c45bfbc05503 class: Method
Stefan Vogel <sv@exept.de>
parents: 18438
diff changeset
   249
binarySelectorCharacters
c45bfbc05503 class: Method
Stefan Vogel <sv@exept.de>
parents: 18438
diff changeset
   250
    "return a collection of characters which are allowed in binary selectors"
c45bfbc05503 class: Method
Stefan Vogel <sv@exept.de>
parents: 18438
diff changeset
   251
21937
2cea97649a40 #DOCUMENTATION by cg
Claus Gittinger <cg@exept.de>
parents: 21765
diff changeset
   252
    "/ does not work yet, because we have no 2-byte symbols yet...
2cea97649a40 #DOCUMENTATION by cg
Claus Gittinger <cg@exept.de>
parents: 21765
diff changeset
   253
    "/ ^ '&-+=*/\<>~@,?!!|%#≈≠≡≤≥∓∗∘∧∨∴∼'.
18462
c45bfbc05503 class: Method
Stefan Vogel <sv@exept.de>
parents: 18438
diff changeset
   254
    ^ '&-+=*/\<>~@,?!!|%#'.
21937
2cea97649a40 #DOCUMENTATION by cg
Claus Gittinger <cg@exept.de>
parents: 21765
diff changeset
   255
2cea97649a40 #DOCUMENTATION by cg
Claus Gittinger <cg@exept.de>
parents: 21765
diff changeset
   256
    "Modified: / 02-07-2017 / 01:09:52 / cg"
18462
c45bfbc05503 class: Method
Stefan Vogel <sv@exept.de>
parents: 18438
diff changeset
   257
!
c45bfbc05503 class: Method
Stefan Vogel <sv@exept.de>
parents: 18438
diff changeset
   258
3
24d81bf47225 *** empty log message ***
claus
parents: 2
diff changeset
   259
isBuiltInClass
1264
8d916aa63bce commentary
Claus Gittinger <cg@exept.de>
parents: 1260
diff changeset
   260
    "return true if this class is known by the run-time-system.
8d916aa63bce commentary
Claus Gittinger <cg@exept.de>
parents: 1260
diff changeset
   261
     Here, true is returned for myself, false for subclasses."
3
24d81bf47225 *** empty log message ***
claus
parents: 2
diff changeset
   262
24d81bf47225 *** empty log message ***
claus
parents: 2
diff changeset
   263
    ^ self == Method
1264
8d916aa63bce commentary
Claus Gittinger <cg@exept.de>
parents: 1260
diff changeset
   264
8d916aa63bce commentary
Claus Gittinger <cg@exept.de>
parents: 1260
diff changeset
   265
    "Modified: 23.4.1996 / 15:59:50 / cg"
44
b262907c93ea *** empty log message ***
claus
parents: 42
diff changeset
   266
!
b262907c93ea *** empty log message ***
claus
parents: 42
diff changeset
   267
18462
c45bfbc05503 class: Method
Stefan Vogel <sv@exept.de>
parents: 18438
diff changeset
   268
maxBinarySelectorSize
c45bfbc05503 class: Method
Stefan Vogel <sv@exept.de>
parents: 18438
diff changeset
   269
    ^ 3
c45bfbc05503 class: Method
Stefan Vogel <sv@exept.de>
parents: 18438
diff changeset
   270
c45bfbc05503 class: Method
Stefan Vogel <sv@exept.de>
parents: 18438
diff changeset
   271
    "
c45bfbc05503 class: Method
Stefan Vogel <sv@exept.de>
parents: 18438
diff changeset
   272
     in ST/X, binops are allowed with up-to 3 characters;
c45bfbc05503 class: Method
Stefan Vogel <sv@exept.de>
parents: 18438
diff changeset
   273
     for example:
18620
b4e9f25d6ce6 preparations for lined index list in WeakArray
Claus Gittinger <cg@exept.de>
parents: 18462
diff changeset
   274
	<->
b4e9f25d6ce6 preparations for lined index list in WeakArray
Claus Gittinger <cg@exept.de>
parents: 18462
diff changeset
   275
	<=>
b4e9f25d6ce6 preparations for lined index list in WeakArray
Claus Gittinger <cg@exept.de>
parents: 18462
diff changeset
   276
	+++
b4e9f25d6ce6 preparations for lined index list in WeakArray
Claus Gittinger <cg@exept.de>
parents: 18462
diff changeset
   277
	:=:
18462
c45bfbc05503 class: Method
Stefan Vogel <sv@exept.de>
parents: 18438
diff changeset
   278
     etc. are valid binOps here
c45bfbc05503 class: Method
Stefan Vogel <sv@exept.de>
parents: 18438
diff changeset
   279
    "
c45bfbc05503 class: Method
Stefan Vogel <sv@exept.de>
parents: 18438
diff changeset
   280
!
c45bfbc05503 class: Method
Stefan Vogel <sv@exept.de>
parents: 18438
diff changeset
   281
6089
a3710756f360 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6071
diff changeset
   282
methodDefinitionTemplateForSelector:aSelector
a3710756f360 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6071
diff changeset
   283
    "given a selector, return a prototype definition string"
a3710756f360 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6071
diff changeset
   284
18620
b4e9f25d6ce6 preparations for lined index list in WeakArray
Claus Gittinger <cg@exept.de>
parents: 18462
diff changeset
   285
    ^ self programmingLanguage
b4e9f25d6ce6 preparations for lined index list in WeakArray
Claus Gittinger <cg@exept.de>
parents: 18462
diff changeset
   286
	methodDefinitionTemplateForSelector:aSelector
6090
77dfb33df61a *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6089
diff changeset
   287
77dfb33df61a *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6089
diff changeset
   288
    "
12854
3a3d3c02c3bd *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 12695
diff changeset
   289
     Method methodDefinitionTemplateForSelector:#foo
3a3d3c02c3bd *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 12695
diff changeset
   290
     Method methodDefinitionTemplateForSelector:#+
3a3d3c02c3bd *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 12695
diff changeset
   291
     Method methodDefinitionTemplateForSelector:#foo:bar:baz:
6090
77dfb33df61a *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6089
diff changeset
   292
    "
77dfb33df61a *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6089
diff changeset
   293
!
77dfb33df61a *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6089
diff changeset
   294
77dfb33df61a *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6089
diff changeset
   295
methodDefinitionTemplateForSelector:aSelector andArgumentNames:argNames
77dfb33df61a *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6089
diff changeset
   296
    "given a selector, return a prototype definition string"
77dfb33df61a *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6089
diff changeset
   297
18620
b4e9f25d6ce6 preparations for lined index list in WeakArray
Claus Gittinger <cg@exept.de>
parents: 18462
diff changeset
   298
    ^ self programmingLanguage
b4e9f25d6ce6 preparations for lined index list in WeakArray
Claus Gittinger <cg@exept.de>
parents: 18462
diff changeset
   299
	methodDefinitionTemplateForSelector:aSelector andArgumentNames:argNames
6089
a3710756f360 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6071
diff changeset
   300
a3710756f360 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6071
diff changeset
   301
    "
18620
b4e9f25d6ce6 preparations for lined index list in WeakArray
Claus Gittinger <cg@exept.de>
parents: 18462
diff changeset
   302
     Method methodDefinitionTemplateForSelector:#foo          andArgumentNames:#()
12854
3a3d3c02c3bd *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 12695
diff changeset
   303
     Method methodDefinitionTemplateForSelector:#+            andArgumentNames:#('aNumber')
3a3d3c02c3bd *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 12695
diff changeset
   304
     Method methodDefinitionTemplateForSelector:#foo:bar:baz: andArgumentNames:#('fooArg' 'barArg' 'bazArg')
6089
a3710756f360 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6071
diff changeset
   305
    "
a3710756f360 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6071
diff changeset
   306
!
a3710756f360 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6071
diff changeset
   307
747
ea3b6f7fd7ce added ignoredMethods
Claus Gittinger <cg@exept.de>
parents: 737
diff changeset
   308
methodPrivacySupported
ea3b6f7fd7ce added ignoredMethods
Claus Gittinger <cg@exept.de>
parents: 737
diff changeset
   309
    "return true, if the system was compiled to support methodPrivacy.
ea3b6f7fd7ce added ignoredMethods
Claus Gittinger <cg@exept.de>
parents: 737
diff changeset
   310
     You should not depend on that feature being available."
ea3b6f7fd7ce added ignoredMethods
Claus Gittinger <cg@exept.de>
parents: 737
diff changeset
   311
ea3b6f7fd7ce added ignoredMethods
Claus Gittinger <cg@exept.de>
parents: 737
diff changeset
   312
%{  /* NOCONTEXT */
ea3b6f7fd7ce added ignoredMethods
Claus Gittinger <cg@exept.de>
parents: 737
diff changeset
   313
#if defined(F_PRIVATE) || defined(F_CLASSPRIVATE)
ea3b6f7fd7ce added ignoredMethods
Claus Gittinger <cg@exept.de>
parents: 737
diff changeset
   314
    RETURN (true);
ea3b6f7fd7ce added ignoredMethods
Claus Gittinger <cg@exept.de>
parents: 737
diff changeset
   315
#else
ea3b6f7fd7ce added ignoredMethods
Claus Gittinger <cg@exept.de>
parents: 737
diff changeset
   316
    RETURN (false);
ea3b6f7fd7ce added ignoredMethods
Claus Gittinger <cg@exept.de>
parents: 737
diff changeset
   317
#endif
ea3b6f7fd7ce added ignoredMethods
Claus Gittinger <cg@exept.de>
parents: 737
diff changeset
   318
%}
3342
8bcf0fc80a21 class method #resourceTypes re-added
tz
parents: 3341
diff changeset
   319
!
8bcf0fc80a21 class method #resourceTypes re-added
tz
parents: 3341
diff changeset
   320
8bcf0fc80a21 class method #resourceTypes re-added
tz
parents: 3341
diff changeset
   321
resourceTypes
8bcf0fc80a21 class method #resourceTypes re-added
tz
parents: 3341
diff changeset
   322
    "get the types of resources for which a spec definition and corresponding editor exist"
8bcf0fc80a21 class method #resourceTypes re-added
tz
parents: 3341
diff changeset
   323
8526
326e7dcb212a *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 8518
diff changeset
   324
    ^ #(canvas menu image fileImage help hierarchicalList tabList tableColumns)
3
24d81bf47225 *** empty log message ***
claus
parents: 2
diff changeset
   325
! !
24d81bf47225 *** empty log message ***
claus
parents: 2
diff changeset
   326
1775
6892b91ddc0b F_CALLED flag is no longer present
Claus Gittinger <cg@exept.de>
parents: 1692
diff changeset
   327
!Method class methodsFor:'special'!
957
b405ae99d437 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 952
diff changeset
   328
14039
30251b45156a added: #flushParseTreeCache
Claus Gittinger <cg@exept.de>
parents: 13847
diff changeset
   329
flushParseTreeCache
30251b45156a added: #flushParseTreeCache
Claus Gittinger <cg@exept.de>
parents: 13847
diff changeset
   330
    "used by lint and the compiler"
30251b45156a added: #flushParseTreeCache
Claus Gittinger <cg@exept.de>
parents: 13847
diff changeset
   331
30251b45156a added: #flushParseTreeCache
Claus Gittinger <cg@exept.de>
parents: 13847
diff changeset
   332
    LastParseTreeCache := nil
30251b45156a added: #flushParseTreeCache
Claus Gittinger <cg@exept.de>
parents: 13847
diff changeset
   333
30251b45156a added: #flushParseTreeCache
Claus Gittinger <cg@exept.de>
parents: 13847
diff changeset
   334
    "
30251b45156a added: #flushParseTreeCache
Claus Gittinger <cg@exept.de>
parents: 13847
diff changeset
   335
     Method flushParseTreeCache
30251b45156a added: #flushParseTreeCache
Claus Gittinger <cg@exept.de>
parents: 13847
diff changeset
   336
    "
30251b45156a added: #flushParseTreeCache
Claus Gittinger <cg@exept.de>
parents: 13847
diff changeset
   337
30251b45156a added: #flushParseTreeCache
Claus Gittinger <cg@exept.de>
parents: 13847
diff changeset
   338
    "Created: / 01-03-2012 / 16:45:34 / cg"
30251b45156a added: #flushParseTreeCache
Claus Gittinger <cg@exept.de>
parents: 13847
diff changeset
   339
!
30251b45156a added: #flushParseTreeCache
Claus Gittinger <cg@exept.de>
parents: 13847
diff changeset
   340
957
b405ae99d437 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 952
diff changeset
   341
flushSourceStreamCache
11663
6ef3b25bd306 changed #sourceStream - honor lock
Stefan Vogel <sv@exept.de>
parents: 11428
diff changeset
   342
    LastFileLock critical:[
20035
74774e1ee05d #REFACTORING by stefan
Stefan Vogel <sv@exept.de>
parents: 20032
diff changeset
   343
        LastSourceFileName := LastMethodSources := nil.
74774e1ee05d #REFACTORING by stefan
Stefan Vogel <sv@exept.de>
parents: 20032
diff changeset
   344
        LastFileReference at:1 put:nil.
11663
6ef3b25bd306 changed #sourceStream - honor lock
Stefan Vogel <sv@exept.de>
parents: 11428
diff changeset
   345
    ].
957
b405ae99d437 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 952
diff changeset
   346
7830
a19d3746255f comment
Claus Gittinger <cg@exept.de>
parents: 7771
diff changeset
   347
    "
a19d3746255f comment
Claus Gittinger <cg@exept.de>
parents: 7771
diff changeset
   348
     Method flushSourceStreamCache
a19d3746255f comment
Claus Gittinger <cg@exept.de>
parents: 7771
diff changeset
   349
    "
a19d3746255f comment
Claus Gittinger <cg@exept.de>
parents: 7771
diff changeset
   350
957
b405ae99d437 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 952
diff changeset
   351
    "Created: 9.2.1996 / 19:05:28 / cg"
b405ae99d437 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 952
diff changeset
   352
! !
b405ae99d437 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 952
diff changeset
   353
13657
206c6696707b added: #trapMethodForNumArgs:
Claus Gittinger <cg@exept.de>
parents: 13651
diff changeset
   354
!Method class methodsFor:'trap methods'!
206c6696707b added: #trapMethodForNumArgs:
Claus Gittinger <cg@exept.de>
parents: 13651
diff changeset
   355
206c6696707b added: #trapMethodForNumArgs:
Claus Gittinger <cg@exept.de>
parents: 13651
diff changeset
   356
trapMethodForNumArgs:numArgs
13805
dec466a100bc changed: #trapMethodForNumArgs:
Claus Gittinger <cg@exept.de>
parents: 13693
diff changeset
   357
    "return a method which will raise an invalid code object exception.
dec466a100bc changed: #trapMethodForNumArgs:
Claus Gittinger <cg@exept.de>
parents: 13693
diff changeset
   358
     Before recompiling methods (due to changed variable scopes, for example),
dec466a100bc changed: #trapMethodForNumArgs:
Claus Gittinger <cg@exept.de>
parents: 13693
diff changeset
   359
     all method's code is replaced by this. If recompilation fails, this code
dec466a100bc changed: #trapMethodForNumArgs:
Claus Gittinger <cg@exept.de>
parents: 13693
diff changeset
   360
     remains in the method to make it trap, whenever executed later.
21765
2e5bff2f5a6b #OTHER by mawalch
mawalch
parents: 21749
diff changeset
   361
     Otherwise, if recompilation succeeds, that code will vanish after the compile"
13805
dec466a100bc changed: #trapMethodForNumArgs:
Claus Gittinger <cg@exept.de>
parents: 13693
diff changeset
   362
dec466a100bc changed: #trapMethodForNumArgs:
Claus Gittinger <cg@exept.de>
parents: 13693
diff changeset
   363
    |trapSel trapMethod|
13657
206c6696707b added: #trapMethodForNumArgs:
Claus Gittinger <cg@exept.de>
parents: 13651
diff changeset
   364
206c6696707b added: #trapMethodForNumArgs:
Claus Gittinger <cg@exept.de>
parents: 13651
diff changeset
   365
    trapSel := #(
21765
2e5bff2f5a6b #OTHER by mawalch
mawalch
parents: 21749
diff changeset
   366
                   invalidCodeObject
2e5bff2f5a6b #OTHER by mawalch
mawalch
parents: 21749
diff changeset
   367
                   invalidCodeObjectWith:
2e5bff2f5a6b #OTHER by mawalch
mawalch
parents: 21749
diff changeset
   368
                   invalidCodeObjectWith:with:
2e5bff2f5a6b #OTHER by mawalch
mawalch
parents: 21749
diff changeset
   369
                   invalidCodeObjectWith:with:with:
2e5bff2f5a6b #OTHER by mawalch
mawalch
parents: 21749
diff changeset
   370
                   invalidCodeObjectWith:with:with:with:
2e5bff2f5a6b #OTHER by mawalch
mawalch
parents: 21749
diff changeset
   371
                   invalidCodeObjectWith:with:with:with:with:
2e5bff2f5a6b #OTHER by mawalch
mawalch
parents: 21749
diff changeset
   372
                   invalidCodeObjectWith:with:with:with:with:with:
2e5bff2f5a6b #OTHER by mawalch
mawalch
parents: 21749
diff changeset
   373
                   invalidCodeObjectWith:with:with:with:with:with:with:
2e5bff2f5a6b #OTHER by mawalch
mawalch
parents: 21749
diff changeset
   374
                   invalidCodeObjectWith:with:with:with:with:with:with:with:
2e5bff2f5a6b #OTHER by mawalch
mawalch
parents: 21749
diff changeset
   375
                   invalidCodeObjectWith:with:with:with:with:with:with:with:with:
2e5bff2f5a6b #OTHER by mawalch
mawalch
parents: 21749
diff changeset
   376
                   invalidCodeObjectWith:with:with:with:with:with:with:with:with:with:
2e5bff2f5a6b #OTHER by mawalch
mawalch
parents: 21749
diff changeset
   377
                   invalidCodeObjectWith:with:with:with:with:with:with:with:with:with:with:
2e5bff2f5a6b #OTHER by mawalch
mawalch
parents: 21749
diff changeset
   378
                   invalidCodeObjectWith:with:with:with:with:with:with:with:with:with:with:with:
2e5bff2f5a6b #OTHER by mawalch
mawalch
parents: 21749
diff changeset
   379
                   invalidCodeObjectWith:with:with:with:with:with:with:with:with:with:with:with:with:
2e5bff2f5a6b #OTHER by mawalch
mawalch
parents: 21749
diff changeset
   380
                   invalidCodeObjectWith:with:with:with:with:with:with:with:with:with:with:with:with:with:
2e5bff2f5a6b #OTHER by mawalch
mawalch
parents: 21749
diff changeset
   381
                   invalidCodeObjectWith:with:with:with:with:with:with:with:with:with:with:with:with:with:with:
2e5bff2f5a6b #OTHER by mawalch
mawalch
parents: 21749
diff changeset
   382
                ) at:(numArgs + 1).
13657
206c6696707b added: #trapMethodForNumArgs:
Claus Gittinger <cg@exept.de>
parents: 13651
diff changeset
   383
13805
dec466a100bc changed: #trapMethodForNumArgs:
Claus Gittinger <cg@exept.de>
parents: 13693
diff changeset
   384
    (trapMethod := self compiledMethodAt:trapSel) isNil ifTrue:[
21765
2e5bff2f5a6b #OTHER by mawalch
mawalch
parents: 21749
diff changeset
   385
        trapMethod := Method compiledMethodAt:trapSel.
13805
dec466a100bc changed: #trapMethodForNumArgs:
Claus Gittinger <cg@exept.de>
parents: 13693
diff changeset
   386
    ].
dec466a100bc changed: #trapMethodForNumArgs:
Claus Gittinger <cg@exept.de>
parents: 13693
diff changeset
   387
    ^ trapMethod.
13657
206c6696707b added: #trapMethodForNumArgs:
Claus Gittinger <cg@exept.de>
parents: 13651
diff changeset
   388
16261
52a0604a7b95 class: Method
Stefan Vogel <sv@exept.de>
parents: 16221
diff changeset
   389
    "
21765
2e5bff2f5a6b #OTHER by mawalch
mawalch
parents: 21749
diff changeset
   390
        self trapMethodForNumArgs:2
16261
52a0604a7b95 class: Method
Stefan Vogel <sv@exept.de>
parents: 16221
diff changeset
   391
    "
52a0604a7b95 class: Method
Stefan Vogel <sv@exept.de>
parents: 16221
diff changeset
   392
13657
206c6696707b added: #trapMethodForNumArgs:
Claus Gittinger <cg@exept.de>
parents: 13651
diff changeset
   393
    "Created: / 04-11-1996 / 21:58:58 / cg"
13693
16c890248840 added: #invalidCodeObjectWith:
sr
parents: 13683
diff changeset
   394
    "Modified: / 14-09-2011 / 11:23:09 / sr"
13805
dec466a100bc changed: #trapMethodForNumArgs:
Claus Gittinger <cg@exept.de>
parents: 13693
diff changeset
   395
    "Modified (comment): / 30-10-2011 / 11:04:24 / cg"
21765
2e5bff2f5a6b #OTHER by mawalch
mawalch
parents: 21749
diff changeset
   396
    "Modified (comment): / 22-05-2017 / 15:08:44 / mawalch"
13657
206c6696707b added: #trapMethodForNumArgs:
Claus Gittinger <cg@exept.de>
parents: 13651
diff changeset
   397
! !
206c6696707b added: #trapMethodForNumArgs:
Claus Gittinger <cg@exept.de>
parents: 13651
diff changeset
   398
13634
40d6d6b5d9f0 added: #pragmas
Claus Gittinger <cg@exept.de>
parents: 13629
diff changeset
   399
!Method methodsFor:'Compatibility-Squeak'!
40d6d6b5d9f0 added: #pragmas
Claus Gittinger <cg@exept.de>
parents: 13629
diff changeset
   400
14161
3b44e4394070 added: #isCompiledMethod
Claus Gittinger <cg@exept.de>
parents: 14152
diff changeset
   401
isCompiledMethod
3b44e4394070 added: #isCompiledMethod
Claus Gittinger <cg@exept.de>
parents: 14152
diff changeset
   402
    ^ true
3b44e4394070 added: #isCompiledMethod
Claus Gittinger <cg@exept.de>
parents: 14152
diff changeset
   403
3b44e4394070 added: #isCompiledMethod
Claus Gittinger <cg@exept.de>
parents: 14152
diff changeset
   404
    "Created: / 13-06-2012 / 14:51:19 / cg"
3b44e4394070 added: #isCompiledMethod
Claus Gittinger <cg@exept.de>
parents: 14152
diff changeset
   405
!
3b44e4394070 added: #isCompiledMethod
Claus Gittinger <cg@exept.de>
parents: 14152
diff changeset
   406
13676
a45e94212639 added: #pragmaAt:
Claus Gittinger <cg@exept.de>
parents: 13662
diff changeset
   407
pragmaAt:aKey
a45e94212639 added: #pragmaAt:
Claus Gittinger <cg@exept.de>
parents: 13662
diff changeset
   408
    ^ self annotationAt:aKey
a45e94212639 added: #pragmaAt:
Claus Gittinger <cg@exept.de>
parents: 13662
diff changeset
   409
a45e94212639 added: #pragmaAt:
Claus Gittinger <cg@exept.de>
parents: 13662
diff changeset
   410
    "Created: / 11-09-2011 / 18:09:05 / cg"
a45e94212639 added: #pragmaAt:
Claus Gittinger <cg@exept.de>
parents: 13662
diff changeset
   411
!
a45e94212639 added: #pragmaAt:
Claus Gittinger <cg@exept.de>
parents: 13662
diff changeset
   412
13634
40d6d6b5d9f0 added: #pragmas
Claus Gittinger <cg@exept.de>
parents: 13629
diff changeset
   413
pragmas
16193
004fe3b584a7 class: Method
Claus Gittinger <cg@exept.de>
parents: 16130
diff changeset
   414
    "for squeak compatibility, we only present real pragmas"
004fe3b584a7 class: Method
Claus Gittinger <cg@exept.de>
parents: 16130
diff changeset
   415
004fe3b584a7 class: Method
Claus Gittinger <cg@exept.de>
parents: 16130
diff changeset
   416
    ^ (self annotations ? #()) select:[:a | a isArray not and:[ a isResource not ] ]
13679
3fd763ff0911 added: #propertyValueAt:
Claus Gittinger <cg@exept.de>
parents: 13676
diff changeset
   417
!
3fd763ff0911 added: #propertyValueAt:
Claus Gittinger <cg@exept.de>
parents: 13676
diff changeset
   418
3fd763ff0911 added: #propertyValueAt:
Claus Gittinger <cg@exept.de>
parents: 13676
diff changeset
   419
propertyValueAt:aKey
3fd763ff0911 added: #propertyValueAt:
Claus Gittinger <cg@exept.de>
parents: 13676
diff changeset
   420
    "for now - no properties"
3fd763ff0911 added: #propertyValueAt:
Claus Gittinger <cg@exept.de>
parents: 13676
diff changeset
   421
3fd763ff0911 added: #propertyValueAt:
Claus Gittinger <cg@exept.de>
parents: 13676
diff changeset
   422
    ^ nil
3fd763ff0911 added: #propertyValueAt:
Claus Gittinger <cg@exept.de>
parents: 13676
diff changeset
   423
3fd763ff0911 added: #propertyValueAt:
Claus Gittinger <cg@exept.de>
parents: 13676
diff changeset
   424
    "Created: / 12-09-2011 / 08:42:02 / cg"
16910
8f814706ef37 Added Method>>sourceCode Squeak compatibility method
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 16877
diff changeset
   425
!
8f814706ef37 Added Method>>sourceCode Squeak compatibility method
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 16877
diff changeset
   426
8f814706ef37 Added Method>>sourceCode Squeak compatibility method
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 16877
diff changeset
   427
sourceCode
8f814706ef37 Added Method>>sourceCode Squeak compatibility method
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 16877
diff changeset
   428
    ^ self source
8f814706ef37 Added Method>>sourceCode Squeak compatibility method
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 16877
diff changeset
   429
8f814706ef37 Added Method>>sourceCode Squeak compatibility method
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 16877
diff changeset
   430
    "Created: / 30-10-2014 / 23:24:06 / Jan Vrany <jan.vrany@fit.cvut.cz>"
13634
40d6d6b5d9f0 added: #pragmas
Claus Gittinger <cg@exept.de>
parents: 13629
diff changeset
   431
! !
13422
b43a8a47037c Jan's changes
vrany
parents: 13390
diff changeset
   432
7261
f35fc9cee675 method category rename
Claus Gittinger <cg@exept.de>
parents: 7258
diff changeset
   433
!Method methodsFor:'Compatibility-VW'!
5967
ab762bb4f64f added #sendsSelector:
Claus Gittinger <cg@exept.de>
parents: 5959
diff changeset
   434
17647
6728a090cd05 class: Method
Claus Gittinger <cg@exept.de>
parents: 17562
diff changeset
   435
attributeAt:aSymbol ifAbsent:exceptionValue
6728a090cd05 class: Method
Claus Gittinger <cg@exept.de>
parents: 17562
diff changeset
   436
    |annots|
6728a090cd05 class: Method
Claus Gittinger <cg@exept.de>
parents: 17562
diff changeset
   437
6728a090cd05 class: Method
Claus Gittinger <cg@exept.de>
parents: 17562
diff changeset
   438
    annots := self annotationsAt:aSymbol.
17693
34f65034df3e class: Method
Claus Gittinger <cg@exept.de>
parents: 17647
diff changeset
   439
    annots isEmptyOrNil ifTrue:[
18620
b4e9f25d6ce6 preparations for lined index list in WeakArray
Claus Gittinger <cg@exept.de>
parents: 18462
diff changeset
   440
	(aSymbol endsWith:$:) ifFalse:[
b4e9f25d6ce6 preparations for lined index list in WeakArray
Claus Gittinger <cg@exept.de>
parents: 18462
diff changeset
   441
	    annots := self annotationsAt:(aSymbol,$:) asSymbol.
b4e9f25d6ce6 preparations for lined index list in WeakArray
Claus Gittinger <cg@exept.de>
parents: 18462
diff changeset
   442
	].
b4e9f25d6ce6 preparations for lined index list in WeakArray
Claus Gittinger <cg@exept.de>
parents: 18462
diff changeset
   443
	annots isEmptyOrNil ifTrue:[
b4e9f25d6ce6 preparations for lined index list in WeakArray
Claus Gittinger <cg@exept.de>
parents: 18462
diff changeset
   444
	    ^ exceptionValue value
b4e9f25d6ce6 preparations for lined index list in WeakArray
Claus Gittinger <cg@exept.de>
parents: 18462
diff changeset
   445
	].
17693
34f65034df3e class: Method
Claus Gittinger <cg@exept.de>
parents: 17647
diff changeset
   446
    ].
17647
6728a090cd05 class: Method
Claus Gittinger <cg@exept.de>
parents: 17562
diff changeset
   447
    ^ annots first arguments first
6728a090cd05 class: Method
Claus Gittinger <cg@exept.de>
parents: 17562
diff changeset
   448
!
6728a090cd05 class: Method
Claus Gittinger <cg@exept.de>
parents: 17562
diff changeset
   449
6728a090cd05 class: Method
Claus Gittinger <cg@exept.de>
parents: 17562
diff changeset
   450
attributeMessages
18620
b4e9f25d6ce6 preparations for lined index list in WeakArray
Claus Gittinger <cg@exept.de>
parents: 18462
diff changeset
   451
    ^ self annotations
b4e9f25d6ce6 preparations for lined index list in WeakArray
Claus Gittinger <cg@exept.de>
parents: 18462
diff changeset
   452
	collect:[:annot | Message selector:annot key arguments:annot arguments]
17647
6728a090cd05 class: Method
Claus Gittinger <cg@exept.de>
parents: 17562
diff changeset
   453
!
6728a090cd05 class: Method
Claus Gittinger <cg@exept.de>
parents: 17562
diff changeset
   454
11146
553e658691d2 +classIsMeta
Claus Gittinger <cg@exept.de>
parents: 11066
diff changeset
   455
classIsMeta
553e658691d2 +classIsMeta
Claus Gittinger <cg@exept.de>
parents: 11066
diff changeset
   456
    "return true, if this method is a class method"
553e658691d2 +classIsMeta
Claus Gittinger <cg@exept.de>
parents: 11066
diff changeset
   457
12854
3a3d3c02c3bd *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 12695
diff changeset
   458
    ^ self mclass isMeta
5967
ab762bb4f64f added #sendsSelector:
Claus Gittinger <cg@exept.de>
parents: 5959
diff changeset
   459
! !
ab762bb4f64f added #sendsSelector:
Claus Gittinger <cg@exept.de>
parents: 5959
diff changeset
   460
9096
84df3b129718 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9075
diff changeset
   461
1
a27a279701f8 Initial revision
claus
parents:
diff changeset
   462
!Method methodsFor:'accessing'!
a27a279701f8 Initial revision
claus
parents:
diff changeset
   463
952
d600e08a5936 handle the case where a method has a sourceFileInfo, but the class has not
Claus Gittinger <cg@exept.de>
parents: 934
diff changeset
   464
category
22372
72db331204d4 #DOCUMENTATION by cg
Claus Gittinger <cg@exept.de>
parents: 22188
diff changeset
   465
    "return the method's category or nil"
737
4ed893ad3f0f try more to find source of obsolete methods
Claus Gittinger <cg@exept.de>
parents: 690
diff changeset
   466
952
d600e08a5936 handle the case where a method has a sourceFileInfo, but the class has not
Claus Gittinger <cg@exept.de>
parents: 934
diff changeset
   467
    ^ category
22372
72db331204d4 #DOCUMENTATION by cg
Claus Gittinger <cg@exept.de>
parents: 22188
diff changeset
   468
72db331204d4 #DOCUMENTATION by cg
Claus Gittinger <cg@exept.de>
parents: 22188
diff changeset
   469
    "Modified (comment): / 21-11-2017 / 13:03:48 / cg"
1
a27a279701f8 Initial revision
claus
parents:
diff changeset
   470
!
a27a279701f8 Initial revision
claus
parents:
diff changeset
   471
952
d600e08a5936 handle the case where a method has a sourceFileInfo, but the class has not
Claus Gittinger <cg@exept.de>
parents: 934
diff changeset
   472
category:aStringOrSymbol
22372
72db331204d4 #DOCUMENTATION by cg
Claus Gittinger <cg@exept.de>
parents: 22188
diff changeset
   473
    "set the method's category"
1
a27a279701f8 Initial revision
claus
parents:
diff changeset
   474
5724
96c2a5cf4217 category: and package: now send change notifications.
Claus Gittinger <cg@exept.de>
parents: 5721
diff changeset
   475
    |newCategory oldCategory cls|
5721
5f97733ff519 methods now send change-notifications when the category changes
Claus Gittinger <cg@exept.de>
parents: 5704
diff changeset
   476
3934
a8c6075f9988 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 3845
diff changeset
   477
    aStringOrSymbol notNil ifTrue:[
22372
72db331204d4 #DOCUMENTATION by cg
Claus Gittinger <cg@exept.de>
parents: 22188
diff changeset
   478
        newCategory := aStringOrSymbol.
72db331204d4 #DOCUMENTATION by cg
Claus Gittinger <cg@exept.de>
parents: 22188
diff changeset
   479
        newCategory ~= (oldCategory := category) ifTrue:[
72db331204d4 #DOCUMENTATION by cg
Claus Gittinger <cg@exept.de>
parents: 22188
diff changeset
   480
            self setCategory:newCategory.
72db331204d4 #DOCUMENTATION by cg
Claus Gittinger <cg@exept.de>
parents: 22188
diff changeset
   481
72db331204d4 #DOCUMENTATION by cg
Claus Gittinger <cg@exept.de>
parents: 22188
diff changeset
   482
            cls := self mclass.
72db331204d4 #DOCUMENTATION by cg
Claus Gittinger <cg@exept.de>
parents: 22188
diff changeset
   483
            cls notNil ifTrue:[
72db331204d4 #DOCUMENTATION by cg
Claus Gittinger <cg@exept.de>
parents: 22188
diff changeset
   484
                cls addChangeRecordForMethodCategory:self category:newCategory.
72db331204d4 #DOCUMENTATION by cg
Claus Gittinger <cg@exept.de>
parents: 22188
diff changeset
   485
                self changed:#category with:oldCategory.            "/ will vanish
72db331204d4 #DOCUMENTATION by cg
Claus Gittinger <cg@exept.de>
parents: 22188
diff changeset
   486
                cls changed:#organization with:self selector.       "/ will vanish
72db331204d4 #DOCUMENTATION by cg
Claus Gittinger <cg@exept.de>
parents: 22188
diff changeset
   487
                Smalltalk changed:#methodCategory with:(Array with:cls with:self with:oldCategory).
72db331204d4 #DOCUMENTATION by cg
Claus Gittinger <cg@exept.de>
parents: 22188
diff changeset
   488
            ]
72db331204d4 #DOCUMENTATION by cg
Claus Gittinger <cg@exept.de>
parents: 22188
diff changeset
   489
        ]
3934
a8c6075f9988 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 3845
diff changeset
   490
    ]
a8c6075f9988 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 3845
diff changeset
   491
10729
16fea9f03635 changed #category:
Claus Gittinger <cg@exept.de>
parents: 10673
diff changeset
   492
    "Modified: / 25-09-2007 / 16:15:24 / cg"
22372
72db331204d4 #DOCUMENTATION by cg
Claus Gittinger <cg@exept.de>
parents: 22188
diff changeset
   493
    "Modified (comment): / 21-11-2017 / 13:03:52 / cg"
1
a27a279701f8 Initial revision
claus
parents:
diff changeset
   494
!
a27a279701f8 Initial revision
claus
parents:
diff changeset
   495
39
bcf183a31bbb *** empty log message ***
claus
parents: 13
diff changeset
   496
comment
16847
b3e7faf77eb1 class: Method
Claus Gittinger <cg@exept.de>
parents: 16737
diff changeset
   497
    "return the method's comment.
68
59faa75185ba *** empty log message ***
claus
parents: 56
diff changeset
   498
     This is done by searching for and returning the first comment
22372
72db331204d4 #DOCUMENTATION by cg
Claus Gittinger <cg@exept.de>
parents: 22188
diff changeset
   499
     from the method's source (excluding any double-quotes).
68
59faa75185ba *** empty log message ***
claus
parents: 56
diff changeset
   500
     Returns nil if there is no comment (or source is not available)."
39
bcf183a31bbb *** empty log message ***
claus
parents: 13
diff changeset
   501
14152
4b6500ff4bec changed: #comment
Claus Gittinger <cg@exept.de>
parents: 14090
diff changeset
   502
    |src parserClass|
39
bcf183a31bbb *** empty log message ***
claus
parents: 13
diff changeset
   503
159
514c749165c3 *** empty log message ***
claus
parents: 142
diff changeset
   504
    src := self source.
514c749165c3 *** empty log message ***
claus
parents: 142
diff changeset
   505
    src isNil ifTrue:[^ nil].
14152
4b6500ff4bec changed: #comment
Claus Gittinger <cg@exept.de>
parents: 14090
diff changeset
   506
    (parserClass := self programmingLanguage parserClass) isNil ifTrue:[^ nil].
4b6500ff4bec changed: #comment
Claus Gittinger <cg@exept.de>
parents: 14090
diff changeset
   507
    ^ parserClass methodCommentFromSource:src
93
e31220cb391f *** empty log message ***
claus
parents: 88
diff changeset
   508
e31220cb391f *** empty log message ***
claus
parents: 88
diff changeset
   509
    "
13463
7c98583d98c8 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 13422
diff changeset
   510
     (Method compiledMethodAt:#comment) comment
12854
3a3d3c02c3bd *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 12695
diff changeset
   511
     (Object class compiledMethodAt:#infoPrinting:) comment
93
e31220cb391f *** empty log message ***
claus
parents: 88
diff changeset
   512
    "
1236
5c9bc68e3c71 use new scanner feature to extract comment
Claus Gittinger <cg@exept.de>
parents: 1194
diff changeset
   513
12948
f238e8b26110 changed: #comment
Claus Gittinger <cg@exept.de>
parents: 12913
diff changeset
   514
    "Modified: / 23-02-1998 / 10:26:08 / stefan"
14152
4b6500ff4bec changed: #comment
Claus Gittinger <cg@exept.de>
parents: 14090
diff changeset
   515
    "Modified: / 01-06-2012 / 23:03:57 / cg"
22372
72db331204d4 #DOCUMENTATION by cg
Claus Gittinger <cg@exept.de>
parents: 22188
diff changeset
   516
    "Modified (comment): / 21-11-2017 / 13:03:59 / cg"
39
bcf183a31bbb *** empty log message ***
claus
parents: 13
diff changeset
   517
!
bcf183a31bbb *** empty log message ***
claus
parents: 13
diff changeset
   518
14595
5c27c812055b class: Method
Claus Gittinger <cg@exept.de>
parents: 14573
diff changeset
   519
getMclass
17278
7813956ffab4 class: Method
Claus Gittinger <cg@exept.de>
parents: 17254
diff changeset
   520
    "return the last known class in which this method was (or still is) contained in.
7813956ffab4 class: Method
Claus Gittinger <cg@exept.de>
parents: 17254
diff changeset
   521
     Notice, that the mclass query returns nil, if a method is wrapped or no longer valid
7813956ffab4 class: Method
Claus Gittinger <cg@exept.de>
parents: 17254
diff changeset
   522
     due to an accept in a browser or debugger. However, the mclass slot still contains a
7813956ffab4 class: Method
Claus Gittinger <cg@exept.de>
parents: 17254
diff changeset
   523
     reference to the once valid class"
7813956ffab4 class: Method
Claus Gittinger <cg@exept.de>
parents: 17254
diff changeset
   524
18620
b4e9f25d6ce6 preparations for lined index list in WeakArray
Claus Gittinger <cg@exept.de>
parents: 18462
diff changeset
   525
    ^ mclass
14595
5c27c812055b class: Method
Claus Gittinger <cg@exept.de>
parents: 14573
diff changeset
   526
!
5c27c812055b class: Method
Claus Gittinger <cg@exept.de>
parents: 14573
diff changeset
   527
9702
468675f92260 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9692
diff changeset
   528
getPackage
468675f92260 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9692
diff changeset
   529
    "return the package-ID of the method"
468675f92260 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9692
diff changeset
   530
468675f92260 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9692
diff changeset
   531
    ^ package
468675f92260 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9692
diff changeset
   532
!
468675f92260 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9692
diff changeset
   533
952
d600e08a5936 handle the case where a method has a sourceFileInfo, but the class has not
Claus Gittinger <cg@exept.de>
parents: 934
diff changeset
   534
getSource
3160
db5c1aa38fda comment
Claus Gittinger <cg@exept.de>
parents: 3144
diff changeset
   535
    "low-level access to the source instance-variable.
4751
174a92d4ba3f checkin from browser
Claus Gittinger <cg@exept.de>
parents: 4669
diff changeset
   536
     For internal (compiler) use only.
22372
72db331204d4 #DOCUMENTATION by cg
Claus Gittinger <cg@exept.de>
parents: 22188
diff changeset
   537
     This is NOT always the method's source string"
3160
db5c1aa38fda comment
Claus Gittinger <cg@exept.de>
parents: 3144
diff changeset
   538
952
d600e08a5936 handle the case where a method has a sourceFileInfo, but the class has not
Claus Gittinger <cg@exept.de>
parents: 934
diff changeset
   539
    ^ source
22372
72db331204d4 #DOCUMENTATION by cg
Claus Gittinger <cg@exept.de>
parents: 22188
diff changeset
   540
72db331204d4 #DOCUMENTATION by cg
Claus Gittinger <cg@exept.de>
parents: 22188
diff changeset
   541
    "Modified (comment): / 21-11-2017 / 13:04:03 / cg"
414
claus
parents: 400
diff changeset
   542
!
claus
parents: 400
diff changeset
   543
4751
174a92d4ba3f checkin from browser
Claus Gittinger <cg@exept.de>
parents: 4669
diff changeset
   544
getSourcePosition
174a92d4ba3f checkin from browser
Claus Gittinger <cg@exept.de>
parents: 4669
diff changeset
   545
    "low-level access to the sourcePosition instance-variable.
174a92d4ba3f checkin from browser
Claus Gittinger <cg@exept.de>
parents: 4669
diff changeset
   546
     For internal (compiler) use only.
22372
72db331204d4 #DOCUMENTATION by cg
Claus Gittinger <cg@exept.de>
parents: 22188
diff changeset
   547
     This is NOT always the method's sourcePosition"
4751
174a92d4ba3f checkin from browser
Claus Gittinger <cg@exept.de>
parents: 4669
diff changeset
   548
174a92d4ba3f checkin from browser
Claus Gittinger <cg@exept.de>
parents: 4669
diff changeset
   549
    ^ sourcePosition
22372
72db331204d4 #DOCUMENTATION by cg
Claus Gittinger <cg@exept.de>
parents: 22188
diff changeset
   550
72db331204d4 #DOCUMENTATION by cg
Claus Gittinger <cg@exept.de>
parents: 22188
diff changeset
   551
    "Modified (comment): / 21-11-2017 / 13:04:07 / cg"
4751
174a92d4ba3f checkin from browser
Claus Gittinger <cg@exept.de>
parents: 4669
diff changeset
   552
!
174a92d4ba3f checkin from browser
Claus Gittinger <cg@exept.de>
parents: 4669
diff changeset
   553
2176
1a24b0cef25a when compressing sources, make certain to avoid later
Claus Gittinger <cg@exept.de>
parents: 2171
diff changeset
   554
localSourceFilename:aFileName position:aNumber
15346
c8f751f80e5b class: Method
Claus Gittinger <cg@exept.de>
parents: 15245
diff changeset
   555
    "set the method's sourcefile/position indicating, that
c8f751f80e5b class: Method
Claus Gittinger <cg@exept.de>
parents: 15245
diff changeset
   556
     this is a local file (i.e. the 'st.src' file).
c8f751f80e5b class: Method
Claus Gittinger <cg@exept.de>
parents: 15245
diff changeset
   557
     The indicator for this is a negative source position."
c8f751f80e5b class: Method
Claus Gittinger <cg@exept.de>
parents: 15245
diff changeset
   558
c8f751f80e5b class: Method
Claus Gittinger <cg@exept.de>
parents: 15245
diff changeset
   559
    self assert:(aFileName isText not).   "/ will break monticello-binary-data-writing
2176
1a24b0cef25a when compressing sources, make certain to avoid later
Claus Gittinger <cg@exept.de>
parents: 2171
diff changeset
   560
    source := aFileName.
1a24b0cef25a when compressing sources, make certain to avoid later
Claus Gittinger <cg@exept.de>
parents: 2171
diff changeset
   561
    sourcePosition := aNumber negated
1a24b0cef25a when compressing sources, make certain to avoid later
Claus Gittinger <cg@exept.de>
parents: 2171
diff changeset
   562
1a24b0cef25a when compressing sources, make certain to avoid later
Claus Gittinger <cg@exept.de>
parents: 2171
diff changeset
   563
    "Created: 16.1.1997 / 01:25:52 / cg"
1a24b0cef25a when compressing sources, make certain to avoid later
Claus Gittinger <cg@exept.de>
parents: 2171
diff changeset
   564
!
1a24b0cef25a when compressing sources, make certain to avoid later
Claus Gittinger <cg@exept.de>
parents: 2171
diff changeset
   565
13422
b43a8a47037c Jan's changes
vrany
parents: 13390
diff changeset
   566
lookupObject
b43a8a47037c Jan's changes
vrany
parents: 13390
diff changeset
   567
18368
5e8af3b07aa1 class: Method
Claus Gittinger <cg@exept.de>
parents: 17693
diff changeset
   568
    "/ lookupObject isNil ifTrue:[^ BuiltinLookup instance "Lookup builtin"].
5e8af3b07aa1 class: Method
Claus Gittinger <cg@exept.de>
parents: 17693
diff changeset
   569
    ^ lookupObject
13422
b43a8a47037c Jan's changes
vrany
parents: 13390
diff changeset
   570
b43a8a47037c Jan's changes
vrany
parents: 13390
diff changeset
   571
    "Created: / 28-04-2010 / 18:36:29 / Jan Vrany <jan.vrany@fit.cvut.cz>"
13817
7d1e0e8ea364 changed:10 methods
Claus Gittinger <cg@exept.de>
parents: 13805
diff changeset
   572
    "Modified: / 18-11-2011 / 14:47:12 / cg"
13422
b43a8a47037c Jan's changes
vrany
parents: 13390
diff changeset
   573
!
b43a8a47037c Jan's changes
vrany
parents: 13390
diff changeset
   574
b43a8a47037c Jan's changes
vrany
parents: 13390
diff changeset
   575
lookupObject: anObject
18368
5e8af3b07aa1 class: Method
Claus Gittinger <cg@exept.de>
parents: 17693
diff changeset
   576
    anObject == BuiltinLookup instance ifTrue:[
18620
b4e9f25d6ce6 preparations for lined index list in WeakArray
Claus Gittinger <cg@exept.de>
parents: 18462
diff changeset
   577
	self setLookupObject: nil
18368
5e8af3b07aa1 class: Method
Claus Gittinger <cg@exept.de>
parents: 17693
diff changeset
   578
    ] ifFalse:[
18620
b4e9f25d6ce6 preparations for lined index list in WeakArray
Claus Gittinger <cg@exept.de>
parents: 18462
diff changeset
   579
	self setLookupObject: anObject.
18368
5e8af3b07aa1 class: Method
Claus Gittinger <cg@exept.de>
parents: 17693
diff changeset
   580
    ].
13422
b43a8a47037c Jan's changes
vrany
parents: 13390
diff changeset
   581
b43a8a47037c Jan's changes
vrany
parents: 13390
diff changeset
   582
    "Created: / 28-04-2010 / 18:36:07 / Jan Vrany <jan.vrany@fit.cvut.cz>"
b43a8a47037c Jan's changes
vrany
parents: 13390
diff changeset
   583
    "Modified: / 11-07-2010 / 19:32:28 / Jan Vrany <jan.vrany@fit.cvut.cz>"
b43a8a47037c Jan's changes
vrany
parents: 13390
diff changeset
   584
!
b43a8a47037c Jan's changes
vrany
parents: 13390
diff changeset
   585
5152
2aacfb3976d4 when changing the package, make certain that the source
Claus Gittinger <cg@exept.de>
parents: 5115
diff changeset
   586
makeLocalStringSource
22372
72db331204d4 #DOCUMENTATION by cg
Claus Gittinger <cg@exept.de>
parents: 22188
diff changeset
   587
    "assure that the method's source code is stored locally as a string
5152
2aacfb3976d4 when changing the package, make certain that the source
Claus Gittinger <cg@exept.de>
parents: 5115
diff changeset
   588
     within the method (as opposed to an external string, which is accessed
2aacfb3976d4 when changing the package, make certain that the source
Claus Gittinger <cg@exept.de>
parents: 5115
diff changeset
   589
     by reading the source code file).
15346
c8f751f80e5b class: Method
Claus Gittinger <cg@exept.de>
parents: 15245
diff changeset
   590
     This is required, when a method's package is changed, to assure that its
5152
2aacfb3976d4 when changing the package, make certain that the source
Claus Gittinger <cg@exept.de>
parents: 5115
diff changeset
   591
     sourceCode is not lost."
2aacfb3976d4 when changing the package, make certain that the source
Claus Gittinger <cg@exept.de>
parents: 5115
diff changeset
   592
2aacfb3976d4 when changing the package, make certain that the source
Claus Gittinger <cg@exept.de>
parents: 5115
diff changeset
   593
    source notNil ifTrue:[
22372
72db331204d4 #DOCUMENTATION by cg
Claus Gittinger <cg@exept.de>
parents: 22188
diff changeset
   594
        sourcePosition notNil ifTrue:[
72db331204d4 #DOCUMENTATION by cg
Claus Gittinger <cg@exept.de>
parents: 22188
diff changeset
   595
            "/ this looks wierd - but (self source) will retrieve the external source
72db331204d4 #DOCUMENTATION by cg
Claus Gittinger <cg@exept.de>
parents: 22188
diff changeset
   596
            "/ (from the file) and store it. So afterwards, we will have the string and
72db331204d4 #DOCUMENTATION by cg
Claus Gittinger <cg@exept.de>
parents: 22188
diff changeset
   597
            "/ sourcePosition will be nil
72db331204d4 #DOCUMENTATION by cg
Claus Gittinger <cg@exept.de>
parents: 22188
diff changeset
   598
            self source:(self source)
72db331204d4 #DOCUMENTATION by cg
Claus Gittinger <cg@exept.de>
parents: 22188
diff changeset
   599
        ]
5152
2aacfb3976d4 when changing the package, make certain that the source
Claus Gittinger <cg@exept.de>
parents: 5115
diff changeset
   600
    ].
22372
72db331204d4 #DOCUMENTATION by cg
Claus Gittinger <cg@exept.de>
parents: 22188
diff changeset
   601
72db331204d4 #DOCUMENTATION by cg
Claus Gittinger <cg@exept.de>
parents: 22188
diff changeset
   602
    "Modified (comment): / 21-11-2017 / 13:04:13 / cg"
5152
2aacfb3976d4 when changing the package, make certain that the source
Claus Gittinger <cg@exept.de>
parents: 5115
diff changeset
   603
!
2aacfb3976d4 when changing the package, make certain that the source
Claus Gittinger <cg@exept.de>
parents: 5115
diff changeset
   604
5324
5c9959ce98af make use of mclass
Claus Gittinger <cg@exept.de>
parents: 5322
diff changeset
   605
mclass:aClass
14508
859dca6352f8 class: Method
Claus Gittinger <cg@exept.de>
parents: 14505
diff changeset
   606
    "set the method's class. That is the class in which I am installed.
859dca6352f8 class: Method
Claus Gittinger <cg@exept.de>
parents: 14505
diff changeset
   607
     This is a cache; the validity of which will be checked and the cache
859dca6352f8 class: Method
Claus Gittinger <cg@exept.de>
parents: 14505
diff changeset
   608
     possibly be invalidated when mclass is asked for."
859dca6352f8 class: Method
Claus Gittinger <cg@exept.de>
parents: 14505
diff changeset
   609
859dca6352f8 class: Method
Claus Gittinger <cg@exept.de>
parents: 14505
diff changeset
   610
"/    mclass == aClass ifTrue:[ ^ self ].
859dca6352f8 class: Method
Claus Gittinger <cg@exept.de>
parents: 14505
diff changeset
   611
"/
12323
973c8740503b changed: #mclass:
Claus Gittinger <cg@exept.de>
parents: 12283
diff changeset
   612
"/     (mclass notNil and:[aClass notNil]) ifTrue:[
973c8740503b changed: #mclass:
Claus Gittinger <cg@exept.de>
parents: 12283
diff changeset
   613
"/         'Method [warning]: mclass already set' errorPrintCR.
973c8740503b changed: #mclass:
Claus Gittinger <cg@exept.de>
parents: 12283
diff changeset
   614
"/     ].
5696
958a0643496d compatibility
Claus Gittinger <cg@exept.de>
parents: 5676
diff changeset
   615
    mclass := aClass.
10207
b5ca553d15ad localSourceFirst for extensions.
Claus Gittinger <cg@exept.de>
parents: 10201
diff changeset
   616
b5ca553d15ad localSourceFirst for extensions.
Claus Gittinger <cg@exept.de>
parents: 10201
diff changeset
   617
    "Modified: / 28-11-2006 / 12:12:27 / cg"
5696
958a0643496d compatibility
Claus Gittinger <cg@exept.de>
parents: 5676
diff changeset
   618
!
5324
5c9959ce98af make use of mclass
Claus Gittinger <cg@exept.de>
parents: 5322
diff changeset
   619
13422
b43a8a47037c Jan's changes
vrany
parents: 13390
diff changeset
   620
nameSpace
b43a8a47037c Jan's changes
vrany
parents: 13390
diff changeset
   621
    "Returns my namespace or nil. If no explicit method namespace
21749
7d98ef6a1dee #DOCUMENTATION by mawalch
mawalch
parents: 21692
diff changeset
   622
     is set, my programming language is used as default namespace
17514
eb4568cb00ba class: Method
Claus Gittinger <cg@exept.de>
parents: 17463
diff changeset
   623
     (for compatibility reasons, nil is returned for smalltalk methods,
13422
b43a8a47037c Jan's changes
vrany
parents: 13390
diff changeset
   624
     which means that the method is not namespaced).
b43a8a47037c Jan's changes
vrany
parents: 13390
diff changeset
   625
    "
b43a8a47037c Jan's changes
vrany
parents: 13390
diff changeset
   626
14552
3ab1c7006ba1 class: Method
Claus Gittinger <cg@exept.de>
parents: 14536
diff changeset
   627
    | nsA prefix |
14264
fd05137bd3c3 comment/format in: #nameSpace
Claus Gittinger <cg@exept.de>
parents: 14261
diff changeset
   628
13422
b43a8a47037c Jan's changes
vrany
parents: 13390
diff changeset
   629
    nsA := self annotationAt: #namespace:.
14552
3ab1c7006ba1 class: Method
Claus Gittinger <cg@exept.de>
parents: 14536
diff changeset
   630
    nsA notNil ifTrue:[^nsA nameSpace].
3ab1c7006ba1 class: Method
Claus Gittinger <cg@exept.de>
parents: 14536
diff changeset
   631
3ab1c7006ba1 class: Method
Claus Gittinger <cg@exept.de>
parents: 14536
diff changeset
   632
    prefix := self programmingLanguage defaultSelectorNameSpacePrefix.
3ab1c7006ba1 class: Method
Claus Gittinger <cg@exept.de>
parents: 14536
diff changeset
   633
    (prefix isNil or:[prefix = 'Smalltalk']) ifTrue:[ ^ nil].
15045
00763bf986f0 class: Method
Claus Gittinger <cg@exept.de>
parents: 14864
diff changeset
   634
    ^ NameSpace name:prefix
13422
b43a8a47037c Jan's changes
vrany
parents: 13390
diff changeset
   635
b43a8a47037c Jan's changes
vrany
parents: 13390
diff changeset
   636
    "
15045
00763bf986f0 class: Method
Claus Gittinger <cg@exept.de>
parents: 14864
diff changeset
   637
     (Method >> #nameSpace) nameSpace
00763bf986f0 class: Method
Claus Gittinger <cg@exept.de>
parents: 14864
diff changeset
   638
     (Object >> #yourself) nameSpace
13422
b43a8a47037c Jan's changes
vrany
parents: 13390
diff changeset
   639
    "
b43a8a47037c Jan's changes
vrany
parents: 13390
diff changeset
   640
b43a8a47037c Jan's changes
vrany
parents: 13390
diff changeset
   641
    "Created: / 26-04-2010 / 16:30:43 / Jan Vrany <jan.vrany@fit.cvut.cz>"
b43a8a47037c Jan's changes
vrany
parents: 13390
diff changeset
   642
    "Modified: / 20-05-2010 / 09:38:09 / Jan Vrany <jan.vrany@fit.cvut.cz>"
14264
fd05137bd3c3 comment/format in: #nameSpace
Claus Gittinger <cg@exept.de>
parents: 14261
diff changeset
   643
    "Modified (format): / 27-07-2012 / 14:17:09 / cg"
21749
7d98ef6a1dee #DOCUMENTATION by mawalch
mawalch
parents: 21692
diff changeset
   644
    "Modified (comment): / 16-05-2017 / 11:00:42 / mawalch"
13422
b43a8a47037c Jan's changes
vrany
parents: 13390
diff changeset
   645
!
b43a8a47037c Jan's changes
vrany
parents: 13390
diff changeset
   646
b43a8a47037c Jan's changes
vrany
parents: 13390
diff changeset
   647
nameSpace: aNameSpace
b43a8a47037c Jan's changes
vrany
parents: 13390
diff changeset
   648
14261
403921157431 changed: #nameSpace:
Claus Gittinger <cg@exept.de>
parents: 14253
diff changeset
   649
    self annotateWith: (Annotation nameSpace: aNameSpace name)
13422
b43a8a47037c Jan's changes
vrany
parents: 13390
diff changeset
   650
b43a8a47037c Jan's changes
vrany
parents: 13390
diff changeset
   651
    "Created: / 20-05-2010 / 10:05:23 / Jan Vrany <jan.vrany@fit.cvut.cz>"
b43a8a47037c Jan's changes
vrany
parents: 13390
diff changeset
   652
    "Modified: / 20-05-2010 / 11:30:34 / Jan Vrany <jan.vrany@fit.cvut.cz>"
14261
403921157431 changed: #nameSpace:
Claus Gittinger <cg@exept.de>
parents: 14253
diff changeset
   653
    "Modified: / 26-07-2012 / 23:08:48 / cg"
13422
b43a8a47037c Jan's changes
vrany
parents: 13390
diff changeset
   654
!
b43a8a47037c Jan's changes
vrany
parents: 13390
diff changeset
   655
b43a8a47037c Jan's changes
vrany
parents: 13390
diff changeset
   656
nameSpaceName
b43a8a47037c Jan's changes
vrany
parents: 13390
diff changeset
   657
    | ns |
16261
52a0604a7b95 class: Method
Stefan Vogel <sv@exept.de>
parents: 16221
diff changeset
   658
    ns := self nameSpace.
52a0604a7b95 class: Method
Stefan Vogel <sv@exept.de>
parents: 16221
diff changeset
   659
    ^ ns isNil ifTrue:[''] ifFalse:[ns name]
13422
b43a8a47037c Jan's changes
vrany
parents: 13390
diff changeset
   660
!
b43a8a47037c Jan's changes
vrany
parents: 13390
diff changeset
   661
13100
d5333b6746d1 +originalMethodIfWrapped
Claus Gittinger <cg@exept.de>
parents: 12948
diff changeset
   662
originalMethodIfWrapped
d5333b6746d1 +originalMethodIfWrapped
Claus Gittinger <cg@exept.de>
parents: 12948
diff changeset
   663
    "return the method the receiver is wrapping - none here"
d5333b6746d1 +originalMethodIfWrapped
Claus Gittinger <cg@exept.de>
parents: 12948
diff changeset
   664
d5333b6746d1 +originalMethodIfWrapped
Claus Gittinger <cg@exept.de>
parents: 12948
diff changeset
   665
    ^ self
d5333b6746d1 +originalMethodIfWrapped
Claus Gittinger <cg@exept.de>
parents: 12948
diff changeset
   666
d5333b6746d1 +originalMethodIfWrapped
Claus Gittinger <cg@exept.de>
parents: 12948
diff changeset
   667
    "Created: / 22-10-2010 / 11:46:07 / cg"
d5333b6746d1 +originalMethodIfWrapped
Claus Gittinger <cg@exept.de>
parents: 12948
diff changeset
   668
!
d5333b6746d1 +originalMethodIfWrapped
Claus Gittinger <cg@exept.de>
parents: 12948
diff changeset
   669
13422
b43a8a47037c Jan's changes
vrany
parents: 13390
diff changeset
   670
overriddenMethod
15952
e55b89f8d241 class: Method
Claus Gittinger <cg@exept.de>
parents: 15787
diff changeset
   671
    <resource: #obsolete>
e55b89f8d241 class: Method
Claus Gittinger <cg@exept.de>
parents: 15787
diff changeset
   672
e55b89f8d241 class: Method
Claus Gittinger <cg@exept.de>
parents: 15787
diff changeset
   673
    self obsoleteMethodWarning: 'Use overwrittenMethod instead, stupid naming'.
e55b89f8d241 class: Method
Claus Gittinger <cg@exept.de>
parents: 15787
diff changeset
   674
    ^self overwrittenMethod
e55b89f8d241 class: Method
Claus Gittinger <cg@exept.de>
parents: 15787
diff changeset
   675
e55b89f8d241 class: Method
Claus Gittinger <cg@exept.de>
parents: 15787
diff changeset
   676
    "Created: / 17-06-2009 / 19:09:58 / Jan Vrany <vranyj1@fel.cvut.cz>"
e55b89f8d241 class: Method
Claus Gittinger <cg@exept.de>
parents: 15787
diff changeset
   677
    "Modified (format): / 18-11-2011 / 14:48:07 / cg"
e55b89f8d241 class: Method
Claus Gittinger <cg@exept.de>
parents: 15787
diff changeset
   678
    "Modified: / 05-07-2012 / 10:51:29 / Jan Vrany <jan.vrany@fit.cvut.cz>"
e55b89f8d241 class: Method
Claus Gittinger <cg@exept.de>
parents: 15787
diff changeset
   679
!
e55b89f8d241 class: Method
Claus Gittinger <cg@exept.de>
parents: 15787
diff changeset
   680
e55b89f8d241 class: Method
Claus Gittinger <cg@exept.de>
parents: 15787
diff changeset
   681
overriddenMethod: aMethod
e55b89f8d241 class: Method
Claus Gittinger <cg@exept.de>
parents: 15787
diff changeset
   682
    <resource: #obsolete>
e55b89f8d241 class: Method
Claus Gittinger <cg@exept.de>
parents: 15787
diff changeset
   683
e55b89f8d241 class: Method
Claus Gittinger <cg@exept.de>
parents: 15787
diff changeset
   684
    self obsoleteMethodWarning: 'Use overwrittenMethod: instead, stupid naming'.
e55b89f8d241 class: Method
Claus Gittinger <cg@exept.de>
parents: 15787
diff changeset
   685
    self overwrittenMethod: aMethod
e55b89f8d241 class: Method
Claus Gittinger <cg@exept.de>
parents: 15787
diff changeset
   686
e55b89f8d241 class: Method
Claus Gittinger <cg@exept.de>
parents: 15787
diff changeset
   687
    "Created: / 17-06-2009 / 19:09:17 / Jan Vrany <vranyj1@fel.cvut.cz>"
e55b89f8d241 class: Method
Claus Gittinger <cg@exept.de>
parents: 15787
diff changeset
   688
    "Modified: / 22-08-2009 / 10:47:42 / Jan Vrany <vranyj1@fel.cvut.cz>"
e55b89f8d241 class: Method
Claus Gittinger <cg@exept.de>
parents: 15787
diff changeset
   689
    "Modified: / 18-11-2011 / 14:48:26 / cg"
e55b89f8d241 class: Method
Claus Gittinger <cg@exept.de>
parents: 15787
diff changeset
   690
    "Modified: / 05-07-2012 / 10:51:44 / Jan Vrany <jan.vrany@fit.cvut.cz>"
e55b89f8d241 class: Method
Claus Gittinger <cg@exept.de>
parents: 15787
diff changeset
   691
!
e55b89f8d241 class: Method
Claus Gittinger <cg@exept.de>
parents: 15787
diff changeset
   692
e55b89f8d241 class: Method
Claus Gittinger <cg@exept.de>
parents: 15787
diff changeset
   693
overwrittenMethod
13422
b43a8a47037c Jan's changes
vrany
parents: 13390
diff changeset
   694
    "Answers overridden method or nil."
20208
79b24601b7d6 #OTHER by mawalch
mawalch
parents: 20035
diff changeset
   695
20035
74774e1ee05d #REFACTORING by stefan
Stefan Vogel <sv@exept.de>
parents: 20032
diff changeset
   696
    Overrides isNil ifTrue:[
74774e1ee05d #REFACTORING by stefan
Stefan Vogel <sv@exept.de>
parents: 20032
diff changeset
   697
        ^ nil
74774e1ee05d #REFACTORING by stefan
Stefan Vogel <sv@exept.de>
parents: 20032
diff changeset
   698
    ].
74774e1ee05d #REFACTORING by stefan
Stefan Vogel <sv@exept.de>
parents: 20032
diff changeset
   699
    ^ Overrides at:self ifAbsent:nil.
13422
b43a8a47037c Jan's changes
vrany
parents: 13390
diff changeset
   700
15952
e55b89f8d241 class: Method
Claus Gittinger <cg@exept.de>
parents: 15787
diff changeset
   701
    "Created: / 05-07-2012 / 10:49:44 / Jan Vrany <jan.vrany@fit.cvut.cz>"
13422
b43a8a47037c Jan's changes
vrany
parents: 13390
diff changeset
   702
!
b43a8a47037c Jan's changes
vrany
parents: 13390
diff changeset
   703
15952
e55b89f8d241 class: Method
Claus Gittinger <cg@exept.de>
parents: 15787
diff changeset
   704
overwrittenMethod: aMethod
13422
b43a8a47037c Jan's changes
vrany
parents: 13390
diff changeset
   705
    "Set overridden method to aMethod"
b43a8a47037c Jan's changes
vrany
parents: 13390
diff changeset
   706
13817
7d1e0e8ea364 changed:10 methods
Claus Gittinger <cg@exept.de>
parents: 13805
diff changeset
   707
    Overrides isNil ifTrue:[Overrides := WeakIdentityDictionary new:10].
7d1e0e8ea364 changed:10 methods
Claus Gittinger <cg@exept.de>
parents: 13805
diff changeset
   708
    aMethod notNil ifTrue:[aMethod makeLocalStringSource].
20035
74774e1ee05d #REFACTORING by stefan
Stefan Vogel <sv@exept.de>
parents: 20032
diff changeset
   709
    Overrides at:self put:aMethod
13422
b43a8a47037c Jan's changes
vrany
parents: 13390
diff changeset
   710
15952
e55b89f8d241 class: Method
Claus Gittinger <cg@exept.de>
parents: 15787
diff changeset
   711
    "Created: / 05-07-2012 / 10:50:00 / Jan Vrany <jan.vrany@fit.cvut.cz>"
13422
b43a8a47037c Jan's changes
vrany
parents: 13390
diff changeset
   712
!
b43a8a47037c Jan's changes
vrany
parents: 13390
diff changeset
   713
1093
1e742016eea0 category rename / added access to RESOURCE and CALLED flags
Claus Gittinger <cg@exept.de>
parents: 1087
diff changeset
   714
package
14573
f89b1f406974 class: Method
Claus Gittinger <cg@exept.de>
parents: 14552
diff changeset
   715
    "return the package-symbol of the method (nil is translated to noProject here)"
1093
1e742016eea0 category rename / added access to RESOURCE and CALLED flags
Claus Gittinger <cg@exept.de>
parents: 1087
diff changeset
   716
5385
7637332d7b38 care for nil package
Claus Gittinger <cg@exept.de>
parents: 5339
diff changeset
   717
    |cls|
7637332d7b38 care for nil package
Claus Gittinger <cg@exept.de>
parents: 5339
diff changeset
   718
7637332d7b38 care for nil package
Claus Gittinger <cg@exept.de>
parents: 5339
diff changeset
   719
    package notNil ifTrue:[ ^ package ].
14573
f89b1f406974 class: Method
Claus Gittinger <cg@exept.de>
parents: 14552
diff changeset
   720
f89b1f406974 class: Method
Claus Gittinger <cg@exept.de>
parents: 14552
diff changeset
   721
    "/ get it from my class
5385
7637332d7b38 care for nil package
Claus Gittinger <cg@exept.de>
parents: 5339
diff changeset
   722
    (cls := self mclass) isNil ifTrue:[
18620
b4e9f25d6ce6 preparations for lined index list in WeakArray
Claus Gittinger <cg@exept.de>
parents: 18462
diff changeset
   723
	^ PackageId noProjectID.
5385
7637332d7b38 care for nil package
Claus Gittinger <cg@exept.de>
parents: 5339
diff changeset
   724
    ].
5724
96c2a5cf4217 category: and package: now send change notifications.
Claus Gittinger <cg@exept.de>
parents: 5721
diff changeset
   725
    "/ set it.
9692
d53de4f90660 allow for and hide nil-packageID (== NoProject)
Claus Gittinger <cg@exept.de>
parents: 9661
diff changeset
   726
    package := cls getPackage.
d53de4f90660 allow for and hide nil-packageID (== NoProject)
Claus Gittinger <cg@exept.de>
parents: 9661
diff changeset
   727
    package isNil ifTrue:[
18620
b4e9f25d6ce6 preparations for lined index list in WeakArray
Claus Gittinger <cg@exept.de>
parents: 18462
diff changeset
   728
	^ PackageId noProjectID.
9692
d53de4f90660 allow for and hide nil-packageID (== NoProject)
Claus Gittinger <cg@exept.de>
parents: 9661
diff changeset
   729
    ].
d53de4f90660 allow for and hide nil-packageID (== NoProject)
Claus Gittinger <cg@exept.de>
parents: 9661
diff changeset
   730
    ^ package
3950
f9c4485a91d1 avoid nil package return
Claus Gittinger <cg@exept.de>
parents: 3934
diff changeset
   731
10207
b5ca553d15ad localSourceFirst for extensions.
Claus Gittinger <cg@exept.de>
parents: 10201
diff changeset
   732
    "Modified: / 28-11-2006 / 12:12:43 / cg"
1093
1e742016eea0 category rename / added access to RESOURCE and CALLED flags
Claus Gittinger <cg@exept.de>
parents: 1087
diff changeset
   733
!
1e742016eea0 category rename / added access to RESOURCE and CALLED flags
Claus Gittinger <cg@exept.de>
parents: 1087
diff changeset
   734
1e742016eea0 category rename / added access to RESOURCE and CALLED flags
Claus Gittinger <cg@exept.de>
parents: 1087
diff changeset
   735
package:aSymbol
1e742016eea0 category rename / added access to RESOURCE and CALLED flags
Claus Gittinger <cg@exept.de>
parents: 1087
diff changeset
   736
    "set the package-symbol"
1e742016eea0 category rename / added access to RESOURCE and CALLED flags
Claus Gittinger <cg@exept.de>
parents: 1087
diff changeset
   737
9692
d53de4f90660 allow for and hide nil-packageID (== NoProject)
Claus Gittinger <cg@exept.de>
parents: 9661
diff changeset
   738
    |cls oldPackage newPackage|
d53de4f90660 allow for and hide nil-packageID (== NoProject)
Claus Gittinger <cg@exept.de>
parents: 9661
diff changeset
   739
19025
f35582ce8389 #DOCUMENTATION
Claus Gittinger <cg@exept.de>
parents: 18753
diff changeset
   740
    newPackage := aSymbol.
12216
692af7a76600 Project noProjectId -> PackageId noProjectId
Claus Gittinger <cg@exept.de>
parents: 12193
diff changeset
   741
    aSymbol == PackageId noProjectID ifTrue:[
19025
f35582ce8389 #DOCUMENTATION
Claus Gittinger <cg@exept.de>
parents: 18753
diff changeset
   742
        Transcript showCR:'warning: unassigning method from any package'.
f35582ce8389 #DOCUMENTATION
Claus Gittinger <cg@exept.de>
parents: 18753
diff changeset
   743
        "/ newPackage := nil
9692
d53de4f90660 allow for and hide nil-packageID (== NoProject)
Claus Gittinger <cg@exept.de>
parents: 9661
diff changeset
   744
    ].
d53de4f90660 allow for and hide nil-packageID (== NoProject)
Claus Gittinger <cg@exept.de>
parents: 9661
diff changeset
   745
9713
fc8ef192492f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9702
diff changeset
   746
    package ~~ newPackage ifTrue:[
19025
f35582ce8389 #DOCUMENTATION
Claus Gittinger <cg@exept.de>
parents: 18753
diff changeset
   747
        oldPackage := package.
f35582ce8389 #DOCUMENTATION
Claus Gittinger <cg@exept.de>
parents: 18753
diff changeset
   748
        "/ this is required, because otherwise I would no longer be able to
f35582ce8389 #DOCUMENTATION
Claus Gittinger <cg@exept.de>
parents: 18753
diff changeset
   749
        "/ reconstruct my sourcecode (as the connection to the source-file is lost).
f35582ce8389 #DOCUMENTATION
Claus Gittinger <cg@exept.de>
parents: 18753
diff changeset
   750
        self makeLocalStringSource.
f35582ce8389 #DOCUMENTATION
Claus Gittinger <cg@exept.de>
parents: 18753
diff changeset
   751
        package := newPackage.
f35582ce8389 #DOCUMENTATION
Claus Gittinger <cg@exept.de>
parents: 18753
diff changeset
   752
f35582ce8389 #DOCUMENTATION
Claus Gittinger <cg@exept.de>
parents: 18753
diff changeset
   753
        cls := self mclass.
f35582ce8389 #DOCUMENTATION
Claus Gittinger <cg@exept.de>
parents: 18753
diff changeset
   754
        "JV@2011-01-27: BUG FIX: method may be wrapped (breakpoint on it).
f35582ce8389 #DOCUMENTATION
Claus Gittinger <cg@exept.de>
parents: 18753
diff changeset
   755
         Search for the wrapper, if none is found, return immediately
f35582ce8389 #DOCUMENTATION
Claus Gittinger <cg@exept.de>
parents: 18753
diff changeset
   756
         (avoids DNU)"
f35582ce8389 #DOCUMENTATION
Claus Gittinger <cg@exept.de>
parents: 18753
diff changeset
   757
        cls isNil ifTrue:[
f35582ce8389 #DOCUMENTATION
Claus Gittinger <cg@exept.de>
parents: 18753
diff changeset
   758
            | wrapper |
f35582ce8389 #DOCUMENTATION
Claus Gittinger <cg@exept.de>
parents: 18753
diff changeset
   759
f35582ce8389 #DOCUMENTATION
Claus Gittinger <cg@exept.de>
parents: 18753
diff changeset
   760
            wrapper := self wrapper.
f35582ce8389 #DOCUMENTATION
Claus Gittinger <cg@exept.de>
parents: 18753
diff changeset
   761
            wrapper isNil ifTrue:[ ^ self ].
f35582ce8389 #DOCUMENTATION
Claus Gittinger <cg@exept.de>
parents: 18753
diff changeset
   762
            cls := wrapper mclass.
f35582ce8389 #DOCUMENTATION
Claus Gittinger <cg@exept.de>
parents: 18753
diff changeset
   763
            cls isNil ifTrue:[ ^ self ].
f35582ce8389 #DOCUMENTATION
Claus Gittinger <cg@exept.de>
parents: 18753
diff changeset
   764
        ].
f35582ce8389 #DOCUMENTATION
Claus Gittinger <cg@exept.de>
parents: 18753
diff changeset
   765
f35582ce8389 #DOCUMENTATION
Claus Gittinger <cg@exept.de>
parents: 18753
diff changeset
   766
        self changed:#package.                                              "/ will vanish
f35582ce8389 #DOCUMENTATION
Claus Gittinger <cg@exept.de>
parents: 18753
diff changeset
   767
        cls changed:#methodPackage with:self selector.                      "/ will vanish
f35582ce8389 #DOCUMENTATION
Claus Gittinger <cg@exept.de>
parents: 18753
diff changeset
   768
f35582ce8389 #DOCUMENTATION
Claus Gittinger <cg@exept.de>
parents: 18753
diff changeset
   769
        Smalltalk changed:#projectOrganization with:(Array with:cls with:self with:oldPackage).
f35582ce8389 #DOCUMENTATION
Claus Gittinger <cg@exept.de>
parents: 18753
diff changeset
   770
        cls addChangeRecordForMethodPackage:self package:newPackage.
5724
96c2a5cf4217 category: and package: now send change notifications.
Claus Gittinger <cg@exept.de>
parents: 5721
diff changeset
   771
    ]
10196
f72831ddec29 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10156
diff changeset
   772
f72831ddec29 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10156
diff changeset
   773
    "Modified: / 23-11-2006 / 17:01:02 / cg"
15952
e55b89f8d241 class: Method
Claus Gittinger <cg@exept.de>
parents: 15787
diff changeset
   774
    "Modified: / 27-01-2012 / 17:15:24 / Jan Vrany <jan.vrany@fit.cvut.cz>"
e55b89f8d241 class: Method
Claus Gittinger <cg@exept.de>
parents: 15787
diff changeset
   775
    "Modified (comment): / 27-01-2012 / 21:22:40 / Jan Vrany <jan.vrany@fit.cvut.cz>"
1093
1e742016eea0 category rename / added access to RESOURCE and CALLED flags
Claus Gittinger <cg@exept.de>
parents: 1087
diff changeset
   776
!
1e742016eea0 category rename / added access to RESOURCE and CALLED flags
Claus Gittinger <cg@exept.de>
parents: 1087
diff changeset
   777
5721
5f97733ff519 methods now send change-notifications when the category changes
Claus Gittinger <cg@exept.de>
parents: 5704
diff changeset
   778
setCategory:aStringOrSymbol
22372
72db331204d4 #DOCUMENTATION by cg
Claus Gittinger <cg@exept.de>
parents: 22188
diff changeset
   779
    "set the method's category (without change notification)"
5721
5f97733ff519 methods now send change-notifications when the category changes
Claus Gittinger <cg@exept.de>
parents: 5704
diff changeset
   780
5f97733ff519 methods now send change-notifications when the category changes
Claus Gittinger <cg@exept.de>
parents: 5704
diff changeset
   781
    aStringOrSymbol notNil ifTrue:[
22372
72db331204d4 #DOCUMENTATION by cg
Claus Gittinger <cg@exept.de>
parents: 22188
diff changeset
   782
        category := aStringOrSymbol asSymbol
5721
5f97733ff519 methods now send change-notifications when the category changes
Claus Gittinger <cg@exept.de>
parents: 5704
diff changeset
   783
    ]
5f97733ff519 methods now send change-notifications when the category changes
Claus Gittinger <cg@exept.de>
parents: 5704
diff changeset
   784
22372
72db331204d4 #DOCUMENTATION by cg
Claus Gittinger <cg@exept.de>
parents: 22188
diff changeset
   785
    "Modified: / 13-11-1998 / 23:55:05 / cg"
72db331204d4 #DOCUMENTATION by cg
Claus Gittinger <cg@exept.de>
parents: 22188
diff changeset
   786
    "Modified (comment): / 21-11-2017 / 13:05:26 / cg"
5721
5f97733ff519 methods now send change-notifications when the category changes
Claus Gittinger <cg@exept.de>
parents: 5704
diff changeset
   787
!
5f97733ff519 methods now send change-notifications when the category changes
Claus Gittinger <cg@exept.de>
parents: 5704
diff changeset
   788
5398
b15f5eca2060 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5387
diff changeset
   789
setPackage:aSymbol
9702
468675f92260 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9692
diff changeset
   790
    "set the package-symbol (low level - use package:)"
5398
b15f5eca2060 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5387
diff changeset
   791
b15f5eca2060 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5387
diff changeset
   792
    package := aSymbol
b15f5eca2060 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5387
diff changeset
   793
!
b15f5eca2060 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5387
diff changeset
   794
1093
1e742016eea0 category rename / added access to RESOURCE and CALLED flags
Claus Gittinger <cg@exept.de>
parents: 1087
diff changeset
   795
source
1e742016eea0 category rename / added access to RESOURCE and CALLED flags
Claus Gittinger <cg@exept.de>
parents: 1087
diff changeset
   796
    "return the sourcestring for the receiver"
1e742016eea0 category rename / added access to RESOURCE and CALLED flags
Claus Gittinger <cg@exept.de>
parents: 1087
diff changeset
   797
12598
a6862e9bcb8e comment/format in: #source
Claus Gittinger <cg@exept.de>
parents: 12569
diff changeset
   798
    |sourceStream chunk|
1093
1e742016eea0 category rename / added access to RESOURCE and CALLED flags
Claus Gittinger <cg@exept.de>
parents: 1087
diff changeset
   799
1e742016eea0 category rename / added access to RESOURCE and CALLED flags
Claus Gittinger <cg@exept.de>
parents: 1087
diff changeset
   800
    "
1e742016eea0 category rename / added access to RESOURCE and CALLED flags
Claus Gittinger <cg@exept.de>
parents: 1087
diff changeset
   801
     if sourcePosition is nonNil, its the fileName and
2176
1a24b0cef25a when compressing sources, make certain to avoid later
Claus Gittinger <cg@exept.de>
parents: 2171
diff changeset
   802
     abs(sourcePosition) is the offset.
1093
1e742016eea0 category rename / added access to RESOURCE and CALLED flags
Claus Gittinger <cg@exept.de>
parents: 1087
diff changeset
   803
     Otherwise, source is the real source
1e742016eea0 category rename / added access to RESOURCE and CALLED flags
Claus Gittinger <cg@exept.de>
parents: 1087
diff changeset
   804
    "
1e742016eea0 category rename / added access to RESOURCE and CALLED flags
Claus Gittinger <cg@exept.de>
parents: 1087
diff changeset
   805
    sourcePosition isNil ifTrue:[^ source].
13381
e16cafbd22bd comment/format in: #sourceStreamUsingCache:
Claus Gittinger <cg@exept.de>
parents: 13189
diff changeset
   806
    source isNil ifTrue:[^ nil].
e16cafbd22bd comment/format in: #sourceStreamUsingCache:
Claus Gittinger <cg@exept.de>
parents: 13189
diff changeset
   807
20035
74774e1ee05d #REFACTORING by stefan
Stefan Vogel <sv@exept.de>
parents: 20032
diff changeset
   808
    LastMethodSources notNil ifTrue:[
74774e1ee05d #REFACTORING by stefan
Stefan Vogel <sv@exept.de>
parents: 20032
diff changeset
   809
        self class lastMethodSourcesLock critical:[
74774e1ee05d #REFACTORING by stefan
Stefan Vogel <sv@exept.de>
parents: 20032
diff changeset
   810
            LastMethodSources notNil ifTrue:[
74774e1ee05d #REFACTORING by stefan
Stefan Vogel <sv@exept.de>
parents: 20032
diff changeset
   811
                chunk := LastMethodSources at:self ifAbsent:nil.
74774e1ee05d #REFACTORING by stefan
Stefan Vogel <sv@exept.de>
parents: 20032
diff changeset
   812
            ].
74774e1ee05d #REFACTORING by stefan
Stefan Vogel <sv@exept.de>
parents: 20032
diff changeset
   813
        ].
74774e1ee05d #REFACTORING by stefan
Stefan Vogel <sv@exept.de>
parents: 20032
diff changeset
   814
        chunk notNil ifTrue:[
74774e1ee05d #REFACTORING by stefan
Stefan Vogel <sv@exept.de>
parents: 20032
diff changeset
   815
            ^ chunk
74774e1ee05d #REFACTORING by stefan
Stefan Vogel <sv@exept.de>
parents: 20032
diff changeset
   816
        ].
13381
e16cafbd22bd comment/format in: #sourceStreamUsingCache:
Claus Gittinger <cg@exept.de>
parents: 13189
diff changeset
   817
    ].
e16cafbd22bd comment/format in: #sourceStreamUsingCache:
Claus Gittinger <cg@exept.de>
parents: 13189
diff changeset
   818
13463
7c98583d98c8 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 13422
diff changeset
   819
    LastFileLock
20035
74774e1ee05d #REFACTORING by stefan
Stefan Vogel <sv@exept.de>
parents: 20032
diff changeset
   820
        critical:[
74774e1ee05d #REFACTORING by stefan
Stefan Vogel <sv@exept.de>
parents: 20032
diff changeset
   821
            "have to protect sourceStream from being closed as a side effect
74774e1ee05d #REFACTORING by stefan
Stefan Vogel <sv@exept.de>
parents: 20032
diff changeset
   822
             of some other process fetching some the source from a different source file"
74774e1ee05d #REFACTORING by stefan
Stefan Vogel <sv@exept.de>
parents: 20032
diff changeset
   823
74774e1ee05d #REFACTORING by stefan
Stefan Vogel <sv@exept.de>
parents: 20032
diff changeset
   824
            sourceStream := self sourceStreamUsingCache:true.
74774e1ee05d #REFACTORING by stefan
Stefan Vogel <sv@exept.de>
parents: 20032
diff changeset
   825
            sourceStream notNil ifTrue:[
74774e1ee05d #REFACTORING by stefan
Stefan Vogel <sv@exept.de>
parents: 20032
diff changeset
   826
                [
74774e1ee05d #REFACTORING by stefan
Stefan Vogel <sv@exept.de>
parents: 20032
diff changeset
   827
                    chunk := self sourceChunkFromStream:sourceStream.
74774e1ee05d #REFACTORING by stefan
Stefan Vogel <sv@exept.de>
parents: 20032
diff changeset
   828
                ] on:DecodingError do:[:ex|
74774e1ee05d #REFACTORING by stefan
Stefan Vogel <sv@exept.de>
parents: 20032
diff changeset
   829
                    "CharacterEncoder>>#guessEncoding is not fail safe - retry with plain unencoded data"
74774e1ee05d #REFACTORING by stefan
Stefan Vogel <sv@exept.de>
parents: 20032
diff changeset
   830
74774e1ee05d #REFACTORING by stefan
Stefan Vogel <sv@exept.de>
parents: 20032
diff changeset
   831
                    Logger info:'DecodingError ignored when reading %1 (%2)' with:self whoString with:ex description.
74774e1ee05d #REFACTORING by stefan
Stefan Vogel <sv@exept.de>
parents: 20032
diff changeset
   832
                    sourceStream := self rawSourceStreamUsingCache:true.
74774e1ee05d #REFACTORING by stefan
Stefan Vogel <sv@exept.de>
parents: 20032
diff changeset
   833
                    ex restart.
74774e1ee05d #REFACTORING by stefan
Stefan Vogel <sv@exept.de>
parents: 20032
diff changeset
   834
                ].
74774e1ee05d #REFACTORING by stefan
Stefan Vogel <sv@exept.de>
parents: 20032
diff changeset
   835
            ].
74774e1ee05d #REFACTORING by stefan
Stefan Vogel <sv@exept.de>
parents: 20032
diff changeset
   836
        ]
74774e1ee05d #REFACTORING by stefan
Stefan Vogel <sv@exept.de>
parents: 20032
diff changeset
   837
        timeoutMs:100
74774e1ee05d #REFACTORING by stefan
Stefan Vogel <sv@exept.de>
parents: 20032
diff changeset
   838
        ifBlocking:[
74774e1ee05d #REFACTORING by stefan
Stefan Vogel <sv@exept.de>
parents: 20032
diff changeset
   839
            "take care if LastFileLock is not available - maybe we are
74774e1ee05d #REFACTORING by stefan
Stefan Vogel <sv@exept.de>
parents: 20032
diff changeset
   840
             called by a debugger while someone holds the lock.
74774e1ee05d #REFACTORING by stefan
Stefan Vogel <sv@exept.de>
parents: 20032
diff changeset
   841
             Use uncached source streams"
74774e1ee05d #REFACTORING by stefan
Stefan Vogel <sv@exept.de>
parents: 20032
diff changeset
   842
            sourceStream := self sourceStreamUsingCache:false.
74774e1ee05d #REFACTORING by stefan
Stefan Vogel <sv@exept.de>
parents: 20032
diff changeset
   843
            sourceStream notNil ifTrue:[
74774e1ee05d #REFACTORING by stefan
Stefan Vogel <sv@exept.de>
parents: 20032
diff changeset
   844
                [
74774e1ee05d #REFACTORING by stefan
Stefan Vogel <sv@exept.de>
parents: 20032
diff changeset
   845
                    chunk := self sourceChunkFromStream:sourceStream.
74774e1ee05d #REFACTORING by stefan
Stefan Vogel <sv@exept.de>
parents: 20032
diff changeset
   846
                    sourceStream close.
74774e1ee05d #REFACTORING by stefan
Stefan Vogel <sv@exept.de>
parents: 20032
diff changeset
   847
                ] on:DecodingError do:[:ex|
74774e1ee05d #REFACTORING by stefan
Stefan Vogel <sv@exept.de>
parents: 20032
diff changeset
   848
                    "CharacterEncoder>>#guessEncoding is not fail safe - retry with plain unencoded data"
74774e1ee05d #REFACTORING by stefan
Stefan Vogel <sv@exept.de>
parents: 20032
diff changeset
   849
                    Logger info:'DecodingError ignored when reading %1 (%2)' with:self whoString with:ex description.
74774e1ee05d #REFACTORING by stefan
Stefan Vogel <sv@exept.de>
parents: 20032
diff changeset
   850
                    sourceStream close.
74774e1ee05d #REFACTORING by stefan
Stefan Vogel <sv@exept.de>
parents: 20032
diff changeset
   851
                    sourceStream := self rawSourceStreamUsingCache:false.
74774e1ee05d #REFACTORING by stefan
Stefan Vogel <sv@exept.de>
parents: 20032
diff changeset
   852
                    ex restart.
74774e1ee05d #REFACTORING by stefan
Stefan Vogel <sv@exept.de>
parents: 20032
diff changeset
   853
                ].
74774e1ee05d #REFACTORING by stefan
Stefan Vogel <sv@exept.de>
parents: 20032
diff changeset
   854
            ].
74774e1ee05d #REFACTORING by stefan
Stefan Vogel <sv@exept.de>
parents: 20032
diff changeset
   855
        ].
2979
6bb06c5e49d8 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2868
diff changeset
   856
10673
05229646ecd7 #source - handle DecodingError when fetching the method's source
Stefan Vogel <sv@exept.de>
parents: 10608
diff changeset
   857
    "Cache the source of recently used methods"
10608
82b1346f3e8d Use similar code when accessing method and class source code
Stefan Vogel <sv@exept.de>
parents: 10482
diff changeset
   858
    chunk notNil ifTrue:[
20035
74774e1ee05d #REFACTORING by stefan
Stefan Vogel <sv@exept.de>
parents: 20032
diff changeset
   859
        "JV@2013-08-19: Don't consult UserPreferences if the system is initializing. This may
74774e1ee05d #REFACTORING by stefan
Stefan Vogel <sv@exept.de>
parents: 20032
diff changeset
   860
         lead in funny side-effect as #initializeDefaultPreferences is called which tries to
74774e1ee05d #REFACTORING by stefan
Stefan Vogel <sv@exept.de>
parents: 20032
diff changeset
   861
         initialize some colors. But Color itself is likely not yet initialized, so DNU is
74774e1ee05d #REFACTORING by stefan
Stefan Vogel <sv@exept.de>
parents: 20032
diff changeset
   862
         thrown.
74774e1ee05d #REFACTORING by stefan
Stefan Vogel <sv@exept.de>
parents: 20032
diff changeset
   863
         CG: also care for standalone non-GUI progs, which have no userPreferences class"
74774e1ee05d #REFACTORING by stefan
Stefan Vogel <sv@exept.de>
parents: 20032
diff changeset
   864
        (Smalltalk isInitialized
74774e1ee05d #REFACTORING by stefan
Stefan Vogel <sv@exept.de>
parents: 20032
diff changeset
   865
        and:[UserPreferences notNil
74774e1ee05d #REFACTORING by stefan
Stefan Vogel <sv@exept.de>
parents: 20032
diff changeset
   866
        and:[UserPreferences current keepMethodSourceCode]]) ifTrue:[
74774e1ee05d #REFACTORING by stefan
Stefan Vogel <sv@exept.de>
parents: 20032
diff changeset
   867
            source := chunk.
74774e1ee05d #REFACTORING by stefan
Stefan Vogel <sv@exept.de>
parents: 20032
diff changeset
   868
            sourcePosition := nil.
74774e1ee05d #REFACTORING by stefan
Stefan Vogel <sv@exept.de>
parents: 20032
diff changeset
   869
            ^ source.
74774e1ee05d #REFACTORING by stefan
Stefan Vogel <sv@exept.de>
parents: 20032
diff changeset
   870
        ].
74774e1ee05d #REFACTORING by stefan
Stefan Vogel <sv@exept.de>
parents: 20032
diff changeset
   871
74774e1ee05d #REFACTORING by stefan
Stefan Vogel <sv@exept.de>
parents: 20032
diff changeset
   872
        CacheDictionary notNil ifTrue:[
74774e1ee05d #REFACTORING by stefan
Stefan Vogel <sv@exept.de>
parents: 20032
diff changeset
   873
            self class lastMethodSourcesLock critical:[
74774e1ee05d #REFACTORING by stefan
Stefan Vogel <sv@exept.de>
parents: 20032
diff changeset
   874
                LastMethodSources isNil ifTrue:[
74774e1ee05d #REFACTORING by stefan
Stefan Vogel <sv@exept.de>
parents: 20032
diff changeset
   875
                    LastMethodSources := CacheDictionary new:50.
74774e1ee05d #REFACTORING by stefan
Stefan Vogel <sv@exept.de>
parents: 20032
diff changeset
   876
                ].
74774e1ee05d #REFACTORING by stefan
Stefan Vogel <sv@exept.de>
parents: 20032
diff changeset
   877
                LastMethodSources at:self put:chunk.
74774e1ee05d #REFACTORING by stefan
Stefan Vogel <sv@exept.de>
parents: 20032
diff changeset
   878
            ]
74774e1ee05d #REFACTORING by stefan
Stefan Vogel <sv@exept.de>
parents: 20032
diff changeset
   879
        ].
2979
6bb06c5e49d8 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2868
diff changeset
   880
    ].
6bb06c5e49d8 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2868
diff changeset
   881
10608
82b1346f3e8d Use similar code when accessing method and class source code
Stefan Vogel <sv@exept.de>
parents: 10482
diff changeset
   882
    ^ chunk
1093
1e742016eea0 category rename / added access to RESOURCE and CALLED flags
Claus Gittinger <cg@exept.de>
parents: 1087
diff changeset
   883
10201
f90568a94903 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10196
diff changeset
   884
    "Modified: / 07-01-1997 / 16:20:09 / stefan"
1093
1e742016eea0 category rename / added access to RESOURCE and CALLED flags
Claus Gittinger <cg@exept.de>
parents: 1087
diff changeset
   885
!
1e742016eea0 category rename / added access to RESOURCE and CALLED flags
Claus Gittinger <cg@exept.de>
parents: 1087
diff changeset
   886
1e742016eea0 category rename / added access to RESOURCE and CALLED flags
Claus Gittinger <cg@exept.de>
parents: 1087
diff changeset
   887
source:aString
22372
72db331204d4 #DOCUMENTATION by cg
Claus Gittinger <cg@exept.de>
parents: 22188
diff changeset
   888
    "set the method's sourcestring"
1093
1e742016eea0 category rename / added access to RESOURCE and CALLED flags
Claus Gittinger <cg@exept.de>
parents: 1087
diff changeset
   889
15346
c8f751f80e5b class: Method
Claus Gittinger <cg@exept.de>
parents: 15245
diff changeset
   890
    self assert:(aString isText not).   "/ will break monticello-binary-data-writing
1093
1e742016eea0 category rename / added access to RESOURCE and CALLED flags
Claus Gittinger <cg@exept.de>
parents: 1087
diff changeset
   891
    source := aString.
1e742016eea0 category rename / added access to RESOURCE and CALLED flags
Claus Gittinger <cg@exept.de>
parents: 1087
diff changeset
   892
    sourcePosition := nil
22372
72db331204d4 #DOCUMENTATION by cg
Claus Gittinger <cg@exept.de>
parents: 22188
diff changeset
   893
72db331204d4 #DOCUMENTATION by cg
Claus Gittinger <cg@exept.de>
parents: 22188
diff changeset
   894
    "Modified (comment): / 21-11-2017 / 13:05:59 / cg"
1093
1e742016eea0 category rename / added access to RESOURCE and CALLED flags
Claus Gittinger <cg@exept.de>
parents: 1087
diff changeset
   895
!
1e742016eea0 category rename / added access to RESOURCE and CALLED flags
Claus Gittinger <cg@exept.de>
parents: 1087
diff changeset
   896
1e742016eea0 category rename / added access to RESOURCE and CALLED flags
Claus Gittinger <cg@exept.de>
parents: 1087
diff changeset
   897
sourceFilename
1e742016eea0 category rename / added access to RESOURCE and CALLED flags
Claus Gittinger <cg@exept.de>
parents: 1087
diff changeset
   898
    "return the sourcefilename if source is extern; nil otherwise"
1e742016eea0 category rename / added access to RESOURCE and CALLED flags
Claus Gittinger <cg@exept.de>
parents: 1087
diff changeset
   899
1e742016eea0 category rename / added access to RESOURCE and CALLED flags
Claus Gittinger <cg@exept.de>
parents: 1087
diff changeset
   900
    sourcePosition notNil ifTrue:[^ source].
1e742016eea0 category rename / added access to RESOURCE and CALLED flags
Claus Gittinger <cg@exept.de>
parents: 1087
diff changeset
   901
    ^ nil
1e742016eea0 category rename / added access to RESOURCE and CALLED flags
Claus Gittinger <cg@exept.de>
parents: 1087
diff changeset
   902
!
1e742016eea0 category rename / added access to RESOURCE and CALLED flags
Claus Gittinger <cg@exept.de>
parents: 1087
diff changeset
   903
1e742016eea0 category rename / added access to RESOURCE and CALLED flags
Claus Gittinger <cg@exept.de>
parents: 1087
diff changeset
   904
sourceFilename:aFileName position:aNumber
22372
72db331204d4 #DOCUMENTATION by cg
Claus Gittinger <cg@exept.de>
parents: 22188
diff changeset
   905
    "set the method's sourcefile/position"
1093
1e742016eea0 category rename / added access to RESOURCE and CALLED flags
Claus Gittinger <cg@exept.de>
parents: 1087
diff changeset
   906
15346
c8f751f80e5b class: Method
Claus Gittinger <cg@exept.de>
parents: 15245
diff changeset
   907
    self assert:(aFileName isText not).   "/ will break monticello-binary-data-writing
1093
1e742016eea0 category rename / added access to RESOURCE and CALLED flags
Claus Gittinger <cg@exept.de>
parents: 1087
diff changeset
   908
    source := aFileName.
1e742016eea0 category rename / added access to RESOURCE and CALLED flags
Claus Gittinger <cg@exept.de>
parents: 1087
diff changeset
   909
    sourcePosition := aNumber
22372
72db331204d4 #DOCUMENTATION by cg
Claus Gittinger <cg@exept.de>
parents: 22188
diff changeset
   910
72db331204d4 #DOCUMENTATION by cg
Claus Gittinger <cg@exept.de>
parents: 22188
diff changeset
   911
    "Modified (comment): / 21-11-2017 / 13:06:03 / cg"
1093
1e742016eea0 category rename / added access to RESOURCE and CALLED flags
Claus Gittinger <cg@exept.de>
parents: 1087
diff changeset
   912
!
1e742016eea0 category rename / added access to RESOURCE and CALLED flags
Claus Gittinger <cg@exept.de>
parents: 1087
diff changeset
   913
2812
660a3a2a0ef3 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 2805
diff changeset
   914
sourceLineNumber
660a3a2a0ef3 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 2805
diff changeset
   915
    "return the lineNumber of my source within the returned
660a3a2a0ef3 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 2805
diff changeset
   916
     source sourcestring.
660a3a2a0ef3 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 2805
diff changeset
   917
     For ST methods, the returned sourceString is always the
660a3a2a0ef3 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 2805
diff changeset
   918
     methods pure source; therefore, the lineNumber is always 1."
660a3a2a0ef3 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 2805
diff changeset
   919
660a3a2a0ef3 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 2805
diff changeset
   920
    ^ 1
660a3a2a0ef3 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 2805
diff changeset
   921
660a3a2a0ef3 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 2805
diff changeset
   922
    "Created: 30.7.1997 / 15:42:01 / cg"
660a3a2a0ef3 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 2805
diff changeset
   923
!
660a3a2a0ef3 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 2805
diff changeset
   924
1093
1e742016eea0 category rename / added access to RESOURCE and CALLED flags
Claus Gittinger <cg@exept.de>
parents: 1087
diff changeset
   925
sourcePosition
1e742016eea0 category rename / added access to RESOURCE and CALLED flags
Claus Gittinger <cg@exept.de>
parents: 1087
diff changeset
   926
    "return the sourceposition if source is extern; nil otherwise"
1e742016eea0 category rename / added access to RESOURCE and CALLED flags
Claus Gittinger <cg@exept.de>
parents: 1087
diff changeset
   927
2176
1a24b0cef25a when compressing sources, make certain to avoid later
Claus Gittinger <cg@exept.de>
parents: 2171
diff changeset
   928
    sourcePosition isNil ifTrue:[^ sourcePosition].
1a24b0cef25a when compressing sources, make certain to avoid later
Claus Gittinger <cg@exept.de>
parents: 2171
diff changeset
   929
    ^ sourcePosition abs
1a24b0cef25a when compressing sources, make certain to avoid later
Claus Gittinger <cg@exept.de>
parents: 2171
diff changeset
   930
1a24b0cef25a when compressing sources, make certain to avoid later
Claus Gittinger <cg@exept.de>
parents: 2171
diff changeset
   931
    "Modified: 16.1.1997 / 01:28:25 / cg"
1093
1e742016eea0 category rename / added access to RESOURCE and CALLED flags
Claus Gittinger <cg@exept.de>
parents: 1087
diff changeset
   932
! !
1e742016eea0 category rename / added access to RESOURCE and CALLED flags
Claus Gittinger <cg@exept.de>
parents: 1087
diff changeset
   933
14508
859dca6352f8 class: Method
Claus Gittinger <cg@exept.de>
parents: 14505
diff changeset
   934
!Method methodsFor:'accessing-annotations'!
859dca6352f8 class: Method
Claus Gittinger <cg@exept.de>
parents: 14505
diff changeset
   935
859dca6352f8 class: Method
Claus Gittinger <cg@exept.de>
parents: 14505
diff changeset
   936
annotateWith: annotation
16221
00b413ddccd5 class: Method
Claus Gittinger <cg@exept.de>
parents: 16220
diff changeset
   937
    "add a (hidden) annotation.
00b413ddccd5 class: Method
Claus Gittinger <cg@exept.de>
parents: 16220
diff changeset
   938
     This is only present in the image, not in the method's source code"
00b413ddccd5 class: Method
Claus Gittinger <cg@exept.de>
parents: 16220
diff changeset
   939
14508
859dca6352f8 class: Method
Claus Gittinger <cg@exept.de>
parents: 14505
diff changeset
   940
    | index |
859dca6352f8 class: Method
Claus Gittinger <cg@exept.de>
parents: 14505
diff changeset
   941
859dca6352f8 class: Method
Claus Gittinger <cg@exept.de>
parents: 14505
diff changeset
   942
    index := self annotationIndexOf: annotation key.
859dca6352f8 class: Method
Claus Gittinger <cg@exept.de>
parents: 14505
diff changeset
   943
    index isNil ifTrue:[
18620
b4e9f25d6ce6 preparations for lined index list in WeakArray
Claus Gittinger <cg@exept.de>
parents: 18462
diff changeset
   944
	annotations := annotations isNil
b4e9f25d6ce6 preparations for lined index list in WeakArray
Claus Gittinger <cg@exept.de>
parents: 18462
diff changeset
   945
			    ifTrue:[Array with: annotation]
b4e9f25d6ce6 preparations for lined index list in WeakArray
Claus Gittinger <cg@exept.de>
parents: 18462
diff changeset
   946
			    ifFalse:[annotations copyWith:annotation]
14508
859dca6352f8 class: Method
Claus Gittinger <cg@exept.de>
parents: 14505
diff changeset
   947
    ] ifFalse:[
18620
b4e9f25d6ce6 preparations for lined index list in WeakArray
Claus Gittinger <cg@exept.de>
parents: 18462
diff changeset
   948
	annotations at: index put: annotation
14508
859dca6352f8 class: Method
Claus Gittinger <cg@exept.de>
parents: 14505
diff changeset
   949
    ].
859dca6352f8 class: Method
Claus Gittinger <cg@exept.de>
parents: 14505
diff changeset
   950
"/    annotation annotatesMethod: self.
859dca6352f8 class: Method
Claus Gittinger <cg@exept.de>
parents: 14505
diff changeset
   951
859dca6352f8 class: Method
Claus Gittinger <cg@exept.de>
parents: 14505
diff changeset
   952
    "
18620
b4e9f25d6ce6 preparations for lined index list in WeakArray
Claus Gittinger <cg@exept.de>
parents: 18462
diff changeset
   953
	(Object >> #yourself) annotateWith: (Annotation namespace: 'Fictious').
b4e9f25d6ce6 preparations for lined index list in WeakArray
Claus Gittinger <cg@exept.de>
parents: 18462
diff changeset
   954
	(Object >> #yourself) annotations.
b4e9f25d6ce6 preparations for lined index list in WeakArray
Claus Gittinger <cg@exept.de>
parents: 18462
diff changeset
   955
	(Object >> #yourself) annotationAt: #namespace:
14508
859dca6352f8 class: Method
Claus Gittinger <cg@exept.de>
parents: 14505
diff changeset
   956
    "
859dca6352f8 class: Method
Claus Gittinger <cg@exept.de>
parents: 14505
diff changeset
   957
859dca6352f8 class: Method
Claus Gittinger <cg@exept.de>
parents: 14505
diff changeset
   958
    "Created: / 19-05-2010 / 16:20:36 / Jan Vrany <jan.vrany@fit.cvut.cz>"
859dca6352f8 class: Method
Claus Gittinger <cg@exept.de>
parents: 14505
diff changeset
   959
    "Modified: / 20-05-2010 / 11:22:55 / Jan Vrany <jan.vrany@fit.cvut.cz>"
859dca6352f8 class: Method
Claus Gittinger <cg@exept.de>
parents: 14505
diff changeset
   960
    "Modified (format): / 26-07-2012 / 15:47:51 / cg"
859dca6352f8 class: Method
Claus Gittinger <cg@exept.de>
parents: 14505
diff changeset
   961
!
859dca6352f8 class: Method
Claus Gittinger <cg@exept.de>
parents: 14505
diff changeset
   962
859dca6352f8 class: Method
Claus Gittinger <cg@exept.de>
parents: 14505
diff changeset
   963
annotationAt: key
859dca6352f8 class: Method
Claus Gittinger <cg@exept.de>
parents: 14505
diff changeset
   964
    | index |
859dca6352f8 class: Method
Claus Gittinger <cg@exept.de>
parents: 14505
diff changeset
   965
859dca6352f8 class: Method
Claus Gittinger <cg@exept.de>
parents: 14505
diff changeset
   966
    index := self annotationIndexOf: key.
859dca6352f8 class: Method
Claus Gittinger <cg@exept.de>
parents: 14505
diff changeset
   967
    index isNil ifTrue:[^ nil].
859dca6352f8 class: Method
Claus Gittinger <cg@exept.de>
parents: 14505
diff changeset
   968
    ^ self annotationAtIndex: index.
859dca6352f8 class: Method
Claus Gittinger <cg@exept.de>
parents: 14505
diff changeset
   969
859dca6352f8 class: Method
Claus Gittinger <cg@exept.de>
parents: 14505
diff changeset
   970
    "
18620
b4e9f25d6ce6 preparations for lined index list in WeakArray
Claus Gittinger <cg@exept.de>
parents: 18462
diff changeset
   971
	(Object >> #yourself) annotationAt: #namespace:
14508
859dca6352f8 class: Method
Claus Gittinger <cg@exept.de>
parents: 14505
diff changeset
   972
    "
859dca6352f8 class: Method
Claus Gittinger <cg@exept.de>
parents: 14505
diff changeset
   973
859dca6352f8 class: Method
Claus Gittinger <cg@exept.de>
parents: 14505
diff changeset
   974
    "Created: / 19-05-2010 / 16:16:25 / Jan Vrany <jan.vrany@fit.cvut.cz>"
859dca6352f8 class: Method
Claus Gittinger <cg@exept.de>
parents: 14505
diff changeset
   975
    "Modified: / 02-07-2010 / 22:35:56 / Jan Vrany <jan.vrany@fit.cvut.cz>"
859dca6352f8 class: Method
Claus Gittinger <cg@exept.de>
parents: 14505
diff changeset
   976
    "Modified: / 18-11-2011 / 14:46:21 / cg"
859dca6352f8 class: Method
Claus Gittinger <cg@exept.de>
parents: 14505
diff changeset
   977
    "Modified (format): / 26-07-2012 / 15:47:54 / cg"
859dca6352f8 class: Method
Claus Gittinger <cg@exept.de>
parents: 14505
diff changeset
   978
!
859dca6352f8 class: Method
Claus Gittinger <cg@exept.de>
parents: 14505
diff changeset
   979
859dca6352f8 class: Method
Claus Gittinger <cg@exept.de>
parents: 14505
diff changeset
   980
annotations
18411
e6d26bb9b37b class: Method
Claus Gittinger <cg@exept.de>
parents: 18368
diff changeset
   981
    "return (a copy) of the annotations array"
e6d26bb9b37b class: Method
Claus Gittinger <cg@exept.de>
parents: 18368
diff changeset
   982
16220
0834bd0e9d85 Fixed bug in Method>>#annotations - always return an array with Annotation (sub)instances.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 16218
diff changeset
   983
    | retval |
14508
859dca6352f8 class: Method
Claus Gittinger <cg@exept.de>
parents: 14505
diff changeset
   984
16261
52a0604a7b95 class: Method
Stefan Vogel <sv@exept.de>
parents: 16221
diff changeset
   985
    annotations isNil ifTrue:[^ #()].
18411
e6d26bb9b37b class: Method
Claus Gittinger <cg@exept.de>
parents: 18368
diff changeset
   986
16220
0834bd0e9d85 Fixed bug in Method>>#annotations - always return an array with Annotation (sub)instances.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 16218
diff changeset
   987
    retval := Array new: annotations size.
0834bd0e9d85 Fixed bug in Method>>#annotations - always return an array with Annotation (sub)instances.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 16218
diff changeset
   988
    1 to: annotations size do: [:i|
18620
b4e9f25d6ce6 preparations for lined index list in WeakArray
Claus Gittinger <cg@exept.de>
parents: 18462
diff changeset
   989
	retval at: i put: (self annotationAtIndex: i).
16220
0834bd0e9d85 Fixed bug in Method>>#annotations - always return an array with Annotation (sub)instances.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 16218
diff changeset
   990
    ].
0834bd0e9d85 Fixed bug in Method>>#annotations - always return an array with Annotation (sub)instances.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 16218
diff changeset
   991
    ^ retval.
0834bd0e9d85 Fixed bug in Method>>#annotations - always return an array with Annotation (sub)instances.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 16218
diff changeset
   992
14508
859dca6352f8 class: Method
Claus Gittinger <cg@exept.de>
parents: 14505
diff changeset
   993
    "Modified: / 18-11-2011 / 14:46:56 / cg"
859dca6352f8 class: Method
Claus Gittinger <cg@exept.de>
parents: 14505
diff changeset
   994
    "Modified (comment): / 26-07-2012 / 15:50:26 / cg"
16220
0834bd0e9d85 Fixed bug in Method>>#annotations - always return an array with Annotation (sub)instances.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 16218
diff changeset
   995
    "Modified: / 05-03-2014 / 15:18:20 / Jan Vrany <jan.vrany@fit.cvut.cz>"
14508
859dca6352f8 class: Method
Claus Gittinger <cg@exept.de>
parents: 14505
diff changeset
   996
!
859dca6352f8 class: Method
Claus Gittinger <cg@exept.de>
parents: 14505
diff changeset
   997
859dca6352f8 class: Method
Claus Gittinger <cg@exept.de>
parents: 14505
diff changeset
   998
annotations: anObject
859dca6352f8 class: Method
Claus Gittinger <cg@exept.de>
parents: 14505
diff changeset
   999
    "set the annotations"
859dca6352f8 class: Method
Claus Gittinger <cg@exept.de>
parents: 14505
diff changeset
  1000
859dca6352f8 class: Method
Claus Gittinger <cg@exept.de>
parents: 14505
diff changeset
  1001
    self setAnnotations: anObject.
859dca6352f8 class: Method
Claus Gittinger <cg@exept.de>
parents: 14505
diff changeset
  1002
"/    "iterate over annotations just to invoke
19868
8abfb62f8c29 #DOCUMENTATION by mawalch
mawalch
parents: 19847
diff changeset
  1003
"/     annotationAtIndex: which lazily initializes annotations
8abfb62f8c29 #DOCUMENTATION by mawalch
mawalch
parents: 19847
diff changeset
  1004
"/     and sends #annotatesMethod:"
14508
859dca6352f8 class: Method
Claus Gittinger <cg@exept.de>
parents: 14505
diff changeset
  1005
"/    self annotationsDo:[:annotation|]
859dca6352f8 class: Method
Claus Gittinger <cg@exept.de>
parents: 14505
diff changeset
  1006
859dca6352f8 class: Method
Claus Gittinger <cg@exept.de>
parents: 14505
diff changeset
  1007
    "Created: / 02-07-2010 / 22:38:08 / Jan Vrany <jan.vrany@fit.cvut.cz>"
859dca6352f8 class: Method
Claus Gittinger <cg@exept.de>
parents: 14505
diff changeset
  1008
!
859dca6352f8 class: Method
Claus Gittinger <cg@exept.de>
parents: 14505
diff changeset
  1009
859dca6352f8 class: Method
Claus Gittinger <cg@exept.de>
parents: 14505
diff changeset
  1010
annotationsAt: key
859dca6352f8 class: Method
Claus Gittinger <cg@exept.de>
parents: 14505
diff changeset
  1011
18620
b4e9f25d6ce6 preparations for lined index list in WeakArray
Claus Gittinger <cg@exept.de>
parents: 18462
diff changeset
  1012
    ^OrderedCollection
b4e9f25d6ce6 preparations for lined index list in WeakArray
Claus Gittinger <cg@exept.de>
parents: 18462
diff changeset
  1013
	streamContents:[:annotStream|
b4e9f25d6ce6 preparations for lined index list in WeakArray
Claus Gittinger <cg@exept.de>
parents: 18462
diff changeset
  1014
	    self annotationsAt: key do: [:annot| annotStream nextPut: annot]
b4e9f25d6ce6 preparations for lined index list in WeakArray
Claus Gittinger <cg@exept.de>
parents: 18462
diff changeset
  1015
	]
14508
859dca6352f8 class: Method
Claus Gittinger <cg@exept.de>
parents: 14505
diff changeset
  1016
859dca6352f8 class: Method
Claus Gittinger <cg@exept.de>
parents: 14505
diff changeset
  1017
    "Created: / 16-07-2010 / 11:41:13 / Jan Vrany <jan.vrany@fit.cvut.cz>"
859dca6352f8 class: Method
Claus Gittinger <cg@exept.de>
parents: 14505
diff changeset
  1018
    "Modified (format): / 26-07-2012 / 15:46:56 / cg"
859dca6352f8 class: Method
Claus Gittinger <cg@exept.de>
parents: 14505
diff changeset
  1019
!
859dca6352f8 class: Method
Claus Gittinger <cg@exept.de>
parents: 14505
diff changeset
  1020
859dca6352f8 class: Method
Claus Gittinger <cg@exept.de>
parents: 14505
diff changeset
  1021
annotationsAt: key do: block
859dca6352f8 class: Method
Claus Gittinger <cg@exept.de>
parents: 14505
diff changeset
  1022
    self annotationsDo: [:annot|
18620
b4e9f25d6ce6 preparations for lined index list in WeakArray
Claus Gittinger <cg@exept.de>
parents: 18462
diff changeset
  1023
	annot key == key ifTrue:[block value: annot]
14508
859dca6352f8 class: Method
Claus Gittinger <cg@exept.de>
parents: 14505
diff changeset
  1024
    ]
859dca6352f8 class: Method
Claus Gittinger <cg@exept.de>
parents: 14505
diff changeset
  1025
859dca6352f8 class: Method
Claus Gittinger <cg@exept.de>
parents: 14505
diff changeset
  1026
    "Created: / 16-07-2010 / 11:48:49 / Jan Vrany <jan.vrany@fit.cvut.cz>"
859dca6352f8 class: Method
Claus Gittinger <cg@exept.de>
parents: 14505
diff changeset
  1027
    "Modified (format): / 26-07-2012 / 15:48:37 / cg"
859dca6352f8 class: Method
Claus Gittinger <cg@exept.de>
parents: 14505
diff changeset
  1028
!
859dca6352f8 class: Method
Claus Gittinger <cg@exept.de>
parents: 14505
diff changeset
  1029
859dca6352f8 class: Method
Claus Gittinger <cg@exept.de>
parents: 14505
diff changeset
  1030
annotationsAt: key1 orAt: key2
859dca6352f8 class: Method
Claus Gittinger <cg@exept.de>
parents: 14505
diff changeset
  1031
18620
b4e9f25d6ce6 preparations for lined index list in WeakArray
Claus Gittinger <cg@exept.de>
parents: 18462
diff changeset
  1032
    ^OrderedCollection
b4e9f25d6ce6 preparations for lined index list in WeakArray
Claus Gittinger <cg@exept.de>
parents: 18462
diff changeset
  1033
	streamContents:[:annotStream|
b4e9f25d6ce6 preparations for lined index list in WeakArray
Claus Gittinger <cg@exept.de>
parents: 18462
diff changeset
  1034
	    self annotationsAt: key1 orAt: key2 do: [:annot|annotStream nextPut: annot]
b4e9f25d6ce6 preparations for lined index list in WeakArray
Claus Gittinger <cg@exept.de>
parents: 18462
diff changeset
  1035
	]
14508
859dca6352f8 class: Method
Claus Gittinger <cg@exept.de>
parents: 14505
diff changeset
  1036
859dca6352f8 class: Method
Claus Gittinger <cg@exept.de>
parents: 14505
diff changeset
  1037
    "Created: / 16-07-2010 / 11:41:13 / Jan Vrany <jan.vrany@fit.cvut.cz>"
859dca6352f8 class: Method
Claus Gittinger <cg@exept.de>
parents: 14505
diff changeset
  1038
    "Modified (format): / 26-07-2012 / 15:49:11 / cg"
859dca6352f8 class: Method
Claus Gittinger <cg@exept.de>
parents: 14505
diff changeset
  1039
!
859dca6352f8 class: Method
Claus Gittinger <cg@exept.de>
parents: 14505
diff changeset
  1040
859dca6352f8 class: Method
Claus Gittinger <cg@exept.de>
parents: 14505
diff changeset
  1041
annotationsAt: key1 orAt: key2 do: block
859dca6352f8 class: Method
Claus Gittinger <cg@exept.de>
parents: 14505
diff changeset
  1042
    self annotationsDo:[:annot |
19585
2aab71e0f0b6 #DOCUMENTATION by cg
Claus Gittinger <cg@exept.de>
parents: 19449
diff changeset
  1043
        |key|
2aab71e0f0b6 #DOCUMENTATION by cg
Claus Gittinger <cg@exept.de>
parents: 19449
diff changeset
  1044
        key := annot key.
2aab71e0f0b6 #DOCUMENTATION by cg
Claus Gittinger <cg@exept.de>
parents: 19449
diff changeset
  1045
        (key == key1 or:[key == key2]) ifTrue:[
2aab71e0f0b6 #DOCUMENTATION by cg
Claus Gittinger <cg@exept.de>
parents: 19449
diff changeset
  1046
            block value: annot
2aab71e0f0b6 #DOCUMENTATION by cg
Claus Gittinger <cg@exept.de>
parents: 19449
diff changeset
  1047
        ]
14508
859dca6352f8 class: Method
Claus Gittinger <cg@exept.de>
parents: 14505
diff changeset
  1048
    ]
859dca6352f8 class: Method
Claus Gittinger <cg@exept.de>
parents: 14505
diff changeset
  1049
859dca6352f8 class: Method
Claus Gittinger <cg@exept.de>
parents: 14505
diff changeset
  1050
    "Created: / 16-07-2010 / 11:47:20 / Jan Vrany <jan.vrany@fit.cvut.cz>"
859dca6352f8 class: Method
Claus Gittinger <cg@exept.de>
parents: 14505
diff changeset
  1051
    "Modified (format): / 26-07-2012 / 15:49:30 / cg"
859dca6352f8 class: Method
Claus Gittinger <cg@exept.de>
parents: 14505
diff changeset
  1052
!
859dca6352f8 class: Method
Claus Gittinger <cg@exept.de>
parents: 14505
diff changeset
  1053
859dca6352f8 class: Method
Claus Gittinger <cg@exept.de>
parents: 14505
diff changeset
  1054
annotationsDo: aBlock
859dca6352f8 class: Method
Claus Gittinger <cg@exept.de>
parents: 14505
diff changeset
  1055
    annotations isNil ifTrue:[^nil].
859dca6352f8 class: Method
Claus Gittinger <cg@exept.de>
parents: 14505
diff changeset
  1056
    1 to: annotations size do: [:i|
18620
b4e9f25d6ce6 preparations for lined index list in WeakArray
Claus Gittinger <cg@exept.de>
parents: 18462
diff changeset
  1057
	aBlock value: (self annotationAtIndex: i)
14508
859dca6352f8 class: Method
Claus Gittinger <cg@exept.de>
parents: 14505
diff changeset
  1058
    ].
859dca6352f8 class: Method
Claus Gittinger <cg@exept.de>
parents: 14505
diff changeset
  1059
859dca6352f8 class: Method
Claus Gittinger <cg@exept.de>
parents: 14505
diff changeset
  1060
    "Created: / 02-07-2010 / 22:33:36 / Jan Vrany <jan.vrany@fit.cvut.cz>"
859dca6352f8 class: Method
Claus Gittinger <cg@exept.de>
parents: 14505
diff changeset
  1061
    "Modified: / 11-07-2010 / 19:38:54 / Jan Vrany <jan.vrany@fit.cvut.cz>"
859dca6352f8 class: Method
Claus Gittinger <cg@exept.de>
parents: 14505
diff changeset
  1062
    "Modified (format): / 18-11-2011 / 14:47:06 / cg"
859dca6352f8 class: Method
Claus Gittinger <cg@exept.de>
parents: 14505
diff changeset
  1063
! !
859dca6352f8 class: Method
Claus Gittinger <cg@exept.de>
parents: 14505
diff changeset
  1064
1093
1e742016eea0 category rename / added access to RESOURCE and CALLED flags
Claus Gittinger <cg@exept.de>
parents: 1087
diff changeset
  1065
!Method methodsFor:'accessing-visibility'!
1e742016eea0 category rename / added access to RESOURCE and CALLED flags
Claus Gittinger <cg@exept.de>
parents: 1087
diff changeset
  1066
952
d600e08a5936 handle the case where a method has a sourceFileInfo, but the class has not
Claus Gittinger <cg@exept.de>
parents: 934
diff changeset
  1067
isIgnored
d600e08a5936 handle the case where a method has a sourceFileInfo, but the class has not
Claus Gittinger <cg@exept.de>
parents: 934
diff changeset
  1068
    "return true, if this is an ignored method.
d600e08a5936 handle the case where a method has a sourceFileInfo, but the class has not
Claus Gittinger <cg@exept.de>
parents: 934
diff changeset
  1069
     Ignored methods are physically present in the source file,
d600e08a5936 handle the case where a method has a sourceFileInfo, but the class has not
Claus Gittinger <cg@exept.de>
parents: 934
diff changeset
  1070
     but no code is generated for it by stc, and the VM does not see
d600e08a5936 handle the case where a method has a sourceFileInfo, but the class has not
Claus Gittinger <cg@exept.de>
parents: 934
diff changeset
  1071
     it in its message lookup.
747
ea3b6f7fd7ce added ignoredMethods
Claus Gittinger <cg@exept.de>
parents: 737
diff changeset
  1072
     (i.e. setting a method to #ignored, and sending that selector,
12854
3a3d3c02c3bd *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 12695
diff changeset
  1073
      leads to either the superclasses implementation to be called,
747
ea3b6f7fd7ce added ignoredMethods
Claus Gittinger <cg@exept.de>
parents: 737
diff changeset
  1074
      or a doesNotUnderstand exception to be raised)
ea3b6f7fd7ce added ignoredMethods
Claus Gittinger <cg@exept.de>
parents: 737
diff changeset
  1075
952
d600e08a5936 handle the case where a method has a sourceFileInfo, but the class has not
Claus Gittinger <cg@exept.de>
parents: 934
diff changeset
  1076
     Notice: this is a nonstandard feature, not supported
747
ea3b6f7fd7ce added ignoredMethods
Claus Gittinger <cg@exept.de>
parents: 737
diff changeset
  1077
     by other smalltalk implementations and not specified in the ANSI spec.
ea3b6f7fd7ce added ignoredMethods
Claus Gittinger <cg@exept.de>
parents: 737
diff changeset
  1078
ea3b6f7fd7ce added ignoredMethods
Claus Gittinger <cg@exept.de>
parents: 737
diff changeset
  1079
     This is EXPERIMENTAL - and being evaluated for usability.
ea3b6f7fd7ce added ignoredMethods
Claus Gittinger <cg@exept.de>
parents: 737
diff changeset
  1080
     It may change or even vanish (if it shows to be not useful)."
ea3b6f7fd7ce added ignoredMethods
Claus Gittinger <cg@exept.de>
parents: 737
diff changeset
  1081
3216
e0f3f49118ed Simplify privacy stuff to make redirection from WrappedMethod easier.
Stefan Vogel <sv@exept.de>
parents: 3168
diff changeset
  1082
    ^ self privacy == #ignored
e0f3f49118ed Simplify privacy stuff to make redirection from WrappedMethod easier.
Stefan Vogel <sv@exept.de>
parents: 3168
diff changeset
  1083
e0f3f49118ed Simplify privacy stuff to make redirection from WrappedMethod easier.
Stefan Vogel <sv@exept.de>
parents: 3168
diff changeset
  1084
    "Modified: / 23.1.1998 / 15:23:02 / stefan"
176
48061f8659aa more queries
claus
parents: 159
diff changeset
  1085
!
48061f8659aa more queries
claus
parents: 159
diff changeset
  1086
48061f8659aa more queries
claus
parents: 159
diff changeset
  1087
isPrivate
48061f8659aa more queries
claus
parents: 159
diff changeset
  1088
    "return true, if this is a private method.
8518
7dc3f9909640 Interchanged the meaning of method privacy -
Stefan Vogel <sv@exept.de>
parents: 8465
diff changeset
  1089
     Execution of private methods is only allowed via self sends
7dc3f9909640 Interchanged the meaning of method privacy -
Stefan Vogel <sv@exept.de>
parents: 8465
diff changeset
  1090
     from superclasses or the class itself.
176
48061f8659aa more queries
claus
parents: 159
diff changeset
  1091
     If a private method is called by some other class, a runtime
48061f8659aa more queries
claus
parents: 159
diff changeset
  1092
     error (PrivateMethodSignal) is raised.
48061f8659aa more queries
claus
parents: 159
diff changeset
  1093
     Notice: method privacy is a nonstandard feature, not supported
48061f8659aa more queries
claus
parents: 159
diff changeset
  1094
     by other smalltalk implementations and not specified in the ANSI spec.
747
ea3b6f7fd7ce added ignoredMethods
Claus Gittinger <cg@exept.de>
parents: 737
diff changeset
  1095
176
48061f8659aa more queries
claus
parents: 159
diff changeset
  1096
     This is EXPERIMENTAL - and being evaluated for usability.
48061f8659aa more queries
claus
parents: 159
diff changeset
  1097
     It may change or even vanish (if it shows to be not useful)."
48061f8659aa more queries
claus
parents: 159
diff changeset
  1098
3216
e0f3f49118ed Simplify privacy stuff to make redirection from WrappedMethod easier.
Stefan Vogel <sv@exept.de>
parents: 3168
diff changeset
  1099
    ^ self privacy == #private
e0f3f49118ed Simplify privacy stuff to make redirection from WrappedMethod easier.
Stefan Vogel <sv@exept.de>
parents: 3168
diff changeset
  1100
e0f3f49118ed Simplify privacy stuff to make redirection from WrappedMethod easier.
Stefan Vogel <sv@exept.de>
parents: 3168
diff changeset
  1101
    "Modified: / 23.1.1998 / 15:23:13 / stefan"
68
59faa75185ba *** empty log message ***
claus
parents: 56
diff changeset
  1102
!
59faa75185ba *** empty log message ***
claus
parents: 56
diff changeset
  1103
176
48061f8659aa more queries
claus
parents: 159
diff changeset
  1104
isProtected
48061f8659aa more queries
claus
parents: 159
diff changeset
  1105
    "return true, if this is a protected method.
8518
7dc3f9909640 Interchanged the meaning of method privacy -
Stefan Vogel <sv@exept.de>
parents: 8465
diff changeset
  1106
     Execution of protected methods is only allowed via self/super sends
7dc3f9909640 Interchanged the meaning of method privacy -
Stefan Vogel <sv@exept.de>
parents: 8465
diff changeset
  1107
     from superclasses, the class itself or subclasse.
176
48061f8659aa more queries
claus
parents: 159
diff changeset
  1108
     If a protected method is called by some other class, a runtime
48061f8659aa more queries
claus
parents: 159
diff changeset
  1109
     error (PrivateMethodSignal) is raised.
747
ea3b6f7fd7ce added ignoredMethods
Claus Gittinger <cg@exept.de>
parents: 737
diff changeset
  1110
176
48061f8659aa more queries
claus
parents: 159
diff changeset
  1111
     Notice: method privacy is a nonstandard feature, not supported
48061f8659aa more queries
claus
parents: 159
diff changeset
  1112
     by other smalltalk implementations and not specified in the ANSI spec.
747
ea3b6f7fd7ce added ignoredMethods
Claus Gittinger <cg@exept.de>
parents: 737
diff changeset
  1113
176
48061f8659aa more queries
claus
parents: 159
diff changeset
  1114
     This is EXPERIMENTAL - and being evaluated for usability.
48061f8659aa more queries
claus
parents: 159
diff changeset
  1115
     It may change or even vanish (if it shows to be not useful)."
48061f8659aa more queries
claus
parents: 159
diff changeset
  1116
3216
e0f3f49118ed Simplify privacy stuff to make redirection from WrappedMethod easier.
Stefan Vogel <sv@exept.de>
parents: 3168
diff changeset
  1117
    ^ self privacy == #protected
e0f3f49118ed Simplify privacy stuff to make redirection from WrappedMethod easier.
Stefan Vogel <sv@exept.de>
parents: 3168
diff changeset
  1118
e0f3f49118ed Simplify privacy stuff to make redirection from WrappedMethod easier.
Stefan Vogel <sv@exept.de>
parents: 3168
diff changeset
  1119
    "Modified: / 23.1.1998 / 15:23:27 / stefan"
176
48061f8659aa more queries
claus
parents: 159
diff changeset
  1120
!
48061f8659aa more queries
claus
parents: 159
diff changeset
  1121
48061f8659aa more queries
claus
parents: 159
diff changeset
  1122
isPublic
48061f8659aa more queries
claus
parents: 159
diff changeset
  1123
    "return true, if this is a public method - I.e. can be executed via any send.
747
ea3b6f7fd7ce added ignoredMethods
Claus Gittinger <cg@exept.de>
parents: 737
diff changeset
  1124
     This is the default and how other smalltalk implementations treat all methods.
ea3b6f7fd7ce added ignoredMethods
Claus Gittinger <cg@exept.de>
parents: 737
diff changeset
  1125
360
claus
parents: 350
diff changeset
  1126
     Notice: method privacy is a nonstandard feature, not supported
claus
parents: 350
diff changeset
  1127
     by other smalltalk implementations and not specified in the ANSI spec.
747
ea3b6f7fd7ce added ignoredMethods
Claus Gittinger <cg@exept.de>
parents: 737
diff changeset
  1128
360
claus
parents: 350
diff changeset
  1129
     This is EXPERIMENTAL - and being evaluated for usability.
claus
parents: 350
diff changeset
  1130
     It may change or even vanish (if it shows to be not useful)."
176
48061f8659aa more queries
claus
parents: 159
diff changeset
  1131
3216
e0f3f49118ed Simplify privacy stuff to make redirection from WrappedMethod easier.
Stefan Vogel <sv@exept.de>
parents: 3168
diff changeset
  1132
    ^ self privacy == #public
e0f3f49118ed Simplify privacy stuff to make redirection from WrappedMethod easier.
Stefan Vogel <sv@exept.de>
parents: 3168
diff changeset
  1133
e0f3f49118ed Simplify privacy stuff to make redirection from WrappedMethod easier.
Stefan Vogel <sv@exept.de>
parents: 3168
diff changeset
  1134
    "Modified: / 23.1.1998 / 15:23:40 / stefan"
176
48061f8659aa more queries
claus
parents: 159
diff changeset
  1135
!
48061f8659aa more queries
claus
parents: 159
diff changeset
  1136
747
ea3b6f7fd7ce added ignoredMethods
Claus Gittinger <cg@exept.de>
parents: 737
diff changeset
  1137
isRestricted
ea3b6f7fd7ce added ignoredMethods
Claus Gittinger <cg@exept.de>
parents: 737
diff changeset
  1138
    "return the flag bit stating that this method is restricted.
ea3b6f7fd7ce added ignoredMethods
Claus Gittinger <cg@exept.de>
parents: 737
diff changeset
  1139
     Execution of the receiver will only be allowed if the system is not in
12854
3a3d3c02c3bd *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 12695
diff changeset
  1140
     'trap restricted mode' (-->ObjectMemory) otherise a runtime
747
ea3b6f7fd7ce added ignoredMethods
Claus Gittinger <cg@exept.de>
parents: 737
diff changeset
  1141
     error (PrivateMethodSignal) is raised.
ea3b6f7fd7ce added ignoredMethods
Claus Gittinger <cg@exept.de>
parents: 737
diff changeset
  1142
ea3b6f7fd7ce added ignoredMethods
Claus Gittinger <cg@exept.de>
parents: 737
diff changeset
  1143
     Notice: method restriction is a nonstandard feature, not supported
ea3b6f7fd7ce added ignoredMethods
Claus Gittinger <cg@exept.de>
parents: 737
diff changeset
  1144
     by other smalltalk implementations and not specified in the ANSI spec.
ea3b6f7fd7ce added ignoredMethods
Claus Gittinger <cg@exept.de>
parents: 737
diff changeset
  1145
ea3b6f7fd7ce added ignoredMethods
Claus Gittinger <cg@exept.de>
parents: 737
diff changeset
  1146
     This is EXPERIMENTAL - and being evaluated for usability.
ea3b6f7fd7ce added ignoredMethods
Claus Gittinger <cg@exept.de>
parents: 737
diff changeset
  1147
     It may change or even vanish (if it shows to be not useful)."
ea3b6f7fd7ce added ignoredMethods
Claus Gittinger <cg@exept.de>
parents: 737
diff changeset
  1148
ea3b6f7fd7ce added ignoredMethods
Claus Gittinger <cg@exept.de>
parents: 737
diff changeset
  1149
%{  /* NOCONTEXT */
ea3b6f7fd7ce added ignoredMethods
Claus Gittinger <cg@exept.de>
parents: 737
diff changeset
  1150
#ifdef F_RESTRICTED
2868
772c890f907c alpha64
Claus Gittinger <cg@exept.de>
parents: 2826
diff changeset
  1151
    INT f = __intVal(__INST(flags));
747
ea3b6f7fd7ce added ignoredMethods
Claus Gittinger <cg@exept.de>
parents: 737
diff changeset
  1152
ea3b6f7fd7ce added ignoredMethods
Claus Gittinger <cg@exept.de>
parents: 737
diff changeset
  1153
    if (f & F_RESTRICTED) {
18620
b4e9f25d6ce6 preparations for lined index list in WeakArray
Claus Gittinger <cg@exept.de>
parents: 18462
diff changeset
  1154
	RETURN (true);
747
ea3b6f7fd7ce added ignoredMethods
Claus Gittinger <cg@exept.de>
parents: 737
diff changeset
  1155
    }
ea3b6f7fd7ce added ignoredMethods
Claus Gittinger <cg@exept.de>
parents: 737
diff changeset
  1156
#endif
ea3b6f7fd7ce added ignoredMethods
Claus Gittinger <cg@exept.de>
parents: 737
diff changeset
  1157
%}.
ea3b6f7fd7ce added ignoredMethods
Claus Gittinger <cg@exept.de>
parents: 737
diff changeset
  1158
    ^ false
8526
326e7dcb212a *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 8518
diff changeset
  1159
! !
326e7dcb212a *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 8518
diff changeset
  1160
326e7dcb212a *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 8518
diff changeset
  1161
!Method privateMethodsFor:'accessing-visibility'!
326e7dcb212a *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 8518
diff changeset
  1162
326e7dcb212a *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 8518
diff changeset
  1163
primSetPrivacy:aSymbol
326e7dcb212a *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 8518
diff changeset
  1164
    "set the methods access rights (privacy) from a symbol;
326e7dcb212a *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 8518
diff changeset
  1165
     Currently, this must be one of #private, #protected, #public or #ignored.
12854
3a3d3c02c3bd *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 12695
diff changeset
  1166
     #setPrivacy: simply sets the attribute. When changing methods, that
8526
326e7dcb212a *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 8518
diff changeset
  1167
     have already been called, #privacy: should be used.
326e7dcb212a *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 8518
diff changeset
  1168
326e7dcb212a *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 8518
diff changeset
  1169
     Notice: method privacy is a nonstandard feature, not supported
326e7dcb212a *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 8518
diff changeset
  1170
     by other smalltalk implementations and not specified in the ANSI spec.
326e7dcb212a *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 8518
diff changeset
  1171
     If at all, use it for debugging purposes, to catch messagesends
326e7dcb212a *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 8518
diff changeset
  1172
     which are not supposed to be sent by others.
326e7dcb212a *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 8518
diff changeset
  1173
     (especially, if working in a team, while integrating other peoples work)
326e7dcb212a *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 8518
diff changeset
  1174
326e7dcb212a *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 8518
diff changeset
  1175
     This is EXPERIMENTAL - and being evaluated for usability.
326e7dcb212a *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 8518
diff changeset
  1176
     It may change or even vanish (if it shows to be not useful)."
326e7dcb212a *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 8518
diff changeset
  1177
326e7dcb212a *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 8518
diff changeset
  1178
%{  /* NOCONTEXT */
326e7dcb212a *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 8518
diff changeset
  1179
326e7dcb212a *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 8518
diff changeset
  1180
#if defined(M_PRIVACY)
326e7dcb212a *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 8518
diff changeset
  1181
    INT f = __intVal(__INST(flags));
326e7dcb212a *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 8518
diff changeset
  1182
    INT p;
326e7dcb212a *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 8518
diff changeset
  1183
326e7dcb212a *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 8518
diff changeset
  1184
    if (aSymbol == @symbol(public))
18620
b4e9f25d6ce6 preparations for lined index list in WeakArray
Claus Gittinger <cg@exept.de>
parents: 18462
diff changeset
  1185
	p = 0;
8526
326e7dcb212a *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 8518
diff changeset
  1186
    else if (aSymbol == @symbol(protected))
18620
b4e9f25d6ce6 preparations for lined index list in WeakArray
Claus Gittinger <cg@exept.de>
parents: 18462
diff changeset
  1187
	p = F_PRIVATE;
8526
326e7dcb212a *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 8518
diff changeset
  1188
    else if (aSymbol == @symbol(private))
18620
b4e9f25d6ce6 preparations for lined index list in WeakArray
Claus Gittinger <cg@exept.de>
parents: 18462
diff changeset
  1189
	p = F_CLASSPRIVATE;
8526
326e7dcb212a *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 8518
diff changeset
  1190
    else if (aSymbol == @symbol(ignored))
18620
b4e9f25d6ce6 preparations for lined index list in WeakArray
Claus Gittinger <cg@exept.de>
parents: 18462
diff changeset
  1191
	p = F_IGNORED;
8526
326e7dcb212a *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 8518
diff changeset
  1192
    else
18620
b4e9f25d6ce6 preparations for lined index list in WeakArray
Claus Gittinger <cg@exept.de>
parents: 18462
diff changeset
  1193
	RETURN(false);  /* illegal symbol */
12854
3a3d3c02c3bd *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 12695
diff changeset
  1194
8526
326e7dcb212a *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 8518
diff changeset
  1195
326e7dcb212a *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 8518
diff changeset
  1196
    f = (f & ~M_PRIVACY) | p;
8913
b9498d27a554 64bit; mkSmallInteger
Claus Gittinger <cg@exept.de>
parents: 8896
diff changeset
  1197
    __INST(flags) = __mkSmallInteger(f);
8526
326e7dcb212a *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 8518
diff changeset
  1198
#endif
326e7dcb212a *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 8518
diff changeset
  1199
326e7dcb212a *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 8518
diff changeset
  1200
%}.
326e7dcb212a *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 8518
diff changeset
  1201
    ^ true
326e7dcb212a *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 8518
diff changeset
  1202
326e7dcb212a *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 8518
diff changeset
  1203
    "Modified: 27.8.1995 / 22:58:08 / claus"
326e7dcb212a *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 8518
diff changeset
  1204
! !
326e7dcb212a *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 8518
diff changeset
  1205
326e7dcb212a *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 8518
diff changeset
  1206
!Method methodsFor:'accessing-visibility'!
952
d600e08a5936 handle the case where a method has a sourceFileInfo, but the class has not
Claus Gittinger <cg@exept.de>
parents: 934
diff changeset
  1207
d600e08a5936 handle the case where a method has a sourceFileInfo, but the class has not
Claus Gittinger <cg@exept.de>
parents: 934
diff changeset
  1208
privacy
d600e08a5936 handle the case where a method has a sourceFileInfo, but the class has not
Claus Gittinger <cg@exept.de>
parents: 934
diff changeset
  1209
    "return a symbol describing the methods access rights (privacy);
d600e08a5936 handle the case where a method has a sourceFileInfo, but the class has not
Claus Gittinger <cg@exept.de>
parents: 934
diff changeset
  1210
     Currently, this is one of #private, #protected, #public or #ignored.
d600e08a5936 handle the case where a method has a sourceFileInfo, but the class has not
Claus Gittinger <cg@exept.de>
parents: 934
diff changeset
  1211
d600e08a5936 handle the case where a method has a sourceFileInfo, but the class has not
Claus Gittinger <cg@exept.de>
parents: 934
diff changeset
  1212
     Notice: method privacy is a nonstandard feature, not supported
d600e08a5936 handle the case where a method has a sourceFileInfo, but the class has not
Claus Gittinger <cg@exept.de>
parents: 934
diff changeset
  1213
     by other smalltalk implementations and not specified in the ANSI spec.
d600e08a5936 handle the case where a method has a sourceFileInfo, but the class has not
Claus Gittinger <cg@exept.de>
parents: 934
diff changeset
  1214
     If at all, use it for debugging purposes, to catch messagesends
d600e08a5936 handle the case where a method has a sourceFileInfo, but the class has not
Claus Gittinger <cg@exept.de>
parents: 934
diff changeset
  1215
     which are not supposed to be sent by others.
d600e08a5936 handle the case where a method has a sourceFileInfo, but the class has not
Claus Gittinger <cg@exept.de>
parents: 934
diff changeset
  1216
     (especially, if working in a team, while integrating other peoples work)
d600e08a5936 handle the case where a method has a sourceFileInfo, but the class has not
Claus Gittinger <cg@exept.de>
parents: 934
diff changeset
  1217
d600e08a5936 handle the case where a method has a sourceFileInfo, but the class has not
Claus Gittinger <cg@exept.de>
parents: 934
diff changeset
  1218
     This is EXPERIMENTAL - and being evaluated for usability.
d600e08a5936 handle the case where a method has a sourceFileInfo, but the class has not
Claus Gittinger <cg@exept.de>
parents: 934
diff changeset
  1219
     It may change or even vanish (if it shows to be not useful)."
d600e08a5936 handle the case where a method has a sourceFileInfo, but the class has not
Claus Gittinger <cg@exept.de>
parents: 934
diff changeset
  1220
3216
e0f3f49118ed Simplify privacy stuff to make redirection from WrappedMethod easier.
Stefan Vogel <sv@exept.de>
parents: 3168
diff changeset
  1221
%{  /* NOCONTEXT */
e0f3f49118ed Simplify privacy stuff to make redirection from WrappedMethod easier.
Stefan Vogel <sv@exept.de>
parents: 3168
diff changeset
  1222
    /* I made this a primitive to get the define constant from stc.h */
e0f3f49118ed Simplify privacy stuff to make redirection from WrappedMethod easier.
Stefan Vogel <sv@exept.de>
parents: 3168
diff changeset
  1223
e0f3f49118ed Simplify privacy stuff to make redirection from WrappedMethod easier.
Stefan Vogel <sv@exept.de>
parents: 3168
diff changeset
  1224
#if defined(M_PRIVACY) && (defined(F_PRIVATE) || defined(F_CLASSPRIVATE) || defined(F_IGNORED))
e0f3f49118ed Simplify privacy stuff to make redirection from WrappedMethod easier.
Stefan Vogel <sv@exept.de>
parents: 3168
diff changeset
  1225
e0f3f49118ed Simplify privacy stuff to make redirection from WrappedMethod easier.
Stefan Vogel <sv@exept.de>
parents: 3168
diff changeset
  1226
    INT f = __intVal(__INST(flags));
e0f3f49118ed Simplify privacy stuff to make redirection from WrappedMethod easier.
Stefan Vogel <sv@exept.de>
parents: 3168
diff changeset
  1227
    switch (f & M_PRIVACY) {
e0f3f49118ed Simplify privacy stuff to make redirection from WrappedMethod easier.
Stefan Vogel <sv@exept.de>
parents: 3168
diff changeset
  1228
e0f3f49118ed Simplify privacy stuff to make redirection from WrappedMethod easier.
Stefan Vogel <sv@exept.de>
parents: 3168
diff changeset
  1229
# ifdef F_PRIVATE
e0f3f49118ed Simplify privacy stuff to make redirection from WrappedMethod easier.
Stefan Vogel <sv@exept.de>
parents: 3168
diff changeset
  1230
    case F_PRIVATE:
18620
b4e9f25d6ce6 preparations for lined index list in WeakArray
Claus Gittinger <cg@exept.de>
parents: 18462
diff changeset
  1231
	RETURN (@symbol(protected));
b4e9f25d6ce6 preparations for lined index list in WeakArray
Claus Gittinger <cg@exept.de>
parents: 18462
diff changeset
  1232
	break;
3216
e0f3f49118ed Simplify privacy stuff to make redirection from WrappedMethod easier.
Stefan Vogel <sv@exept.de>
parents: 3168
diff changeset
  1233
# endif
e0f3f49118ed Simplify privacy stuff to make redirection from WrappedMethod easier.
Stefan Vogel <sv@exept.de>
parents: 3168
diff changeset
  1234
# ifdef F_CLASSPRIVATE
e0f3f49118ed Simplify privacy stuff to make redirection from WrappedMethod easier.
Stefan Vogel <sv@exept.de>
parents: 3168
diff changeset
  1235
    case F_CLASSPRIVATE:
18620
b4e9f25d6ce6 preparations for lined index list in WeakArray
Claus Gittinger <cg@exept.de>
parents: 18462
diff changeset
  1236
	RETURN (@symbol(private));
b4e9f25d6ce6 preparations for lined index list in WeakArray
Claus Gittinger <cg@exept.de>
parents: 18462
diff changeset
  1237
	break;
3216
e0f3f49118ed Simplify privacy stuff to make redirection from WrappedMethod easier.
Stefan Vogel <sv@exept.de>
parents: 3168
diff changeset
  1238
# endif
e0f3f49118ed Simplify privacy stuff to make redirection from WrappedMethod easier.
Stefan Vogel <sv@exept.de>
parents: 3168
diff changeset
  1239
# ifdef F_IGNORED
e0f3f49118ed Simplify privacy stuff to make redirection from WrappedMethod easier.
Stefan Vogel <sv@exept.de>
parents: 3168
diff changeset
  1240
    case F_IGNORED:
18620
b4e9f25d6ce6 preparations for lined index list in WeakArray
Claus Gittinger <cg@exept.de>
parents: 18462
diff changeset
  1241
	RETURN (@symbol(ignored));
b4e9f25d6ce6 preparations for lined index list in WeakArray
Claus Gittinger <cg@exept.de>
parents: 18462
diff changeset
  1242
	break;
3216
e0f3f49118ed Simplify privacy stuff to make redirection from WrappedMethod easier.
Stefan Vogel <sv@exept.de>
parents: 3168
diff changeset
  1243
# endif
e0f3f49118ed Simplify privacy stuff to make redirection from WrappedMethod easier.
Stefan Vogel <sv@exept.de>
parents: 3168
diff changeset
  1244
    }
e0f3f49118ed Simplify privacy stuff to make redirection from WrappedMethod easier.
Stefan Vogel <sv@exept.de>
parents: 3168
diff changeset
  1245
#endif
e0f3f49118ed Simplify privacy stuff to make redirection from WrappedMethod easier.
Stefan Vogel <sv@exept.de>
parents: 3168
diff changeset
  1246
%}.
e0f3f49118ed Simplify privacy stuff to make redirection from WrappedMethod easier.
Stefan Vogel <sv@exept.de>
parents: 3168
diff changeset
  1247
952
d600e08a5936 handle the case where a method has a sourceFileInfo, but the class has not
Claus Gittinger <cg@exept.de>
parents: 934
diff changeset
  1248
    ^ #public
d600e08a5936 handle the case where a method has a sourceFileInfo, but the class has not
Claus Gittinger <cg@exept.de>
parents: 934
diff changeset
  1249
!
d600e08a5936 handle the case where a method has a sourceFileInfo, but the class has not
Claus Gittinger <cg@exept.de>
parents: 934
diff changeset
  1250
d600e08a5936 handle the case where a method has a sourceFileInfo, but the class has not
Claus Gittinger <cg@exept.de>
parents: 934
diff changeset
  1251
privacy:aSymbol
22372
72db331204d4 #DOCUMENTATION by cg
Claus Gittinger <cg@exept.de>
parents: 22188
diff changeset
  1252
    "set the method's access rights (privacy) from a symbol;
952
d600e08a5936 handle the case where a method has a sourceFileInfo, but the class has not
Claus Gittinger <cg@exept.de>
parents: 934
diff changeset
  1253
     Currently, this must be one of #private, #protected, #public or #ignored.
d600e08a5936 handle the case where a method has a sourceFileInfo, but the class has not
Claus Gittinger <cg@exept.de>
parents: 934
diff changeset
  1254
d600e08a5936 handle the case where a method has a sourceFileInfo, but the class has not
Claus Gittinger <cg@exept.de>
parents: 934
diff changeset
  1255
     Notice: method privacy is a nonstandard feature, not supported
d600e08a5936 handle the case where a method has a sourceFileInfo, but the class has not
Claus Gittinger <cg@exept.de>
parents: 934
diff changeset
  1256
     by other smalltalk implementations and not specified in the ANSI spec.
8518
7dc3f9909640 Interchanged the meaning of method privacy -
Stefan Vogel <sv@exept.de>
parents: 8465
diff changeset
  1257
     If at all, use it for debugging purposes, to catch message sends
952
d600e08a5936 handle the case where a method has a sourceFileInfo, but the class has not
Claus Gittinger <cg@exept.de>
parents: 934
diff changeset
  1258
     which are not supposed to be sent by others.
d600e08a5936 handle the case where a method has a sourceFileInfo, but the class has not
Claus Gittinger <cg@exept.de>
parents: 934
diff changeset
  1259
     (especially, if working in a team, while integrating other peoples work)
d600e08a5936 handle the case where a method has a sourceFileInfo, but the class has not
Claus Gittinger <cg@exept.de>
parents: 934
diff changeset
  1260
d600e08a5936 handle the case where a method has a sourceFileInfo, but the class has not
Claus Gittinger <cg@exept.de>
parents: 934
diff changeset
  1261
     This is EXPERIMENTAL - and being evaluated for usability.
d600e08a5936 handle the case where a method has a sourceFileInfo, but the class has not
Claus Gittinger <cg@exept.de>
parents: 934
diff changeset
  1262
     It may change or even vanish (if it shows to be not useful)."
d600e08a5936 handle the case where a method has a sourceFileInfo, but the class has not
Claus Gittinger <cg@exept.de>
parents: 934
diff changeset
  1263
8526
326e7dcb212a *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 8518
diff changeset
  1264
    |oldPrivacy|
326e7dcb212a *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 8518
diff changeset
  1265
326e7dcb212a *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 8518
diff changeset
  1266
    oldPrivacy := self privacy.
326e7dcb212a *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 8518
diff changeset
  1267
326e7dcb212a *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 8518
diff changeset
  1268
    (self setPrivacy:aSymbol flushCaches:true) ifTrue:[
22372
72db331204d4 #DOCUMENTATION by cg
Claus Gittinger <cg@exept.de>
parents: 22188
diff changeset
  1269
        |myClass mySelector|
72db331204d4 #DOCUMENTATION by cg
Claus Gittinger <cg@exept.de>
parents: 22188
diff changeset
  1270
72db331204d4 #DOCUMENTATION by cg
Claus Gittinger <cg@exept.de>
parents: 22188
diff changeset
  1271
        myClass := self mclass.
72db331204d4 #DOCUMENTATION by cg
Claus Gittinger <cg@exept.de>
parents: 22188
diff changeset
  1272
        mySelector := self selector.
72db331204d4 #DOCUMENTATION by cg
Claus Gittinger <cg@exept.de>
parents: 22188
diff changeset
  1273
72db331204d4 #DOCUMENTATION by cg
Claus Gittinger <cg@exept.de>
parents: 22188
diff changeset
  1274
        self changed:#privacy.                                       "/ will vanish
72db331204d4 #DOCUMENTATION by cg
Claus Gittinger <cg@exept.de>
parents: 22188
diff changeset
  1275
        myClass notNil ifTrue:[
72db331204d4 #DOCUMENTATION by cg
Claus Gittinger <cg@exept.de>
parents: 22188
diff changeset
  1276
            mySelector notNil ifTrue:[
72db331204d4 #DOCUMENTATION by cg
Claus Gittinger <cg@exept.de>
parents: 22188
diff changeset
  1277
                myClass changed:#methodPrivacy with:mySelector.      "/ will vanish
72db331204d4 #DOCUMENTATION by cg
Claus Gittinger <cg@exept.de>
parents: 22188
diff changeset
  1278
                Smalltalk changed:#privacyOfMethod with:(Array with:myClass with:self with:oldPrivacy).
72db331204d4 #DOCUMENTATION by cg
Claus Gittinger <cg@exept.de>
parents: 22188
diff changeset
  1279
                myClass addChangeRecordForMethodPrivacy:self.
72db331204d4 #DOCUMENTATION by cg
Claus Gittinger <cg@exept.de>
parents: 22188
diff changeset
  1280
            ]
72db331204d4 #DOCUMENTATION by cg
Claus Gittinger <cg@exept.de>
parents: 22188
diff changeset
  1281
        ]
3216
e0f3f49118ed Simplify privacy stuff to make redirection from WrappedMethod easier.
Stefan Vogel <sv@exept.de>
parents: 3168
diff changeset
  1282
    ]
10196
f72831ddec29 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10156
diff changeset
  1283
f72831ddec29 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10156
diff changeset
  1284
    "Modified: / 23-11-2006 / 17:03:20 / cg"
22372
72db331204d4 #DOCUMENTATION by cg
Claus Gittinger <cg@exept.de>
parents: 22188
diff changeset
  1285
    "Modified (comment): / 21-11-2017 / 13:05:14 / cg"
952
d600e08a5936 handle the case where a method has a sourceFileInfo, but the class has not
Claus Gittinger <cg@exept.de>
parents: 934
diff changeset
  1286
!
747
ea3b6f7fd7ce added ignoredMethods
Claus Gittinger <cg@exept.de>
parents: 737
diff changeset
  1287
532
2511c99de912 New code to trap restricted (RT) methods.
Stefan Vogel <sv@exept.de>
parents: 530
diff changeset
  1288
restricted:aBoolean
12854
3a3d3c02c3bd *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 12695
diff changeset
  1289
    "set or clear the flag bit stating that this method is restricted.
532
2511c99de912 New code to trap restricted (RT) methods.
Stefan Vogel <sv@exept.de>
parents: 530
diff changeset
  1290
     Execution of the receiver will only be allowed if the system is not in
2511c99de912 New code to trap restricted (RT) methods.
Stefan Vogel <sv@exept.de>
parents: 530
diff changeset
  1291
     'trap restricted mode' (-->ObjectMemory) otherise a runtime
2511c99de912 New code to trap restricted (RT) methods.
Stefan Vogel <sv@exept.de>
parents: 530
diff changeset
  1292
     error (PrivateMethodSignal) is raised.
747
ea3b6f7fd7ce added ignoredMethods
Claus Gittinger <cg@exept.de>
parents: 737
diff changeset
  1293
532
2511c99de912 New code to trap restricted (RT) methods.
Stefan Vogel <sv@exept.de>
parents: 530
diff changeset
  1294
     Notice: method restriction is a nonstandard feature, not supported
2511c99de912 New code to trap restricted (RT) methods.
Stefan Vogel <sv@exept.de>
parents: 530
diff changeset
  1295
     by other smalltalk implementations and not specified in the ANSI spec.
747
ea3b6f7fd7ce added ignoredMethods
Claus Gittinger <cg@exept.de>
parents: 737
diff changeset
  1296
532
2511c99de912 New code to trap restricted (RT) methods.
Stefan Vogel <sv@exept.de>
parents: 530
diff changeset
  1297
     This is EXPERIMENTAL - and being evaluated for usability.
2511c99de912 New code to trap restricted (RT) methods.
Stefan Vogel <sv@exept.de>
parents: 530
diff changeset
  1298
     It may change or even vanish (if it shows to be not useful)."
2511c99de912 New code to trap restricted (RT) methods.
Stefan Vogel <sv@exept.de>
parents: 530
diff changeset
  1299
2511c99de912 New code to trap restricted (RT) methods.
Stefan Vogel <sv@exept.de>
parents: 530
diff changeset
  1300
%{  /* NOCONTEXT */
2511c99de912 New code to trap restricted (RT) methods.
Stefan Vogel <sv@exept.de>
parents: 530
diff changeset
  1301
    /* I made this a primitive to get the define constant from stc.h */
2511c99de912 New code to trap restricted (RT) methods.
Stefan Vogel <sv@exept.de>
parents: 530
diff changeset
  1302
2511c99de912 New code to trap restricted (RT) methods.
Stefan Vogel <sv@exept.de>
parents: 530
diff changeset
  1303
#ifdef F_RESTRICTED
2868
772c890f907c alpha64
Claus Gittinger <cg@exept.de>
parents: 2826
diff changeset
  1304
    INT f = __intVal(__INST(flags));
772c890f907c alpha64
Claus Gittinger <cg@exept.de>
parents: 2826
diff changeset
  1305
    INT old;
532
2511c99de912 New code to trap restricted (RT) methods.
Stefan Vogel <sv@exept.de>
parents: 530
diff changeset
  1306
747
ea3b6f7fd7ce added ignoredMethods
Claus Gittinger <cg@exept.de>
parents: 737
diff changeset
  1307
    old = f;
12854
3a3d3c02c3bd *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 12695
diff changeset
  1308
    if (aBoolean == true)
18620
b4e9f25d6ce6 preparations for lined index list in WeakArray
Claus Gittinger <cg@exept.de>
parents: 18462
diff changeset
  1309
	f |= F_RESTRICTED;
532
2511c99de912 New code to trap restricted (RT) methods.
Stefan Vogel <sv@exept.de>
parents: 530
diff changeset
  1310
    else
18620
b4e9f25d6ce6 preparations for lined index list in WeakArray
Claus Gittinger <cg@exept.de>
parents: 18462
diff changeset
  1311
	f &= ~F_RESTRICTED;
8913
b9498d27a554 64bit; mkSmallInteger
Claus Gittinger <cg@exept.de>
parents: 8896
diff changeset
  1312
    __INST(flags) = __mkSmallInteger(f);
532
2511c99de912 New code to trap restricted (RT) methods.
Stefan Vogel <sv@exept.de>
parents: 530
diff changeset
  1313
    if (old & F_RESTRICTED)
18620
b4e9f25d6ce6 preparations for lined index list in WeakArray
Claus Gittinger <cg@exept.de>
parents: 18462
diff changeset
  1314
	RETURN(true);
532
2511c99de912 New code to trap restricted (RT) methods.
Stefan Vogel <sv@exept.de>
parents: 530
diff changeset
  1315
#endif
2511c99de912 New code to trap restricted (RT) methods.
Stefan Vogel <sv@exept.de>
parents: 530
diff changeset
  1316
%}.
2511c99de912 New code to trap restricted (RT) methods.
Stefan Vogel <sv@exept.de>
parents: 530
diff changeset
  1317
    ^ false
2511c99de912 New code to trap restricted (RT) methods.
Stefan Vogel <sv@exept.de>
parents: 530
diff changeset
  1318
747
ea3b6f7fd7ce added ignoredMethods
Claus Gittinger <cg@exept.de>
parents: 737
diff changeset
  1319
    "
ea3b6f7fd7ce added ignoredMethods
Claus Gittinger <cg@exept.de>
parents: 737
diff changeset
  1320
     (ObjectMemory class compiledMethodAt:#compressingGarbageCollect) restricted:true
ea3b6f7fd7ce added ignoredMethods
Claus Gittinger <cg@exept.de>
parents: 737
diff changeset
  1321
    "
532
2511c99de912 New code to trap restricted (RT) methods.
Stefan Vogel <sv@exept.de>
parents: 530
diff changeset
  1322
2511c99de912 New code to trap restricted (RT) methods.
Stefan Vogel <sv@exept.de>
parents: 530
diff changeset
  1323
    "Created: 7.11.1995 / 20:36:19 / stefan"
2511c99de912 New code to trap restricted (RT) methods.
Stefan Vogel <sv@exept.de>
parents: 530
diff changeset
  1324
!
2511c99de912 New code to trap restricted (RT) methods.
Stefan Vogel <sv@exept.de>
parents: 530
diff changeset
  1325
3216
e0f3f49118ed Simplify privacy stuff to make redirection from WrappedMethod easier.
Stefan Vogel <sv@exept.de>
parents: 3168
diff changeset
  1326
setPrivacy:aSymbol
22372
72db331204d4 #DOCUMENTATION by cg
Claus Gittinger <cg@exept.de>
parents: 22188
diff changeset
  1327
    "set the method's access rights (privacy) from a symbol;
3216
e0f3f49118ed Simplify privacy stuff to make redirection from WrappedMethod easier.
Stefan Vogel <sv@exept.de>
parents: 3168
diff changeset
  1328
     Currently, this must be one of #private, #protected, #public or #ignored.
22372
72db331204d4 #DOCUMENTATION by cg
Claus Gittinger <cg@exept.de>
parents: 22188
diff changeset
  1329
     #setPrivacy: simply sets the attribute. 
72db331204d4 #DOCUMENTATION by cg
Claus Gittinger <cg@exept.de>
parents: 22188
diff changeset
  1330
     When changing methods which have already been called, #privacy: should be used.
952
d600e08a5936 handle the case where a method has a sourceFileInfo, but the class has not
Claus Gittinger <cg@exept.de>
parents: 934
diff changeset
  1331
d600e08a5936 handle the case where a method has a sourceFileInfo, but the class has not
Claus Gittinger <cg@exept.de>
parents: 934
diff changeset
  1332
     Notice: method privacy is a nonstandard feature, not supported
d600e08a5936 handle the case where a method has a sourceFileInfo, but the class has not
Claus Gittinger <cg@exept.de>
parents: 934
diff changeset
  1333
     by other smalltalk implementations and not specified in the ANSI spec.
d600e08a5936 handle the case where a method has a sourceFileInfo, but the class has not
Claus Gittinger <cg@exept.de>
parents: 934
diff changeset
  1334
     If at all, use it for debugging purposes, to catch messagesends
d600e08a5936 handle the case where a method has a sourceFileInfo, but the class has not
Claus Gittinger <cg@exept.de>
parents: 934
diff changeset
  1335
     which are not supposed to be sent by others.
d600e08a5936 handle the case where a method has a sourceFileInfo, but the class has not
Claus Gittinger <cg@exept.de>
parents: 934
diff changeset
  1336
     (especially, if working in a team, while integrating other peoples work)
d600e08a5936 handle the case where a method has a sourceFileInfo, but the class has not
Claus Gittinger <cg@exept.de>
parents: 934
diff changeset
  1337
d600e08a5936 handle the case where a method has a sourceFileInfo, but the class has not
Claus Gittinger <cg@exept.de>
parents: 934
diff changeset
  1338
     This is EXPERIMENTAL - and being evaluated for usability.
d600e08a5936 handle the case where a method has a sourceFileInfo, but the class has not
Claus Gittinger <cg@exept.de>
parents: 934
diff changeset
  1339
     It may change or even vanish (if it shows to be not useful)."
d600e08a5936 handle the case where a method has a sourceFileInfo, but the class has not
Claus Gittinger <cg@exept.de>
parents: 934
diff changeset
  1340
8526
326e7dcb212a *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 8518
diff changeset
  1341
    ^ self setPrivacy:aSymbol flushCaches:true
22372
72db331204d4 #DOCUMENTATION by cg
Claus Gittinger <cg@exept.de>
parents: 22188
diff changeset
  1342
72db331204d4 #DOCUMENTATION by cg
Claus Gittinger <cg@exept.de>
parents: 22188
diff changeset
  1343
    "Modified (comment): / 21-11-2017 / 13:05:54 / cg"
8526
326e7dcb212a *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 8518
diff changeset
  1344
!
326e7dcb212a *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 8518
diff changeset
  1345
326e7dcb212a *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 8518
diff changeset
  1346
setPrivacy:aSymbol flushCaches:doFlush
17526
cbad04a94bb2 class: Method
Claus Gittinger <cg@exept.de>
parents: 17515
diff changeset
  1347
    "set the method's access rights (privacy) from a symbol;
8526
326e7dcb212a *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 8518
diff changeset
  1348
     Currently, this must be one of #private, #protected, #public or #ignored.
12854
3a3d3c02c3bd *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 12695
diff changeset
  1349
     #setPrivacy: simply sets the attribute. When changing methods, that
8526
326e7dcb212a *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 8518
diff changeset
  1350
     have already been called, #privacy: should be used.
326e7dcb212a *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 8518
diff changeset
  1351
326e7dcb212a *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 8518
diff changeset
  1352
     Notice: method privacy is a nonstandard feature, not supported
17526
cbad04a94bb2 class: Method
Claus Gittinger <cg@exept.de>
parents: 17515
diff changeset
  1353
     by other Smalltalk implementations and not specified in the ANSI spec.
cbad04a94bb2 class: Method
Claus Gittinger <cg@exept.de>
parents: 17515
diff changeset
  1354
     If at all, use it for debugging purposes, to catch message sends
8526
326e7dcb212a *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 8518
diff changeset
  1355
     which are not supposed to be sent by others.
326e7dcb212a *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 8518
diff changeset
  1356
     (especially, if working in a team, while integrating other peoples work)
326e7dcb212a *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 8518
diff changeset
  1357
326e7dcb212a *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 8518
diff changeset
  1358
     This is EXPERIMENTAL - and being evaluated for usability.
326e7dcb212a *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 8518
diff changeset
  1359
     It may change or even vanish (if it shows to be not useful)."
326e7dcb212a *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 8518
diff changeset
  1360
326e7dcb212a *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 8518
diff changeset
  1361
    |old sel|
326e7dcb212a *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 8518
diff changeset
  1362
326e7dcb212a *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 8518
diff changeset
  1363
    old := self privacy.
326e7dcb212a *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 8518
diff changeset
  1364
    old == aSymbol ifTrue:[^ false].
326e7dcb212a *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 8518
diff changeset
  1365
    (self primSetPrivacy:aSymbol) ifFalse:[^ false].
326e7dcb212a *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 8518
diff changeset
  1366
326e7dcb212a *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 8518
diff changeset
  1367
    "/
326e7dcb212a *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 8518
diff changeset
  1368
    "/ no need to flush, if changing from private to public
326e7dcb212a *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 8518
diff changeset
  1369
    "/
326e7dcb212a *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 8518
diff changeset
  1370
    doFlush ifTrue:[
18620
b4e9f25d6ce6 preparations for lined index list in WeakArray
Claus Gittinger <cg@exept.de>
parents: 18462
diff changeset
  1371
	(aSymbol == #public and:[old ~~ #ignored]) ifFalse:[
b4e9f25d6ce6 preparations for lined index list in WeakArray
Claus Gittinger <cg@exept.de>
parents: 18462
diff changeset
  1372
	    (sel := self selector) notNil ifTrue:[
b4e9f25d6ce6 preparations for lined index list in WeakArray
Claus Gittinger <cg@exept.de>
parents: 18462
diff changeset
  1373
		ObjectMemory flushCachesForSelector:sel numArgs:self argumentCount
b4e9f25d6ce6 preparations for lined index list in WeakArray
Claus Gittinger <cg@exept.de>
parents: 18462
diff changeset
  1374
	    ] ifFalse:[
b4e9f25d6ce6 preparations for lined index list in WeakArray
Claus Gittinger <cg@exept.de>
parents: 18462
diff changeset
  1375
		ObjectMemory flushCaches.
b4e9f25d6ce6 preparations for lined index list in WeakArray
Claus Gittinger <cg@exept.de>
parents: 18462
diff changeset
  1376
	    ].
b4e9f25d6ce6 preparations for lined index list in WeakArray
Claus Gittinger <cg@exept.de>
parents: 18462
diff changeset
  1377
	].
8526
326e7dcb212a *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 8518
diff changeset
  1378
    ].
3216
e0f3f49118ed Simplify privacy stuff to make redirection from WrappedMethod easier.
Stefan Vogel <sv@exept.de>
parents: 3168
diff changeset
  1379
    ^ true
1
a27a279701f8 Initial revision
claus
parents:
diff changeset
  1380
! !
a27a279701f8 Initial revision
claus
parents:
diff changeset
  1381
952
d600e08a5936 handle the case where a method has a sourceFileInfo, but the class has not
Claus Gittinger <cg@exept.de>
parents: 934
diff changeset
  1382
!Method methodsFor:'binary storage'!
d600e08a5936 handle the case where a method has a sourceFileInfo, but the class has not
Claus Gittinger <cg@exept.de>
parents: 934
diff changeset
  1383
d600e08a5936 handle the case where a method has a sourceFileInfo, but the class has not
Claus Gittinger <cg@exept.de>
parents: 934
diff changeset
  1384
asByteCodeMethod
d600e08a5936 handle the case where a method has a sourceFileInfo, but the class has not
Claus Gittinger <cg@exept.de>
parents: 934
diff changeset
  1385
    "if the receiver has no bytecodes, create & return a method having
d600e08a5936 handle the case where a method has a sourceFileInfo, but the class has not
Claus Gittinger <cg@exept.de>
parents: 934
diff changeset
  1386
     the same semantics as the receiver, but uses interpreted bytecodes.
d600e08a5936 handle the case where a method has a sourceFileInfo, but the class has not
Claus Gittinger <cg@exept.de>
parents: 934
diff changeset
  1387
     Otherwise, return the receiver. The new method is not installed in
d600e08a5936 handle the case where a method has a sourceFileInfo, but the class has not
Claus Gittinger <cg@exept.de>
parents: 934
diff changeset
  1388
     the methodDictionary of any class - just returned.
2064
68b185fbddb6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 2063
diff changeset
  1389
     If the method contains primitive code, this may return a method
68b185fbddb6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 2063
diff changeset
  1390
     without bytecode.
12854
3a3d3c02c3bd *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 12695
diff changeset
  1391
     Can be used to obtain a bytecode version of a machine-code method,
952
d600e08a5936 handle the case where a method has a sourceFileInfo, but the class has not
Claus Gittinger <cg@exept.de>
parents: 934
diff changeset
  1392
     for binary storage or dynamic recompilation (which is not yet finished)
d600e08a5936 handle the case where a method has a sourceFileInfo, but the class has not
Claus Gittinger <cg@exept.de>
parents: 934
diff changeset
  1393
     or to compile lazy methods down to executable ones."
d600e08a5936 handle the case where a method has a sourceFileInfo, but the class has not
Claus Gittinger <cg@exept.de>
parents: 934
diff changeset
  1394
9096
84df3b129718 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9075
diff changeset
  1395
    |mthd|
1
a27a279701f8 Initial revision
claus
parents:
diff changeset
  1396
952
d600e08a5936 handle the case where a method has a sourceFileInfo, but the class has not
Claus Gittinger <cg@exept.de>
parents: 934
diff changeset
  1397
    byteCode notNil ifTrue:[
18620
b4e9f25d6ce6 preparations for lined index list in WeakArray
Claus Gittinger <cg@exept.de>
parents: 18462
diff changeset
  1398
	"
b4e9f25d6ce6 preparations for lined index list in WeakArray
Claus Gittinger <cg@exept.de>
parents: 18462
diff changeset
  1399
	 is already a bytecoded method
b4e9f25d6ce6 preparations for lined index list in WeakArray
Claus Gittinger <cg@exept.de>
parents: 18462
diff changeset
  1400
	"
b4e9f25d6ce6 preparations for lined index list in WeakArray
Claus Gittinger <cg@exept.de>
parents: 18462
diff changeset
  1401
	^ self
952
d600e08a5936 handle the case where a method has a sourceFileInfo, but the class has not
Claus Gittinger <cg@exept.de>
parents: 934
diff changeset
  1402
    ].
9096
84df3b129718 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9075
diff changeset
  1403
84df3b129718 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9075
diff changeset
  1404
    ParserFlags
18620
b4e9f25d6ce6 preparations for lined index list in WeakArray
Claus Gittinger <cg@exept.de>
parents: 18462
diff changeset
  1405
	withSTCCompilation:#never
b4e9f25d6ce6 preparations for lined index list in WeakArray
Claus Gittinger <cg@exept.de>
parents: 18462
diff changeset
  1406
	do:[
b4e9f25d6ce6 preparations for lined index list in WeakArray
Claus Gittinger <cg@exept.de>
parents: 18462
diff changeset
  1407
	    mthd := self asExecutableMethod.
b4e9f25d6ce6 preparations for lined index list in WeakArray
Claus Gittinger <cg@exept.de>
parents: 18462
diff changeset
  1408
	].
952
d600e08a5936 handle the case where a method has a sourceFileInfo, but the class has not
Claus Gittinger <cg@exept.de>
parents: 934
diff changeset
  1409
    ^ mthd
68
59faa75185ba *** empty log message ***
claus
parents: 56
diff changeset
  1410
952
d600e08a5936 handle the case where a method has a sourceFileInfo, but the class has not
Claus Gittinger <cg@exept.de>
parents: 934
diff changeset
  1411
    "Created: 24.10.1995 / 14:02:32 / cg"
2064
68b185fbddb6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 2063
diff changeset
  1412
    "Modified: 5.1.1997 / 01:01:53 / cg"
952
d600e08a5936 handle the case where a method has a sourceFileInfo, but the class has not
Claus Gittinger <cg@exept.de>
parents: 934
diff changeset
  1413
!
306
365e65400c93 *** empty log message ***
claus
parents: 302
diff changeset
  1414
5405
f07c8045ab4e *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5398
diff changeset
  1415
asByteCodeMethodWithSource:newSource
9096
84df3b129718 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9075
diff changeset
  1416
    |mthd|
84df3b129718 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9075
diff changeset
  1417
12854
3a3d3c02c3bd *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 12695
diff changeset
  1418
    ParserFlags
18620
b4e9f25d6ce6 preparations for lined index list in WeakArray
Claus Gittinger <cg@exept.de>
parents: 18462
diff changeset
  1419
	withSTCCompilation:#never
b4e9f25d6ce6 preparations for lined index list in WeakArray
Claus Gittinger <cg@exept.de>
parents: 18462
diff changeset
  1420
	do:[
b4e9f25d6ce6 preparations for lined index list in WeakArray
Claus Gittinger <cg@exept.de>
parents: 18462
diff changeset
  1421
	    mthd := self asExecutableMethodWithSource:newSource.
b4e9f25d6ce6 preparations for lined index list in WeakArray
Claus Gittinger <cg@exept.de>
parents: 18462
diff changeset
  1422
	].
5405
f07c8045ab4e *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5398
diff changeset
  1423
    ^ mthd
f07c8045ab4e *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5398
diff changeset
  1424
f07c8045ab4e *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5398
diff changeset
  1425
    "Created: 24.10.1995 / 14:02:32 / cg"
f07c8045ab4e *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5398
diff changeset
  1426
    "Modified: 5.1.1997 / 01:01:53 / cg"
f07c8045ab4e *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5398
diff changeset
  1427
!
f07c8045ab4e *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5398
diff changeset
  1428
952
d600e08a5936 handle the case where a method has a sourceFileInfo, but the class has not
Claus Gittinger <cg@exept.de>
parents: 934
diff changeset
  1429
asExecutableMethod
12854
3a3d3c02c3bd *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 12695
diff changeset
  1430
    "if the receiver has neither bytecodes nor machinecode, create & return a
19449
607eb2e0e46c #DOCUMENTATION
Claus Gittinger <cg@exept.de>
parents: 19025
diff changeset
  1431
     method having semantics as the receiver's source. This may be machine code,
952
d600e08a5936 handle the case where a method has a sourceFileInfo, but the class has not
Claus Gittinger <cg@exept.de>
parents: 934
diff changeset
  1432
     if the system supports dynamic loading of object code and the source includes
d600e08a5936 handle the case where a method has a sourceFileInfo, but the class has not
Claus Gittinger <cg@exept.de>
parents: 934
diff changeset
  1433
     primitive code. However, bytecode is preferred, since it compiles faster.
d600e08a5936 handle the case where a method has a sourceFileInfo, but the class has not
Claus Gittinger <cg@exept.de>
parents: 934
diff changeset
  1434
     Otherwise, return the receiver. The new method is not installed in
d600e08a5936 handle the case where a method has a sourceFileInfo, but the class has not
Claus Gittinger <cg@exept.de>
parents: 934
diff changeset
  1435
     the methodDictionary of any class - just returned.
d600e08a5936 handle the case where a method has a sourceFileInfo, but the class has not
Claus Gittinger <cg@exept.de>
parents: 934
diff changeset
  1436
     Can be used to compile lazy methods down to executable ones."
d600e08a5936 handle the case where a method has a sourceFileInfo, but the class has not
Claus Gittinger <cg@exept.de>
parents: 934
diff changeset
  1437
5700
ee59aff043c4 asExecutableMethod / asExecutableMethodWith: - code reuse
Claus Gittinger <cg@exept.de>
parents: 5696
diff changeset
  1438
    |temporaryMethod sourceString|
306
365e65400c93 *** empty log message ***
claus
parents: 302
diff changeset
  1439
952
d600e08a5936 handle the case where a method has a sourceFileInfo, but the class has not
Claus Gittinger <cg@exept.de>
parents: 934
diff changeset
  1440
    byteCode notNil ifTrue:[
19449
607eb2e0e46c #DOCUMENTATION
Claus Gittinger <cg@exept.de>
parents: 19025
diff changeset
  1441
        "
607eb2e0e46c #DOCUMENTATION
Claus Gittinger <cg@exept.de>
parents: 19025
diff changeset
  1442
         is already a bytecoded method
607eb2e0e46c #DOCUMENTATION
Claus Gittinger <cg@exept.de>
parents: 19025
diff changeset
  1443
        "
607eb2e0e46c #DOCUMENTATION
Claus Gittinger <cg@exept.de>
parents: 19025
diff changeset
  1444
        ^ self
5700
ee59aff043c4 asExecutableMethod / asExecutableMethodWith: - code reuse
Claus Gittinger <cg@exept.de>
parents: 5696
diff changeset
  1445
    ].
ee59aff043c4 asExecutableMethod / asExecutableMethodWith: - code reuse
Claus Gittinger <cg@exept.de>
parents: 5696
diff changeset
  1446
ee59aff043c4 asExecutableMethod / asExecutableMethodWith: - code reuse
Claus Gittinger <cg@exept.de>
parents: 5696
diff changeset
  1447
    sourceString := self source.
ee59aff043c4 asExecutableMethod / asExecutableMethodWith: - code reuse
Claus Gittinger <cg@exept.de>
parents: 5696
diff changeset
  1448
    sourceString isNil ifTrue:[
19449
607eb2e0e46c #DOCUMENTATION
Claus Gittinger <cg@exept.de>
parents: 19025
diff changeset
  1449
        'Method [warning]: cannot generate bytecode (no source for compilation)' errorPrintCR.
607eb2e0e46c #DOCUMENTATION
Claus Gittinger <cg@exept.de>
parents: 19025
diff changeset
  1450
        ^ nil
952
d600e08a5936 handle the case where a method has a sourceFileInfo, but the class has not
Claus Gittinger <cg@exept.de>
parents: 934
diff changeset
  1451
    ].
d600e08a5936 handle the case where a method has a sourceFileInfo, but the class has not
Claus Gittinger <cg@exept.de>
parents: 934
diff changeset
  1452
5700
ee59aff043c4 asExecutableMethod / asExecutableMethodWith: - code reuse
Claus Gittinger <cg@exept.de>
parents: 5696
diff changeset
  1453
    temporaryMethod := self asExecutableMethodWithSource:sourceString.
ee59aff043c4 asExecutableMethod / asExecutableMethodWith: - code reuse
Claus Gittinger <cg@exept.de>
parents: 5696
diff changeset
  1454
ee59aff043c4 asExecutableMethod / asExecutableMethodWith: - code reuse
Claus Gittinger <cg@exept.de>
parents: 5696
diff changeset
  1455
    (temporaryMethod isNil or:[temporaryMethod == #Error]) ifTrue:[
19449
607eb2e0e46c #DOCUMENTATION
Claus Gittinger <cg@exept.de>
parents: 19025
diff changeset
  1456
        'Method [warning]: cannot generate bytecode (contains primitive code or error)' errorPrintCR.
607eb2e0e46c #DOCUMENTATION
Claus Gittinger <cg@exept.de>
parents: 19025
diff changeset
  1457
        ^ nil.
5700
ee59aff043c4 asExecutableMethod / asExecutableMethodWith: - code reuse
Claus Gittinger <cg@exept.de>
parents: 5696
diff changeset
  1458
    ].
ee59aff043c4 asExecutableMethod / asExecutableMethodWith: - code reuse
Claus Gittinger <cg@exept.de>
parents: 5696
diff changeset
  1459
    "/
ee59aff043c4 asExecutableMethod / asExecutableMethodWith: - code reuse
Claus Gittinger <cg@exept.de>
parents: 5696
diff changeset
  1460
    "/ try to save a bit of memory, by sharing the source (whatever it is)
ee59aff043c4 asExecutableMethod / asExecutableMethodWith: - code reuse
Claus Gittinger <cg@exept.de>
parents: 5696
diff changeset
  1461
    "/
12854
3a3d3c02c3bd *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 12695
diff changeset
  1462
    temporaryMethod sourceFilename:source position:sourcePosition.
5700
ee59aff043c4 asExecutableMethod / asExecutableMethodWith: - code reuse
Claus Gittinger <cg@exept.de>
parents: 5696
diff changeset
  1463
    ^ temporaryMethod
ee59aff043c4 asExecutableMethod / asExecutableMethodWith: - code reuse
Claus Gittinger <cg@exept.de>
parents: 5696
diff changeset
  1464
!
ee59aff043c4 asExecutableMethod / asExecutableMethodWith: - code reuse
Claus Gittinger <cg@exept.de>
parents: 5696
diff changeset
  1465
ee59aff043c4 asExecutableMethod / asExecutableMethodWith: - code reuse
Claus Gittinger <cg@exept.de>
parents: 5696
diff changeset
  1466
asExecutableMethodWithSource:newSource
ee59aff043c4 asExecutableMethod / asExecutableMethodWith: - code reuse
Claus Gittinger <cg@exept.de>
parents: 5696
diff changeset
  1467
    |temporaryMethod cls|
ee59aff043c4 asExecutableMethod / asExecutableMethodWith: - code reuse
Claus Gittinger <cg@exept.de>
parents: 5696
diff changeset
  1468
952
d600e08a5936 handle the case where a method has a sourceFileInfo, but the class has not
Claus Gittinger <cg@exept.de>
parents: 934
diff changeset
  1469
    cls := self containingClass.
d600e08a5936 handle the case where a method has a sourceFileInfo, but the class has not
Claus Gittinger <cg@exept.de>
parents: 934
diff changeset
  1470
    cls isNil ifTrue:[
20804
8fc0aa10c3a8 #DOCUMENTATION by cg
Claus Gittinger <cg@exept.de>
parents: 20683
diff changeset
  1471
        'Method [warning]: cannot generate bytecode (no class for compilation)' errorPrintCR.
8fc0aa10c3a8 #DOCUMENTATION by cg
Claus Gittinger <cg@exept.de>
parents: 20683
diff changeset
  1472
        ^ nil
306
365e65400c93 *** empty log message ***
claus
parents: 302
diff changeset
  1473
    ].
1
a27a279701f8 Initial revision
claus
parents:
diff changeset
  1474
4290
5e43473d7a35 moved recompilation semaphore from LazyMethod to Method
Claus Gittinger <cg@exept.de>
parents: 4015
diff changeset
  1475
    "we have to sequentialize this using a lock-semaphore,
5e43473d7a35 moved recompilation semaphore from LazyMethod to Method
Claus Gittinger <cg@exept.de>
parents: 4015
diff changeset
  1476
     to make sure only one method is compiled at a time.
5e43473d7a35 moved recompilation semaphore from LazyMethod to Method
Claus Gittinger <cg@exept.de>
parents: 4015
diff changeset
  1477
     Otherwise, we might get into trouble, if (due to a timeout)
5e43473d7a35 moved recompilation semaphore from LazyMethod to Method
Claus Gittinger <cg@exept.de>
parents: 4015
diff changeset
  1478
     another recompile is forced while compiling this one ...
5e43473d7a35 moved recompilation semaphore from LazyMethod to Method
Claus Gittinger <cg@exept.de>
parents: 4015
diff changeset
  1479
     (happened when autoloading animation demos)
176
48061f8659aa more queries
claus
parents: 159
diff changeset
  1480
    "
4290
5e43473d7a35 moved recompilation semaphore from LazyMethod to Method
Claus Gittinger <cg@exept.de>
parents: 4015
diff changeset
  1481
    CompilationLock critical:[
20804
8fc0aa10c3a8 #DOCUMENTATION by cg
Claus Gittinger <cg@exept.de>
parents: 20683
diff changeset
  1482
        "
8fc0aa10c3a8 #DOCUMENTATION by cg
Claus Gittinger <cg@exept.de>
parents: 20683
diff changeset
  1483
         don't want this to go into the changes file,
8fc0aa10c3a8 #DOCUMENTATION by cg
Claus Gittinger <cg@exept.de>
parents: 20683
diff changeset
  1484
         don't want output on Transcript and definitely
8fc0aa10c3a8 #DOCUMENTATION by cg
Claus Gittinger <cg@exept.de>
parents: 20683
diff changeset
  1485
         don't want a lazy method ...
8fc0aa10c3a8 #DOCUMENTATION by cg
Claus Gittinger <cg@exept.de>
parents: 20683
diff changeset
  1486
        "
8fc0aa10c3a8 #DOCUMENTATION by cg
Claus Gittinger <cg@exept.de>
parents: 20683
diff changeset
  1487
        Class withoutUpdatingChangesDo:[
8fc0aa10c3a8 #DOCUMENTATION by cg
Claus Gittinger <cg@exept.de>
parents: 20683
diff changeset
  1488
            |silent lazy|
8fc0aa10c3a8 #DOCUMENTATION by cg
Claus Gittinger <cg@exept.de>
parents: 20683
diff changeset
  1489
8fc0aa10c3a8 #DOCUMENTATION by cg
Claus Gittinger <cg@exept.de>
parents: 20683
diff changeset
  1490
            silent := Smalltalk silentLoading:true.
8fc0aa10c3a8 #DOCUMENTATION by cg
Claus Gittinger <cg@exept.de>
parents: 20683
diff changeset
  1491
            lazy := Compiler compileLazy:false.
8fc0aa10c3a8 #DOCUMENTATION by cg
Claus Gittinger <cg@exept.de>
parents: 20683
diff changeset
  1492
8fc0aa10c3a8 #DOCUMENTATION by cg
Claus Gittinger <cg@exept.de>
parents: 20683
diff changeset
  1493
            [
8fc0aa10c3a8 #DOCUMENTATION by cg
Claus Gittinger <cg@exept.de>
parents: 20683
diff changeset
  1494
                |compiler|
8fc0aa10c3a8 #DOCUMENTATION by cg
Claus Gittinger <cg@exept.de>
parents: 20683
diff changeset
  1495
8fc0aa10c3a8 #DOCUMENTATION by cg
Claus Gittinger <cg@exept.de>
parents: 20683
diff changeset
  1496
                Class nameSpaceQuerySignal answer:(cls nameSpace)
8fc0aa10c3a8 #DOCUMENTATION by cg
Claus Gittinger <cg@exept.de>
parents: 20683
diff changeset
  1497
                do:[
8fc0aa10c3a8 #DOCUMENTATION by cg
Claus Gittinger <cg@exept.de>
parents: 20683
diff changeset
  1498
                    compiler := cls compilerClass.
8fc0aa10c3a8 #DOCUMENTATION by cg
Claus Gittinger <cg@exept.de>
parents: 20683
diff changeset
  1499
8fc0aa10c3a8 #DOCUMENTATION by cg
Claus Gittinger <cg@exept.de>
parents: 20683
diff changeset
  1500
                    "/
8fc0aa10c3a8 #DOCUMENTATION by cg
Claus Gittinger <cg@exept.de>
parents: 20683
diff changeset
  1501
                    "/ kludge - have to make ST/X's compiler protocol
8fc0aa10c3a8 #DOCUMENTATION by cg
Claus Gittinger <cg@exept.de>
parents: 20683
diff changeset
  1502
                    "/ be compatible to ST-80's
8fc0aa10c3a8 #DOCUMENTATION by cg
Claus Gittinger <cg@exept.de>
parents: 20683
diff changeset
  1503
                    "/
8fc0aa10c3a8 #DOCUMENTATION by cg
Claus Gittinger <cg@exept.de>
parents: 20683
diff changeset
  1504
                    (compiler respondsTo:#compile:forClass:inCategory:notifying:install:)
8fc0aa10c3a8 #DOCUMENTATION by cg
Claus Gittinger <cg@exept.de>
parents: 20683
diff changeset
  1505
                    ifTrue:[
8fc0aa10c3a8 #DOCUMENTATION by cg
Claus Gittinger <cg@exept.de>
parents: 20683
diff changeset
  1506
                        temporaryMethod := compiler
8fc0aa10c3a8 #DOCUMENTATION by cg
Claus Gittinger <cg@exept.de>
parents: 20683
diff changeset
  1507
                                             compile:newSource
8fc0aa10c3a8 #DOCUMENTATION by cg
Claus Gittinger <cg@exept.de>
parents: 20683
diff changeset
  1508
                                             forClass:cls
8fc0aa10c3a8 #DOCUMENTATION by cg
Claus Gittinger <cg@exept.de>
parents: 20683
diff changeset
  1509
                                             inCategory:(self category)
8fc0aa10c3a8 #DOCUMENTATION by cg
Claus Gittinger <cg@exept.de>
parents: 20683
diff changeset
  1510
                                             notifying:nil
8fc0aa10c3a8 #DOCUMENTATION by cg
Claus Gittinger <cg@exept.de>
parents: 20683
diff changeset
  1511
                                             install:false.
8fc0aa10c3a8 #DOCUMENTATION by cg
Claus Gittinger <cg@exept.de>
parents: 20683
diff changeset
  1512
                    ] ifFalse:[
8fc0aa10c3a8 #DOCUMENTATION by cg
Claus Gittinger <cg@exept.de>
parents: 20683
diff changeset
  1513
                        temporaryMethod := compiler new
8fc0aa10c3a8 #DOCUMENTATION by cg
Claus Gittinger <cg@exept.de>
parents: 20683
diff changeset
  1514
                                             compile:newSource
8fc0aa10c3a8 #DOCUMENTATION by cg
Claus Gittinger <cg@exept.de>
parents: 20683
diff changeset
  1515
                                             in:cls
8fc0aa10c3a8 #DOCUMENTATION by cg
Claus Gittinger <cg@exept.de>
parents: 20683
diff changeset
  1516
                                             notifying:nil
8fc0aa10c3a8 #DOCUMENTATION by cg
Claus Gittinger <cg@exept.de>
parents: 20683
diff changeset
  1517
                                             ifFail:nil
8fc0aa10c3a8 #DOCUMENTATION by cg
Claus Gittinger <cg@exept.de>
parents: 20683
diff changeset
  1518
                    ].
8fc0aa10c3a8 #DOCUMENTATION by cg
Claus Gittinger <cg@exept.de>
parents: 20683
diff changeset
  1519
                ].
8fc0aa10c3a8 #DOCUMENTATION by cg
Claus Gittinger <cg@exept.de>
parents: 20683
diff changeset
  1520
            ] ensure:[
8fc0aa10c3a8 #DOCUMENTATION by cg
Claus Gittinger <cg@exept.de>
parents: 20683
diff changeset
  1521
                Compiler compileLazy:lazy.
8fc0aa10c3a8 #DOCUMENTATION by cg
Claus Gittinger <cg@exept.de>
parents: 20683
diff changeset
  1522
                Smalltalk silentLoading:silent.
8fc0aa10c3a8 #DOCUMENTATION by cg
Claus Gittinger <cg@exept.de>
parents: 20683
diff changeset
  1523
            ]
8fc0aa10c3a8 #DOCUMENTATION by cg
Claus Gittinger <cg@exept.de>
parents: 20683
diff changeset
  1524
        ].
463
447ead9f870c be silent on transcript when parsing for args, vars and primitiveCode
Claus Gittinger <cg@exept.de>
parents: 444
diff changeset
  1525
    ].
952
d600e08a5936 handle the case where a method has a sourceFileInfo, but the class has not
Claus Gittinger <cg@exept.de>
parents: 934
diff changeset
  1526
    (temporaryMethod isNil or:[temporaryMethod == #Error]) ifTrue:[
20804
8fc0aa10c3a8 #DOCUMENTATION by cg
Claus Gittinger <cg@exept.de>
parents: 20683
diff changeset
  1527
        'Method [warning]: cannot generate bytecode (contains primitive code or error)' errorPrintCR.
8fc0aa10c3a8 #DOCUMENTATION by cg
Claus Gittinger <cg@exept.de>
parents: 20683
diff changeset
  1528
        ^ nil.
5405
f07c8045ab4e *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5398
diff changeset
  1529
    ].
f07c8045ab4e *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5398
diff changeset
  1530
    "/
f07c8045ab4e *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5398
diff changeset
  1531
    "/ try to save a bit of memory, by sharing the source (whatever it is)
f07c8045ab4e *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5398
diff changeset
  1532
    "/
12854
3a3d3c02c3bd *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 12695
diff changeset
  1533
    temporaryMethod source:newSource.
5405
f07c8045ab4e *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5398
diff changeset
  1534
    "/
22372
72db331204d4 #DOCUMENTATION by cg
Claus Gittinger <cg@exept.de>
parents: 22188
diff changeset
  1535
    "/ don't forget the method's class & package ...
5405
f07c8045ab4e *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5398
diff changeset
  1536
    "/
f07c8045ab4e *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5398
diff changeset
  1537
    temporaryMethod setPackage:package.
17250
a0d78c57d994 class: Method
Claus Gittinger <cg@exept.de>
parents: 17175
diff changeset
  1538
    temporaryMethod mclass:(self getMclass).
5405
f07c8045ab4e *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5398
diff changeset
  1539
    ^ temporaryMethod
22372
72db331204d4 #DOCUMENTATION by cg
Claus Gittinger <cg@exept.de>
parents: 22188
diff changeset
  1540
72db331204d4 #DOCUMENTATION by cg
Claus Gittinger <cg@exept.de>
parents: 22188
diff changeset
  1541
    "Modified (comment): / 21-11-2017 / 13:03:45 / cg"
1
a27a279701f8 Initial revision
claus
parents:
diff changeset
  1542
! !
a27a279701f8 Initial revision
claus
parents:
diff changeset
  1543
952
d600e08a5936 handle the case where a method has a sourceFileInfo, but the class has not
Claus Gittinger <cg@exept.de>
parents: 934
diff changeset
  1544
!Method methodsFor:'copying'!
438
claus
parents: 423
diff changeset
  1545
952
d600e08a5936 handle the case where a method has a sourceFileInfo, but the class has not
Claus Gittinger <cg@exept.de>
parents: 934
diff changeset
  1546
copy
2176
1a24b0cef25a when compressing sources, make certain to avoid later
Claus Gittinger <cg@exept.de>
parents: 2171
diff changeset
  1547
    "redefined to change a source ref into a real string"
438
claus
parents: 423
diff changeset
  1548
952
d600e08a5936 handle the case where a method has a sourceFileInfo, but the class has not
Claus Gittinger <cg@exept.de>
parents: 934
diff changeset
  1549
    |aCopy|
438
claus
parents: 423
diff changeset
  1550
952
d600e08a5936 handle the case where a method has a sourceFileInfo, but the class has not
Claus Gittinger <cg@exept.de>
parents: 934
diff changeset
  1551
    aCopy := super copy.
d600e08a5936 handle the case where a method has a sourceFileInfo, but the class has not
Claus Gittinger <cg@exept.de>
parents: 934
diff changeset
  1552
    sourcePosition notNil ifTrue:[
18620
b4e9f25d6ce6 preparations for lined index list in WeakArray
Claus Gittinger <cg@exept.de>
parents: 18462
diff changeset
  1553
	aCopy source:(self source)
952
d600e08a5936 handle the case where a method has a sourceFileInfo, but the class has not
Claus Gittinger <cg@exept.de>
parents: 934
diff changeset
  1554
    ].
5676
db728e9fe276 must flush cached mclass, when copying methods around
src
parents: 5665
diff changeset
  1555
    aCopy mclass:nil.
952
d600e08a5936 handle the case where a method has a sourceFileInfo, but the class has not
Claus Gittinger <cg@exept.de>
parents: 934
diff changeset
  1556
    ^ aCopy
2176
1a24b0cef25a when compressing sources, make certain to avoid later
Claus Gittinger <cg@exept.de>
parents: 2171
diff changeset
  1557
5696
958a0643496d compatibility
Claus Gittinger <cg@exept.de>
parents: 5676
diff changeset
  1558
    "Modified: 16.1.1997 / 01:27:25 / cg"
958a0643496d compatibility
Claus Gittinger <cg@exept.de>
parents: 5676
diff changeset
  1559
! !
438
claus
parents: 423
diff changeset
  1560
1
a27a279701f8 Initial revision
claus
parents:
diff changeset
  1561
!Method methodsFor:'error handling'!
a27a279701f8 Initial revision
claus
parents:
diff changeset
  1562
328
claus
parents: 326
diff changeset
  1563
invalidCodeObject
1873
3544a4a94a2a checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1870
diff changeset
  1564
    "{ Pragma: +optSpace }"
3544a4a94a2a checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1870
diff changeset
  1565
93
e31220cb391f *** empty log message ***
claus
parents: 88
diff changeset
  1566
    "this method is triggered by the interpreter when a nil or non method
e31220cb391f *** empty log message ***
claus
parents: 88
diff changeset
  1567
     is about to be executed.
e31220cb391f *** empty log message ***
claus
parents: 88
diff changeset
  1568
     In this case, the VM sends this to the bad method (the receiver).
e31220cb391f *** empty log message ***
claus
parents: 88
diff changeset
  1569
e31220cb391f *** empty log message ***
claus
parents: 88
diff changeset
  1570
     Also, the Compiler creates methods with their code/bytecode set to
e31220cb391f *** empty log message ***
claus
parents: 88
diff changeset
  1571
     this method if - after a class change - a method cannot be compiled
e31220cb391f *** empty log message ***
claus
parents: 88
diff changeset
  1572
     and is therefore no longer executable (for example, after an instvar
68
59faa75185ba *** empty log message ***
claus
parents: 56
diff changeset
  1573
     has been removed, and a method still tries to access this instvar)
44
b262907c93ea *** empty log message ***
claus
parents: 42
diff changeset
  1574
93
e31220cb391f *** empty log message ***
claus
parents: 88
diff changeset
  1575
     Thus, we arrive here, when playing around in a classes methodArray,
12854
3a3d3c02c3bd *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 12695
diff changeset
  1576
     or compiler/runtime system is broken :-(,
93
e31220cb391f *** empty log message ***
claus
parents: 88
diff changeset
  1577
     or you ignore the error messages during some recompile."
1
a27a279701f8 Initial revision
claus
parents:
diff changeset
  1578
1873
3544a4a94a2a checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1870
diff changeset
  1579
%{
3544a4a94a2a checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1870
diff changeset
  1580
    /*
3544a4a94a2a checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1870
diff changeset
  1581
     * for reasons too far from being explained here,
3544a4a94a2a checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1870
diff changeset
  1582
     * this MUST be a compiled method
3544a4a94a2a checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1870
diff changeset
  1583
     */
3544a4a94a2a checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1870
diff changeset
  1584
%}.
7601
57c257f1150a Fix race when accessing source
Stefan Vogel <sv@exept.de>
parents: 7457
diff changeset
  1585
    ^ InvalidCodeError
18620
b4e9f25d6ce6 preparations for lined index list in WeakArray
Claus Gittinger <cg@exept.de>
parents: 18462
diff changeset
  1586
	raiseErrorString:'invalid method - not executable'.
1873
3544a4a94a2a checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1870
diff changeset
  1587
3544a4a94a2a checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1870
diff changeset
  1588
    "Modified: 4.11.1996 / 22:45:06 / cg"
1
a27a279701f8 Initial revision
claus
parents:
diff changeset
  1589
!
a27a279701f8 Initial revision
claus
parents:
diff changeset
  1590
13693
16c890248840 added: #invalidCodeObjectWith:
sr
parents: 13683
diff changeset
  1591
invalidCodeObjectWith:arg
16c890248840 added: #invalidCodeObjectWith:
sr
parents: 13683
diff changeset
  1592
    "{ Pragma: +optSpace }"
16c890248840 added: #invalidCodeObjectWith:
sr
parents: 13683
diff changeset
  1593
16c890248840 added: #invalidCodeObjectWith:
sr
parents: 13683
diff changeset
  1594
    "When recompiling classes after a definition-change, all
16c890248840 added: #invalidCodeObjectWith:
sr
parents: 13683
diff changeset
  1595
     uncompilable methods (with 2 args) will be bound to this method here,
16c890248840 added: #invalidCodeObjectWith:
sr
parents: 13683
diff changeset
  1596
     so that evaluating such an uncompilable method will trigger an error."
16c890248840 added: #invalidCodeObjectWith:
sr
parents: 13683
diff changeset
  1597
16c890248840 added: #invalidCodeObjectWith:
sr
parents: 13683
diff changeset
  1598
%{
16c890248840 added: #invalidCodeObjectWith:
sr
parents: 13683
diff changeset
  1599
    /*
16c890248840 added: #invalidCodeObjectWith:
sr
parents: 13683
diff changeset
  1600
     * for reasons too far from being explained here,
16c890248840 added: #invalidCodeObjectWith:
sr
parents: 13683
diff changeset
  1601
     * this MUST be a compiled method
16c890248840 added: #invalidCodeObjectWith:
sr
parents: 13683
diff changeset
  1602
     */
16c890248840 added: #invalidCodeObjectWith:
sr
parents: 13683
diff changeset
  1603
%}.
16c890248840 added: #invalidCodeObjectWith:
sr
parents: 13683
diff changeset
  1604
    ^ InvalidCodeError
18620
b4e9f25d6ce6 preparations for lined index list in WeakArray
Claus Gittinger <cg@exept.de>
parents: 18462
diff changeset
  1605
	raiseErrorString:'invalid method - not executable'.
13693
16c890248840 added: #invalidCodeObjectWith:
sr
parents: 13683
diff changeset
  1606
16c890248840 added: #invalidCodeObjectWith:
sr
parents: 13683
diff changeset
  1607
    "Created: / 14-09-2011 / 11:23:49 / sr"
16c890248840 added: #invalidCodeObjectWith:
sr
parents: 13683
diff changeset
  1608
!
16c890248840 added: #invalidCodeObjectWith:
sr
parents: 13683
diff changeset
  1609
1870
2623b60c27e1 lifted numVars; added access for invalidCodeObject-trappers
Claus Gittinger <cg@exept.de>
parents: 1855
diff changeset
  1610
invalidCodeObjectWith:arg with:arg2
1873
3544a4a94a2a checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1870
diff changeset
  1611
    "{ Pragma: +optSpace }"
3544a4a94a2a checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1870
diff changeset
  1612
1870
2623b60c27e1 lifted numVars; added access for invalidCodeObject-trappers
Claus Gittinger <cg@exept.de>
parents: 1855
diff changeset
  1613
    "When recompiling classes after a definition-change, all
2623b60c27e1 lifted numVars; added access for invalidCodeObject-trappers
Claus Gittinger <cg@exept.de>
parents: 1855
diff changeset
  1614
     uncompilable methods (with 2 args) will be bound to this method here,
2623b60c27e1 lifted numVars; added access for invalidCodeObject-trappers
Claus Gittinger <cg@exept.de>
parents: 1855
diff changeset
  1615
     so that evaluating such an uncompilable method will trigger an error."
2623b60c27e1 lifted numVars; added access for invalidCodeObject-trappers
Claus Gittinger <cg@exept.de>
parents: 1855
diff changeset
  1616
1873
3544a4a94a2a checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1870
diff changeset
  1617
%{
3544a4a94a2a checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1870
diff changeset
  1618
    /*
3544a4a94a2a checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1870
diff changeset
  1619
     * for reasons too far from being explained here,
3544a4a94a2a checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1870
diff changeset
  1620
     * this MUST be a compiled method
3544a4a94a2a checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1870
diff changeset
  1621
     */
3544a4a94a2a checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1870
diff changeset
  1622
%}.
7601
57c257f1150a Fix race when accessing source
Stefan Vogel <sv@exept.de>
parents: 7457
diff changeset
  1623
    ^ InvalidCodeError
18620
b4e9f25d6ce6 preparations for lined index list in WeakArray
Claus Gittinger <cg@exept.de>
parents: 18462
diff changeset
  1624
	raiseErrorString:'invalid method - not executable'.
1870
2623b60c27e1 lifted numVars; added access for invalidCodeObject-trappers
Claus Gittinger <cg@exept.de>
parents: 1855
diff changeset
  1625
2623b60c27e1 lifted numVars; added access for invalidCodeObject-trappers
Claus Gittinger <cg@exept.de>
parents: 1855
diff changeset
  1626
    "Created: 4.11.1996 / 21:16:41 / cg"
1873
3544a4a94a2a checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1870
diff changeset
  1627
    "Modified: 4.11.1996 / 22:45:15 / cg"
1870
2623b60c27e1 lifted numVars; added access for invalidCodeObject-trappers
Claus Gittinger <cg@exept.de>
parents: 1855
diff changeset
  1628
!
2623b60c27e1 lifted numVars; added access for invalidCodeObject-trappers
Claus Gittinger <cg@exept.de>
parents: 1855
diff changeset
  1629
2623b60c27e1 lifted numVars; added access for invalidCodeObject-trappers
Claus Gittinger <cg@exept.de>
parents: 1855
diff changeset
  1630
invalidCodeObjectWith:arg with:arg2 with:arg3
1873
3544a4a94a2a checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1870
diff changeset
  1631
    "{ Pragma: +optSpace }"
3544a4a94a2a checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1870
diff changeset
  1632
1870
2623b60c27e1 lifted numVars; added access for invalidCodeObject-trappers
Claus Gittinger <cg@exept.de>
parents: 1855
diff changeset
  1633
    "When recompiling classes after a definition-change, all
2623b60c27e1 lifted numVars; added access for invalidCodeObject-trappers
Claus Gittinger <cg@exept.de>
parents: 1855
diff changeset
  1634
     uncompilable methods (with 3 args) will be bound to this method here,
2623b60c27e1 lifted numVars; added access for invalidCodeObject-trappers
Claus Gittinger <cg@exept.de>
parents: 1855
diff changeset
  1635
     so that evaluating such an uncompilable method will trigger an error."
2623b60c27e1 lifted numVars; added access for invalidCodeObject-trappers
Claus Gittinger <cg@exept.de>
parents: 1855
diff changeset
  1636
1873
3544a4a94a2a checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1870
diff changeset
  1637
%{
3544a4a94a2a checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1870
diff changeset
  1638
    /*
3544a4a94a2a checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1870
diff changeset
  1639
     * for reasons too far from being explained here,
3544a4a94a2a checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1870
diff changeset
  1640
     * this MUST be a compiled method
3544a4a94a2a checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1870
diff changeset
  1641
     */
3544a4a94a2a checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1870
diff changeset
  1642
%}.
7601
57c257f1150a Fix race when accessing source
Stefan Vogel <sv@exept.de>
parents: 7457
diff changeset
  1643
    ^ InvalidCodeError
18620
b4e9f25d6ce6 preparations for lined index list in WeakArray
Claus Gittinger <cg@exept.de>
parents: 18462
diff changeset
  1644
	raiseErrorString:'invalid method - not executable'.
1870
2623b60c27e1 lifted numVars; added access for invalidCodeObject-trappers
Claus Gittinger <cg@exept.de>
parents: 1855
diff changeset
  1645
2623b60c27e1 lifted numVars; added access for invalidCodeObject-trappers
Claus Gittinger <cg@exept.de>
parents: 1855
diff changeset
  1646
    "Created: 4.11.1996 / 21:16:51 / cg"
1873
3544a4a94a2a checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1870
diff changeset
  1647
    "Modified: 4.11.1996 / 22:45:18 / cg"
1870
2623b60c27e1 lifted numVars; added access for invalidCodeObject-trappers
Claus Gittinger <cg@exept.de>
parents: 1855
diff changeset
  1648
!
2623b60c27e1 lifted numVars; added access for invalidCodeObject-trappers
Claus Gittinger <cg@exept.de>
parents: 1855
diff changeset
  1649
2623b60c27e1 lifted numVars; added access for invalidCodeObject-trappers
Claus Gittinger <cg@exept.de>
parents: 1855
diff changeset
  1650
invalidCodeObjectWith:arg with:arg2 with:arg3 with:arg4
1873
3544a4a94a2a checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1870
diff changeset
  1651
    "{ Pragma: +optSpace }"
3544a4a94a2a checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1870
diff changeset
  1652
1870
2623b60c27e1 lifted numVars; added access for invalidCodeObject-trappers
Claus Gittinger <cg@exept.de>
parents: 1855
diff changeset
  1653
    "When recompiling classes after a definition-change, all
2623b60c27e1 lifted numVars; added access for invalidCodeObject-trappers
Claus Gittinger <cg@exept.de>
parents: 1855
diff changeset
  1654
     uncompilable methods (with 4 args) will be bound to this method here,
2623b60c27e1 lifted numVars; added access for invalidCodeObject-trappers
Claus Gittinger <cg@exept.de>
parents: 1855
diff changeset
  1655
     so that evaluating such an uncompilable method will trigger an error."
2623b60c27e1 lifted numVars; added access for invalidCodeObject-trappers
Claus Gittinger <cg@exept.de>
parents: 1855
diff changeset
  1656
1873
3544a4a94a2a checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1870
diff changeset
  1657
%{
3544a4a94a2a checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1870
diff changeset
  1658
    /*
3544a4a94a2a checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1870
diff changeset
  1659
     * for reasons too far from being explained here,
3544a4a94a2a checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1870
diff changeset
  1660
     * this MUST be a compiled method
3544a4a94a2a checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1870
diff changeset
  1661
     */
3544a4a94a2a checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1870
diff changeset
  1662
%}.
7601
57c257f1150a Fix race when accessing source
Stefan Vogel <sv@exept.de>
parents: 7457
diff changeset
  1663
    ^ InvalidCodeError
18620
b4e9f25d6ce6 preparations for lined index list in WeakArray
Claus Gittinger <cg@exept.de>
parents: 18462
diff changeset
  1664
	raiseErrorString:'invalid method - not executable'.
1870
2623b60c27e1 lifted numVars; added access for invalidCodeObject-trappers
Claus Gittinger <cg@exept.de>
parents: 1855
diff changeset
  1665
2623b60c27e1 lifted numVars; added access for invalidCodeObject-trappers
Claus Gittinger <cg@exept.de>
parents: 1855
diff changeset
  1666
    "Created: 4.11.1996 / 21:17:00 / cg"
1873
3544a4a94a2a checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1870
diff changeset
  1667
    "Modified: 4.11.1996 / 22:45:22 / cg"
1870
2623b60c27e1 lifted numVars; added access for invalidCodeObject-trappers
Claus Gittinger <cg@exept.de>
parents: 1855
diff changeset
  1668
!
2623b60c27e1 lifted numVars; added access for invalidCodeObject-trappers
Claus Gittinger <cg@exept.de>
parents: 1855
diff changeset
  1669
2623b60c27e1 lifted numVars; added access for invalidCodeObject-trappers
Claus Gittinger <cg@exept.de>
parents: 1855
diff changeset
  1670
invalidCodeObjectWith:arg with:arg2 with:arg3 with:arg4 with:arg5
1873
3544a4a94a2a checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1870
diff changeset
  1671
    "{ Pragma: +optSpace }"
3544a4a94a2a checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1870
diff changeset
  1672
1870
2623b60c27e1 lifted numVars; added access for invalidCodeObject-trappers
Claus Gittinger <cg@exept.de>
parents: 1855
diff changeset
  1673
    "When recompiling classes after a definition-change, all
2623b60c27e1 lifted numVars; added access for invalidCodeObject-trappers
Claus Gittinger <cg@exept.de>
parents: 1855
diff changeset
  1674
     uncompilable methods (with 5 args) will be bound to this method here,
2623b60c27e1 lifted numVars; added access for invalidCodeObject-trappers
Claus Gittinger <cg@exept.de>
parents: 1855
diff changeset
  1675
     so that evaluating such an uncompilable method will trigger an error."
2623b60c27e1 lifted numVars; added access for invalidCodeObject-trappers
Claus Gittinger <cg@exept.de>
parents: 1855
diff changeset
  1676
1873
3544a4a94a2a checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1870
diff changeset
  1677
%{
3544a4a94a2a checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1870
diff changeset
  1678
    /*
3544a4a94a2a checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1870
diff changeset
  1679
     * for reasons too far from being explained here,
3544a4a94a2a checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1870
diff changeset
  1680
     * this MUST be a compiled method
3544a4a94a2a checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1870
diff changeset
  1681
     */
3544a4a94a2a checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1870
diff changeset
  1682
%}.
7601
57c257f1150a Fix race when accessing source
Stefan Vogel <sv@exept.de>
parents: 7457
diff changeset
  1683
    ^ InvalidCodeError
18620
b4e9f25d6ce6 preparations for lined index list in WeakArray
Claus Gittinger <cg@exept.de>
parents: 18462
diff changeset
  1684
	raiseErrorString:'invalid method - not executable'.
1870
2623b60c27e1 lifted numVars; added access for invalidCodeObject-trappers
Claus Gittinger <cg@exept.de>
parents: 1855
diff changeset
  1685
2623b60c27e1 lifted numVars; added access for invalidCodeObject-trappers
Claus Gittinger <cg@exept.de>
parents: 1855
diff changeset
  1686
    "Created: 4.11.1996 / 21:17:09 / cg"
1873
3544a4a94a2a checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1870
diff changeset
  1687
    "Modified: 4.11.1996 / 22:45:25 / cg"
1870
2623b60c27e1 lifted numVars; added access for invalidCodeObject-trappers
Claus Gittinger <cg@exept.de>
parents: 1855
diff changeset
  1688
!
2623b60c27e1 lifted numVars; added access for invalidCodeObject-trappers
Claus Gittinger <cg@exept.de>
parents: 1855
diff changeset
  1689
2623b60c27e1 lifted numVars; added access for invalidCodeObject-trappers
Claus Gittinger <cg@exept.de>
parents: 1855
diff changeset
  1690
invalidCodeObjectWith:arg with:arg2 with:arg3 with:arg4 with:arg5 with:arg6
1873
3544a4a94a2a checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1870
diff changeset
  1691
    "{ Pragma: +optSpace }"
3544a4a94a2a checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1870
diff changeset
  1692
1870
2623b60c27e1 lifted numVars; added access for invalidCodeObject-trappers
Claus Gittinger <cg@exept.de>
parents: 1855
diff changeset
  1693
    "When recompiling classes after a definition-change, all
2623b60c27e1 lifted numVars; added access for invalidCodeObject-trappers
Claus Gittinger <cg@exept.de>
parents: 1855
diff changeset
  1694
     uncompilable methods (with 6 args) will be bound to this method here,
2623b60c27e1 lifted numVars; added access for invalidCodeObject-trappers
Claus Gittinger <cg@exept.de>
parents: 1855
diff changeset
  1695
     so that evaluating such an uncompilable method will trigger an error."
2623b60c27e1 lifted numVars; added access for invalidCodeObject-trappers
Claus Gittinger <cg@exept.de>
parents: 1855
diff changeset
  1696
1873
3544a4a94a2a checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1870
diff changeset
  1697
%{
3544a4a94a2a checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1870
diff changeset
  1698
    /*
3544a4a94a2a checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1870
diff changeset
  1699
     * for reasons too far from being explained here,
3544a4a94a2a checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1870
diff changeset
  1700
     * this MUST be a compiled method
3544a4a94a2a checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1870
diff changeset
  1701
     */
3544a4a94a2a checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1870
diff changeset
  1702
%}.
7601
57c257f1150a Fix race when accessing source
Stefan Vogel <sv@exept.de>
parents: 7457
diff changeset
  1703
    ^ InvalidCodeError
18620
b4e9f25d6ce6 preparations for lined index list in WeakArray
Claus Gittinger <cg@exept.de>
parents: 18462
diff changeset
  1704
	raiseErrorString:'invalid method - not executable'.
1870
2623b60c27e1 lifted numVars; added access for invalidCodeObject-trappers
Claus Gittinger <cg@exept.de>
parents: 1855
diff changeset
  1705
2623b60c27e1 lifted numVars; added access for invalidCodeObject-trappers
Claus Gittinger <cg@exept.de>
parents: 1855
diff changeset
  1706
    "Created: 4.11.1996 / 21:17:17 / cg"
1873
3544a4a94a2a checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1870
diff changeset
  1707
    "Modified: 4.11.1996 / 22:45:28 / cg"
1870
2623b60c27e1 lifted numVars; added access for invalidCodeObject-trappers
Claus Gittinger <cg@exept.de>
parents: 1855
diff changeset
  1708
!
2623b60c27e1 lifted numVars; added access for invalidCodeObject-trappers
Claus Gittinger <cg@exept.de>
parents: 1855
diff changeset
  1709
2623b60c27e1 lifted numVars; added access for invalidCodeObject-trappers
Claus Gittinger <cg@exept.de>
parents: 1855
diff changeset
  1710
invalidCodeObjectWith:arg with:arg2 with:arg3 with:arg4 with:arg5 with:arg6 with:arg7
1873
3544a4a94a2a checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1870
diff changeset
  1711
    "{ Pragma: +optSpace }"
3544a4a94a2a checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1870
diff changeset
  1712
1870
2623b60c27e1 lifted numVars; added access for invalidCodeObject-trappers
Claus Gittinger <cg@exept.de>
parents: 1855
diff changeset
  1713
    "When recompiling classes after a definition-change, all
2623b60c27e1 lifted numVars; added access for invalidCodeObject-trappers
Claus Gittinger <cg@exept.de>
parents: 1855
diff changeset
  1714
     uncompilable methods (with 7 args) will be bound to this method here,
2623b60c27e1 lifted numVars; added access for invalidCodeObject-trappers
Claus Gittinger <cg@exept.de>
parents: 1855
diff changeset
  1715
     so that evaluating such an uncompilable method will trigger an error."
2623b60c27e1 lifted numVars; added access for invalidCodeObject-trappers
Claus Gittinger <cg@exept.de>
parents: 1855
diff changeset
  1716
1873
3544a4a94a2a checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1870
diff changeset
  1717
%{
3544a4a94a2a checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1870
diff changeset
  1718
    /*
3544a4a94a2a checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1870
diff changeset
  1719
     * for reasons too far from being explained here,
3544a4a94a2a checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1870
diff changeset
  1720
     * this MUST be a compiled method
3544a4a94a2a checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1870
diff changeset
  1721
     */
3544a4a94a2a checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1870
diff changeset
  1722
%}.
7601
57c257f1150a Fix race when accessing source
Stefan Vogel <sv@exept.de>
parents: 7457
diff changeset
  1723
    ^ InvalidCodeError
18620
b4e9f25d6ce6 preparations for lined index list in WeakArray
Claus Gittinger <cg@exept.de>
parents: 18462
diff changeset
  1724
	raiseErrorString:'invalid method - not executable'.
1870
2623b60c27e1 lifted numVars; added access for invalidCodeObject-trappers
Claus Gittinger <cg@exept.de>
parents: 1855
diff changeset
  1725
2623b60c27e1 lifted numVars; added access for invalidCodeObject-trappers
Claus Gittinger <cg@exept.de>
parents: 1855
diff changeset
  1726
    "Created: 4.11.1996 / 21:17:25 / cg"
1873
3544a4a94a2a checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1870
diff changeset
  1727
    "Modified: 4.11.1996 / 22:45:31 / cg"
1870
2623b60c27e1 lifted numVars; added access for invalidCodeObject-trappers
Claus Gittinger <cg@exept.de>
parents: 1855
diff changeset
  1728
!
2623b60c27e1 lifted numVars; added access for invalidCodeObject-trappers
Claus Gittinger <cg@exept.de>
parents: 1855
diff changeset
  1729
2623b60c27e1 lifted numVars; added access for invalidCodeObject-trappers
Claus Gittinger <cg@exept.de>
parents: 1855
diff changeset
  1730
invalidCodeObjectWith:arg with:arg2 with:arg3 with:arg4 with:arg5 with:arg6 with:arg7 with:arg8
1873
3544a4a94a2a checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1870
diff changeset
  1731
    "{ Pragma: +optSpace }"
3544a4a94a2a checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1870
diff changeset
  1732
1870
2623b60c27e1 lifted numVars; added access for invalidCodeObject-trappers
Claus Gittinger <cg@exept.de>
parents: 1855
diff changeset
  1733
    "When recompiling classes after a definition-change, all
2623b60c27e1 lifted numVars; added access for invalidCodeObject-trappers
Claus Gittinger <cg@exept.de>
parents: 1855
diff changeset
  1734
     uncompilable methods (with 8 args) will be bound to this method here,
2623b60c27e1 lifted numVars; added access for invalidCodeObject-trappers
Claus Gittinger <cg@exept.de>
parents: 1855
diff changeset
  1735
     so that evaluating such an uncompilable method will trigger an error."
2623b60c27e1 lifted numVars; added access for invalidCodeObject-trappers
Claus Gittinger <cg@exept.de>
parents: 1855
diff changeset
  1736
1873
3544a4a94a2a checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1870
diff changeset
  1737
%{
3544a4a94a2a checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1870
diff changeset
  1738
    /*
3544a4a94a2a checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1870
diff changeset
  1739
     * for reasons too far from being explained here,
3544a4a94a2a checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1870
diff changeset
  1740
     * this MUST be a compiled method
3544a4a94a2a checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1870
diff changeset
  1741
     */
3544a4a94a2a checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1870
diff changeset
  1742
%}.
7601
57c257f1150a Fix race when accessing source
Stefan Vogel <sv@exept.de>
parents: 7457
diff changeset
  1743
    ^ InvalidCodeError
18620
b4e9f25d6ce6 preparations for lined index list in WeakArray
Claus Gittinger <cg@exept.de>
parents: 18462
diff changeset
  1744
	raiseErrorString:'invalid method - not executable'.
1870
2623b60c27e1 lifted numVars; added access for invalidCodeObject-trappers
Claus Gittinger <cg@exept.de>
parents: 1855
diff changeset
  1745
2623b60c27e1 lifted numVars; added access for invalidCodeObject-trappers
Claus Gittinger <cg@exept.de>
parents: 1855
diff changeset
  1746
    "Created: 4.11.1996 / 21:17:32 / cg"
1873
3544a4a94a2a checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1870
diff changeset
  1747
    "Modified: 4.11.1996 / 22:45:38 / cg"
1870
2623b60c27e1 lifted numVars; added access for invalidCodeObject-trappers
Claus Gittinger <cg@exept.de>
parents: 1855
diff changeset
  1748
!
2623b60c27e1 lifted numVars; added access for invalidCodeObject-trappers
Claus Gittinger <cg@exept.de>
parents: 1855
diff changeset
  1749
2623b60c27e1 lifted numVars; added access for invalidCodeObject-trappers
Claus Gittinger <cg@exept.de>
parents: 1855
diff changeset
  1750
invalidCodeObjectWith:arg with:arg2 with:arg3 with:arg4 with:arg5 with:arg6 with:arg7 with:arg8 with:arg9
1873
3544a4a94a2a checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1870
diff changeset
  1751
    "{ Pragma: +optSpace }"
3544a4a94a2a checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1870
diff changeset
  1752
1870
2623b60c27e1 lifted numVars; added access for invalidCodeObject-trappers
Claus Gittinger <cg@exept.de>
parents: 1855
diff changeset
  1753
    "When recompiling classes after a definition-change, all
2623b60c27e1 lifted numVars; added access for invalidCodeObject-trappers
Claus Gittinger <cg@exept.de>
parents: 1855
diff changeset
  1754
     uncompilable methods (with 9 args) will be bound to this method here,
2623b60c27e1 lifted numVars; added access for invalidCodeObject-trappers
Claus Gittinger <cg@exept.de>
parents: 1855
diff changeset
  1755
     so that evaluating such an uncompilable method will trigger an error."
2623b60c27e1 lifted numVars; added access for invalidCodeObject-trappers
Claus Gittinger <cg@exept.de>
parents: 1855
diff changeset
  1756
1873
3544a4a94a2a checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1870
diff changeset
  1757
%{
3544a4a94a2a checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1870
diff changeset
  1758
    /*
3544a4a94a2a checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1870
diff changeset
  1759
     * for reasons too far from being explained here,
3544a4a94a2a checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1870
diff changeset
  1760
     * this MUST be a compiled method
3544a4a94a2a checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1870
diff changeset
  1761
     */
3544a4a94a2a checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1870
diff changeset
  1762
%}.
7601
57c257f1150a Fix race when accessing source
Stefan Vogel <sv@exept.de>
parents: 7457
diff changeset
  1763
    ^ InvalidCodeError
18620
b4e9f25d6ce6 preparations for lined index list in WeakArray
Claus Gittinger <cg@exept.de>
parents: 18462
diff changeset
  1764
	raiseErrorString:'invalid method - not executable'.
1870
2623b60c27e1 lifted numVars; added access for invalidCodeObject-trappers
Claus Gittinger <cg@exept.de>
parents: 1855
diff changeset
  1765
2623b60c27e1 lifted numVars; added access for invalidCodeObject-trappers
Claus Gittinger <cg@exept.de>
parents: 1855
diff changeset
  1766
    "Created: 4.11.1996 / 21:17:37 / cg"
1873
3544a4a94a2a checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1870
diff changeset
  1767
    "Modified: 4.11.1996 / 22:45:41 / cg"
1870
2623b60c27e1 lifted numVars; added access for invalidCodeObject-trappers
Claus Gittinger <cg@exept.de>
parents: 1855
diff changeset
  1768
!
2623b60c27e1 lifted numVars; added access for invalidCodeObject-trappers
Claus Gittinger <cg@exept.de>
parents: 1855
diff changeset
  1769
2623b60c27e1 lifted numVars; added access for invalidCodeObject-trappers
Claus Gittinger <cg@exept.de>
parents: 1855
diff changeset
  1770
invalidCodeObjectWith:arg with:arg2 with:arg3 with:arg4 with:arg5 with:arg6 with:arg7 with:arg8 with:arg9 with:arg10
1873
3544a4a94a2a checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1870
diff changeset
  1771
    "{ Pragma: +optSpace }"
3544a4a94a2a checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1870
diff changeset
  1772
1870
2623b60c27e1 lifted numVars; added access for invalidCodeObject-trappers
Claus Gittinger <cg@exept.de>
parents: 1855
diff changeset
  1773
    "When recompiling classes after a definition-change, all
2623b60c27e1 lifted numVars; added access for invalidCodeObject-trappers
Claus Gittinger <cg@exept.de>
parents: 1855
diff changeset
  1774
     uncompilable methods (with 10 args) will be bound to this method here,
2623b60c27e1 lifted numVars; added access for invalidCodeObject-trappers
Claus Gittinger <cg@exept.de>
parents: 1855
diff changeset
  1775
     so that evaluating such an uncompilable method will trigger an error."
2623b60c27e1 lifted numVars; added access for invalidCodeObject-trappers
Claus Gittinger <cg@exept.de>
parents: 1855
diff changeset
  1776
1873
3544a4a94a2a checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1870
diff changeset
  1777
%{
3544a4a94a2a checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1870
diff changeset
  1778
    /*
3544a4a94a2a checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1870
diff changeset
  1779
     * for reasons too far from being explained here,
3544a4a94a2a checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1870
diff changeset
  1780
     * this MUST be a compiled method
3544a4a94a2a checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1870
diff changeset
  1781
     */
3544a4a94a2a checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1870
diff changeset
  1782
%}.
7601
57c257f1150a Fix race when accessing source
Stefan Vogel <sv@exept.de>
parents: 7457
diff changeset
  1783
    ^ InvalidCodeError
18620
b4e9f25d6ce6 preparations for lined index list in WeakArray
Claus Gittinger <cg@exept.de>
parents: 18462
diff changeset
  1784
	raiseErrorString:'invalid method - not executable'.
1870
2623b60c27e1 lifted numVars; added access for invalidCodeObject-trappers
Claus Gittinger <cg@exept.de>
parents: 1855
diff changeset
  1785
2623b60c27e1 lifted numVars; added access for invalidCodeObject-trappers
Claus Gittinger <cg@exept.de>
parents: 1855
diff changeset
  1786
    "Created: 4.11.1996 / 21:17:45 / cg"
1873
3544a4a94a2a checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1870
diff changeset
  1787
    "Modified: 4.11.1996 / 22:45:44 / cg"
1870
2623b60c27e1 lifted numVars; added access for invalidCodeObject-trappers
Claus Gittinger <cg@exept.de>
parents: 1855
diff changeset
  1788
!
2623b60c27e1 lifted numVars; added access for invalidCodeObject-trappers
Claus Gittinger <cg@exept.de>
parents: 1855
diff changeset
  1789
2623b60c27e1 lifted numVars; added access for invalidCodeObject-trappers
Claus Gittinger <cg@exept.de>
parents: 1855
diff changeset
  1790
invalidCodeObjectWith:arg with:arg2 with:arg3 with:arg4 with:arg5 with:arg6 with:arg7 with:arg8 with:arg9 with:arg10 with:arg11
1873
3544a4a94a2a checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1870
diff changeset
  1791
    "{ Pragma: +optSpace }"
3544a4a94a2a checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1870
diff changeset
  1792
1870
2623b60c27e1 lifted numVars; added access for invalidCodeObject-trappers
Claus Gittinger <cg@exept.de>
parents: 1855
diff changeset
  1793
    "When recompiling classes after a definition-change, all
2623b60c27e1 lifted numVars; added access for invalidCodeObject-trappers
Claus Gittinger <cg@exept.de>
parents: 1855
diff changeset
  1794
     uncompilable methods (with 11 args) will be bound to this method here,
2623b60c27e1 lifted numVars; added access for invalidCodeObject-trappers
Claus Gittinger <cg@exept.de>
parents: 1855
diff changeset
  1795
     so that evaluating such an uncompilable method will trigger an error."
2623b60c27e1 lifted numVars; added access for invalidCodeObject-trappers
Claus Gittinger <cg@exept.de>
parents: 1855
diff changeset
  1796
1873
3544a4a94a2a checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1870
diff changeset
  1797
%{
3544a4a94a2a checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1870
diff changeset
  1798
    /*
3544a4a94a2a checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1870
diff changeset
  1799
     * for reasons too far from being explained here,
3544a4a94a2a checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1870
diff changeset
  1800
     * this MUST be a compiled method
3544a4a94a2a checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1870
diff changeset
  1801
     */
3544a4a94a2a checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1870
diff changeset
  1802
%}.
7601
57c257f1150a Fix race when accessing source
Stefan Vogel <sv@exept.de>
parents: 7457
diff changeset
  1803
    ^ InvalidCodeError
18620
b4e9f25d6ce6 preparations for lined index list in WeakArray
Claus Gittinger <cg@exept.de>
parents: 18462
diff changeset
  1804
	raiseErrorString:'invalid method - not executable'.
1870
2623b60c27e1 lifted numVars; added access for invalidCodeObject-trappers
Claus Gittinger <cg@exept.de>
parents: 1855
diff changeset
  1805
2623b60c27e1 lifted numVars; added access for invalidCodeObject-trappers
Claus Gittinger <cg@exept.de>
parents: 1855
diff changeset
  1806
    "Created: 4.11.1996 / 21:17:52 / cg"
1873
3544a4a94a2a checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1870
diff changeset
  1807
    "Modified: 4.11.1996 / 22:45:47 / cg"
1870
2623b60c27e1 lifted numVars; added access for invalidCodeObject-trappers
Claus Gittinger <cg@exept.de>
parents: 1855
diff changeset
  1808
!
2623b60c27e1 lifted numVars; added access for invalidCodeObject-trappers
Claus Gittinger <cg@exept.de>
parents: 1855
diff changeset
  1809
2623b60c27e1 lifted numVars; added access for invalidCodeObject-trappers
Claus Gittinger <cg@exept.de>
parents: 1855
diff changeset
  1810
invalidCodeObjectWith:arg with:arg2 with:arg3 with:arg4 with:arg5 with:arg6 with:arg7 with:arg8 with:arg9 with:arg10 with:arg11 with:arg12
1873
3544a4a94a2a checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1870
diff changeset
  1811
    "{ Pragma: +optSpace }"
3544a4a94a2a checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1870
diff changeset
  1812
1870
2623b60c27e1 lifted numVars; added access for invalidCodeObject-trappers
Claus Gittinger <cg@exept.de>
parents: 1855
diff changeset
  1813
    "When recompiling classes after a definition-change, all
2623b60c27e1 lifted numVars; added access for invalidCodeObject-trappers
Claus Gittinger <cg@exept.de>
parents: 1855
diff changeset
  1814
     uncompilable methods (with 12 args) will be bound to this method here,
2623b60c27e1 lifted numVars; added access for invalidCodeObject-trappers
Claus Gittinger <cg@exept.de>
parents: 1855
diff changeset
  1815
     so that evaluating such an uncompilable method will trigger an error."
2623b60c27e1 lifted numVars; added access for invalidCodeObject-trappers
Claus Gittinger <cg@exept.de>
parents: 1855
diff changeset
  1816
1873
3544a4a94a2a checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1870
diff changeset
  1817
%{
3544a4a94a2a checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1870
diff changeset
  1818
    /*
3544a4a94a2a checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1870
diff changeset
  1819
     * for reasons too far from being explained here,
3544a4a94a2a checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1870
diff changeset
  1820
     * this MUST be a compiled method
3544a4a94a2a checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1870
diff changeset
  1821
     */
3544a4a94a2a checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1870
diff changeset
  1822
%}.
7601
57c257f1150a Fix race when accessing source
Stefan Vogel <sv@exept.de>
parents: 7457
diff changeset
  1823
    ^ InvalidCodeError
18620
b4e9f25d6ce6 preparations for lined index list in WeakArray
Claus Gittinger <cg@exept.de>
parents: 18462
diff changeset
  1824
	raiseErrorString:'invalid method - not executable'.
1870
2623b60c27e1 lifted numVars; added access for invalidCodeObject-trappers
Claus Gittinger <cg@exept.de>
parents: 1855
diff changeset
  1825
2623b60c27e1 lifted numVars; added access for invalidCodeObject-trappers
Claus Gittinger <cg@exept.de>
parents: 1855
diff changeset
  1826
    "Created: 4.11.1996 / 20:51:28 / cg"
1873
3544a4a94a2a checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1870
diff changeset
  1827
    "Modified: 4.11.1996 / 22:46:01 / cg"
1870
2623b60c27e1 lifted numVars; added access for invalidCodeObject-trappers
Claus Gittinger <cg@exept.de>
parents: 1855
diff changeset
  1828
!
2623b60c27e1 lifted numVars; added access for invalidCodeObject-trappers
Claus Gittinger <cg@exept.de>
parents: 1855
diff changeset
  1829
2623b60c27e1 lifted numVars; added access for invalidCodeObject-trappers
Claus Gittinger <cg@exept.de>
parents: 1855
diff changeset
  1830
invalidCodeObjectWith:arg with:arg2 with:arg3 with:arg4 with:arg5 with:arg6 with:arg7 with:arg8 with:arg9 with:arg10 with:arg11 with:arg12 with:arg13
1873
3544a4a94a2a checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1870
diff changeset
  1831
    "{ Pragma: +optSpace }"
3544a4a94a2a checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1870
diff changeset
  1832
1870
2623b60c27e1 lifted numVars; added access for invalidCodeObject-trappers
Claus Gittinger <cg@exept.de>
parents: 1855
diff changeset
  1833
    "When recompiling classes after a definition-change, all
2623b60c27e1 lifted numVars; added access for invalidCodeObject-trappers
Claus Gittinger <cg@exept.de>
parents: 1855
diff changeset
  1834
     uncompilable methods (with 13 args) will be bound to this method here,
2623b60c27e1 lifted numVars; added access for invalidCodeObject-trappers
Claus Gittinger <cg@exept.de>
parents: 1855
diff changeset
  1835
     so that evaluating such an uncompilable method will trigger an error."
2623b60c27e1 lifted numVars; added access for invalidCodeObject-trappers
Claus Gittinger <cg@exept.de>
parents: 1855
diff changeset
  1836
1873
3544a4a94a2a checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1870
diff changeset
  1837
%{
3544a4a94a2a checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1870
diff changeset
  1838
    /*
3544a4a94a2a checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1870
diff changeset
  1839
     * for reasons too far from being explained here,
3544a4a94a2a checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1870
diff changeset
  1840
     * this MUST be a compiled method
3544a4a94a2a checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1870
diff changeset
  1841
     */
3544a4a94a2a checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1870
diff changeset
  1842
%}.
7601
57c257f1150a Fix race when accessing source
Stefan Vogel <sv@exept.de>
parents: 7457
diff changeset
  1843
    ^ InvalidCodeError
18620
b4e9f25d6ce6 preparations for lined index list in WeakArray
Claus Gittinger <cg@exept.de>
parents: 18462
diff changeset
  1844
	raiseErrorString:'invalid method - not executable'.
1870
2623b60c27e1 lifted numVars; added access for invalidCodeObject-trappers
Claus Gittinger <cg@exept.de>
parents: 1855
diff changeset
  1845
2623b60c27e1 lifted numVars; added access for invalidCodeObject-trappers
Claus Gittinger <cg@exept.de>
parents: 1855
diff changeset
  1846
    "Created: 4.11.1996 / 21:18:09 / cg"
1873
3544a4a94a2a checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1870
diff changeset
  1847
    "Modified: 4.11.1996 / 22:45:57 / cg"
1870
2623b60c27e1 lifted numVars; added access for invalidCodeObject-trappers
Claus Gittinger <cg@exept.de>
parents: 1855
diff changeset
  1848
!
2623b60c27e1 lifted numVars; added access for invalidCodeObject-trappers
Claus Gittinger <cg@exept.de>
parents: 1855
diff changeset
  1849
2623b60c27e1 lifted numVars; added access for invalidCodeObject-trappers
Claus Gittinger <cg@exept.de>
parents: 1855
diff changeset
  1850
invalidCodeObjectWith:arg with:arg2 with:arg3 with:arg4 with:arg5 with:arg6 with:arg7 with:arg8 with:arg9 with:arg10 with:arg11 with:arg12 with:arg13 with:arg14
1873
3544a4a94a2a checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1870
diff changeset
  1851
    "{ Pragma: +optSpace }"
3544a4a94a2a checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1870
diff changeset
  1852
1870
2623b60c27e1 lifted numVars; added access for invalidCodeObject-trappers
Claus Gittinger <cg@exept.de>
parents: 1855
diff changeset
  1853
    "When recompiling classes after a definition-change, all
2623b60c27e1 lifted numVars; added access for invalidCodeObject-trappers
Claus Gittinger <cg@exept.de>
parents: 1855
diff changeset
  1854
     uncompilable methods (with 14 args) will be bound to this method here,
2623b60c27e1 lifted numVars; added access for invalidCodeObject-trappers
Claus Gittinger <cg@exept.de>
parents: 1855
diff changeset
  1855
     so that evaluating such an uncompilable method will trigger an error."
2623b60c27e1 lifted numVars; added access for invalidCodeObject-trappers
Claus Gittinger <cg@exept.de>
parents: 1855
diff changeset
  1856
1873
3544a4a94a2a checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1870
diff changeset
  1857
%{
3544a4a94a2a checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1870
diff changeset
  1858
    /*
3544a4a94a2a checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1870
diff changeset
  1859
     * for reasons too far from being explained here,
3544a4a94a2a checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1870
diff changeset
  1860
     * this MUST be a compiled method
3544a4a94a2a checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1870
diff changeset
  1861
     */
3544a4a94a2a checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1870
diff changeset
  1862
%}.
7601
57c257f1150a Fix race when accessing source
Stefan Vogel <sv@exept.de>
parents: 7457
diff changeset
  1863
    ^ InvalidCodeError
18620
b4e9f25d6ce6 preparations for lined index list in WeakArray
Claus Gittinger <cg@exept.de>
parents: 18462
diff changeset
  1864
	raiseErrorString:'invalid method - not executable'.
1870
2623b60c27e1 lifted numVars; added access for invalidCodeObject-trappers
Claus Gittinger <cg@exept.de>
parents: 1855
diff changeset
  1865
2623b60c27e1 lifted numVars; added access for invalidCodeObject-trappers
Claus Gittinger <cg@exept.de>
parents: 1855
diff changeset
  1866
    "Created: 4.11.1996 / 21:18:17 / cg"
1873
3544a4a94a2a checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1870
diff changeset
  1867
    "Modified: 4.11.1996 / 22:45:55 / cg"
1870
2623b60c27e1 lifted numVars; added access for invalidCodeObject-trappers
Claus Gittinger <cg@exept.de>
parents: 1855
diff changeset
  1868
!
2623b60c27e1 lifted numVars; added access for invalidCodeObject-trappers
Claus Gittinger <cg@exept.de>
parents: 1855
diff changeset
  1869
2623b60c27e1 lifted numVars; added access for invalidCodeObject-trappers
Claus Gittinger <cg@exept.de>
parents: 1855
diff changeset
  1870
invalidCodeObjectWith:arg with:arg2 with:arg3 with:arg4 with:arg5 with:arg6 with:arg7 with:arg8 with:arg9 with:arg10 with:arg11 with:arg12 with:arg13 with:arg14 with:arg15
1873
3544a4a94a2a checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1870
diff changeset
  1871
    "{ Pragma: +optSpace }"
3544a4a94a2a checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1870
diff changeset
  1872
1870
2623b60c27e1 lifted numVars; added access for invalidCodeObject-trappers
Claus Gittinger <cg@exept.de>
parents: 1855
diff changeset
  1873
    "When recompiling classes after a definition-change, all
2623b60c27e1 lifted numVars; added access for invalidCodeObject-trappers
Claus Gittinger <cg@exept.de>
parents: 1855
diff changeset
  1874
     uncompilable methods (with 15 args) will be bound to this method here,
2623b60c27e1 lifted numVars; added access for invalidCodeObject-trappers
Claus Gittinger <cg@exept.de>
parents: 1855
diff changeset
  1875
     so that evaluating such an uncompilable method will trigger an error."
2623b60c27e1 lifted numVars; added access for invalidCodeObject-trappers
Claus Gittinger <cg@exept.de>
parents: 1855
diff changeset
  1876
1873
3544a4a94a2a checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1870
diff changeset
  1877
%{
3544a4a94a2a checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1870
diff changeset
  1878
    /*
3544a4a94a2a checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1870
diff changeset
  1879
     * for reasons too far from being explained here,
3544a4a94a2a checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1870
diff changeset
  1880
     * this MUST be a compiled method
3544a4a94a2a checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1870
diff changeset
  1881
     */
3544a4a94a2a checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1870
diff changeset
  1882
%}.
7601
57c257f1150a Fix race when accessing source
Stefan Vogel <sv@exept.de>
parents: 7457
diff changeset
  1883
    ^ InvalidCodeError
18620
b4e9f25d6ce6 preparations for lined index list in WeakArray
Claus Gittinger <cg@exept.de>
parents: 18462
diff changeset
  1884
	raiseErrorString:'invalid method - not executable'.
1870
2623b60c27e1 lifted numVars; added access for invalidCodeObject-trappers
Claus Gittinger <cg@exept.de>
parents: 1855
diff changeset
  1885
2623b60c27e1 lifted numVars; added access for invalidCodeObject-trappers
Claus Gittinger <cg@exept.de>
parents: 1855
diff changeset
  1886
    "Created: 4.11.1996 / 21:18:22 / cg"
1873
3544a4a94a2a checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1870
diff changeset
  1887
    "Modified: 4.11.1996 / 22:45:52 / cg"
1870
2623b60c27e1 lifted numVars; added access for invalidCodeObject-trappers
Claus Gittinger <cg@exept.de>
parents: 1855
diff changeset
  1888
!
2623b60c27e1 lifted numVars; added access for invalidCodeObject-trappers
Claus Gittinger <cg@exept.de>
parents: 1855
diff changeset
  1889
109
1fae65190b17 errors raise signals; check arg-count in valueWith...
claus
parents: 93
diff changeset
  1890
privateMethodCalled
1873
3544a4a94a2a checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1870
diff changeset
  1891
    "{ Pragma: +optSpace }"
3544a4a94a2a checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1870
diff changeset
  1892
980
0ab2f56ecfc7 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 957
diff changeset
  1893
    "this error is triggered, if a private or protected method is called.
0ab2f56ecfc7 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 957
diff changeset
  1894
360
claus
parents: 350
diff changeset
  1895
     If you continue in the debugger, the method will be called,
12854
3a3d3c02c3bd *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 12695
diff changeset
  1896
     and further privacy exceptions will NOT be reported at this call location,
360
claus
parents: 350
diff changeset
  1897
     until any new method is compiled, or the privacy of any method changes,
claus
parents: 350
diff changeset
  1898
     or the caches are flushed.
20209
ad8f8594c10d #OTHER by mawalch
mawalch
parents: 20208
diff changeset
  1899
     (the reason is that after the continue, the method is entered into the
360
claus
parents: 350
diff changeset
  1900
      calling cache, for which method privacy is not checked.
claus
parents: 350
diff changeset
  1901
      Any of the above actions flushes this cache and a privacy check
claus
parents: 350
diff changeset
  1902
      is performed again.)
claus
parents: 350
diff changeset
  1903
     Future versions may not enter private methods into the cache, to fix this
claus
parents: 350
diff changeset
  1904
     (unobvious) behavior. However, then you will get an exception for EVERY
claus
parents: 350
diff changeset
  1905
     call to a private method ...
claus
parents: 350
diff changeset
  1906
claus
parents: 350
diff changeset
  1907
     Notice: method privacy is a nonstandard feature, not supported
claus
parents: 350
diff changeset
  1908
     by other smalltalk implementations and not specified in the ANSI spec.
claus
parents: 350
diff changeset
  1909
     This is EXPERIMENTAL - and being evaluated for usability.
claus
parents: 350
diff changeset
  1910
     It may change or even vanish (if it shows to be not useful)."
68
59faa75185ba *** empty log message ***
claus
parents: 56
diff changeset
  1911
8518
7dc3f9909640 Interchanged the meaning of method privacy -
Stefan Vogel <sv@exept.de>
parents: 8465
diff changeset
  1912
    ^ PrivateMethodSignal raiseRequest
1873
3544a4a94a2a checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1870
diff changeset
  1913
3544a4a94a2a checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1870
diff changeset
  1914
    "Modified: 4.11.1996 / 22:46:09 / cg"
952
d600e08a5936 handle the case where a method has a sourceFileInfo, but the class has not
Claus Gittinger <cg@exept.de>
parents: 934
diff changeset
  1915
!
d600e08a5936 handle the case where a method has a sourceFileInfo, but the class has not
Claus Gittinger <cg@exept.de>
parents: 934
diff changeset
  1916
d600e08a5936 handle the case where a method has a sourceFileInfo, but the class has not
Claus Gittinger <cg@exept.de>
parents: 934
diff changeset
  1917
uncompiledCodeObject
1873
3544a4a94a2a checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1870
diff changeset
  1918
    "{ Pragma: +optSpace }"
3544a4a94a2a checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1870
diff changeset
  1919
952
d600e08a5936 handle the case where a method has a sourceFileInfo, but the class has not
Claus Gittinger <cg@exept.de>
parents: 934
diff changeset
  1920
    "this method is invoked by methods which contain primitive code,
d600e08a5936 handle the case where a method has a sourceFileInfo, but the class has not
Claus Gittinger <cg@exept.de>
parents: 934
diff changeset
  1921
     but have not been compiled to machine code (either due to an error
d600e08a5936 handle the case where a method has a sourceFileInfo, but the class has not
Claus Gittinger <cg@exept.de>
parents: 934
diff changeset
  1922
     when compiling, or simply because no stc is available.
d600e08a5936 handle the case where a method has a sourceFileInfo, but the class has not
Claus Gittinger <cg@exept.de>
parents: 934
diff changeset
  1923
     For those methods, the compiler generated a method object consisting
1873
3544a4a94a2a checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1870
diff changeset
  1924
     of the original source code, but with this methods machine/byte code."
3544a4a94a2a checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1870
diff changeset
  1925
3544a4a94a2a checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1870
diff changeset
  1926
%{
3544a4a94a2a checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1870
diff changeset
  1927
    /*
3544a4a94a2a checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1870
diff changeset
  1928
     * for reasons too far from being explained here,
3544a4a94a2a checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1870
diff changeset
  1929
     * this MUST be a compiled method
3544a4a94a2a checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1870
diff changeset
  1930
     */
3544a4a94a2a checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1870
diff changeset
  1931
%}.
7601
57c257f1150a Fix race when accessing source
Stefan Vogel <sv@exept.de>
parents: 7457
diff changeset
  1932
    ^ InvalidCodeError
18620
b4e9f25d6ce6 preparations for lined index list in WeakArray
Claus Gittinger <cg@exept.de>
parents: 18462
diff changeset
  1933
	raiseRequestWith:self
b4e9f25d6ce6 preparations for lined index list in WeakArray
Claus Gittinger <cg@exept.de>
parents: 18462
diff changeset
  1934
	errorString:'invalid method - not compiled'.
1873
3544a4a94a2a checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1870
diff changeset
  1935
3544a4a94a2a checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1870
diff changeset
  1936
    "Modified: 4.11.1996 / 22:58:02 / cg"
3544a4a94a2a checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1870
diff changeset
  1937
!
3544a4a94a2a checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1870
diff changeset
  1938
3544a4a94a2a checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1870
diff changeset
  1939
unloadedCodeObject
3544a4a94a2a checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1870
diff changeset
  1940
    "{ Pragma: +optSpace }"
3544a4a94a2a checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1870
diff changeset
  1941
3544a4a94a2a checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1870
diff changeset
  1942
    "this method is invoked by methods which have been binary-unloaded
3544a4a94a2a checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1870
diff changeset
  1943
     For those the source info consists
3544a4a94a2a checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1870
diff changeset
  1944
     of the original source code, but with this methods machine/byte code."
3544a4a94a2a checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1870
diff changeset
  1945
3544a4a94a2a checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1870
diff changeset
  1946
%{
3544a4a94a2a checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1870
diff changeset
  1947
    /*
3544a4a94a2a checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1870
diff changeset
  1948
     * for reasons too far from being explained here,
3544a4a94a2a checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1870
diff changeset
  1949
     * this MUST be a compiled method
3544a4a94a2a checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1870
diff changeset
  1950
     */
3544a4a94a2a checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1870
diff changeset
  1951
%}.
7601
57c257f1150a Fix race when accessing source
Stefan Vogel <sv@exept.de>
parents: 7457
diff changeset
  1952
    ^ InvalidCodeError
18620
b4e9f25d6ce6 preparations for lined index list in WeakArray
Claus Gittinger <cg@exept.de>
parents: 18462
diff changeset
  1953
	raiseRequestWith:self
b4e9f25d6ce6 preparations for lined index list in WeakArray
Claus Gittinger <cg@exept.de>
parents: 18462
diff changeset
  1954
	errorString:'invalid method - unloaded'.
1873
3544a4a94a2a checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1870
diff changeset
  1955
3544a4a94a2a checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1870
diff changeset
  1956
    "Created: 4.11.1996 / 22:57:54 / cg"
3544a4a94a2a checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1870
diff changeset
  1957
    "Modified: 4.11.1996 / 22:58:28 / cg"
1
a27a279701f8 Initial revision
claus
parents:
diff changeset
  1958
! !
a27a279701f8 Initial revision
claus
parents:
diff changeset
  1959
9987
2ca75ae430c4 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9827
diff changeset
  1960
93
e31220cb391f *** empty log message ***
claus
parents: 88
diff changeset
  1961
!Method methodsFor:'printing & storing'!
1
a27a279701f8 Initial revision
claus
parents:
diff changeset
  1962
a27a279701f8 Initial revision
claus
parents:
diff changeset
  1963
printOn:aStream
56
be0ed17e6f85 *** empty log message ***
claus
parents: 49
diff changeset
  1964
    "put a printed representation of the receiver onto aStream.
be0ed17e6f85 *** empty log message ***
claus
parents: 49
diff changeset
  1965
     Since methods do not store their class/selector, we have to search
be0ed17e6f85 *** empty log message ***
claus
parents: 49
diff changeset
  1966
     for it here."
1
a27a279701f8 Initial revision
claus
parents:
diff changeset
  1967
227
23b1c4de3402 package & cleanup
claus
parents: 216
diff changeset
  1968
    |classAndSelector m wrapped|
1
a27a279701f8 Initial revision
claus
parents:
diff changeset
  1969
253
30daee717a53 *** empty log message ***
claus
parents: 227
diff changeset
  1970
    wrapped := false.
30daee717a53 *** empty log message ***
claus
parents: 227
diff changeset
  1971
6234
d8083875f657 fixed pixmap readout for win32, where red and green are exchanged
Claus Gittinger <cg@exept.de>
parents: 6160
diff changeset
  1972
    self basicPrintOn:aStream."/ aStream nextPutAll:(self classNameWithArticle).
159
514c749165c3 *** empty log message ***
claus
parents: 142
diff changeset
  1973
    aStream nextPut:$(.
227
23b1c4de3402 package & cleanup
claus
parents: 216
diff changeset
  1974
176
48061f8659aa more queries
claus
parents: 159
diff changeset
  1975
    classAndSelector := self who.
227
23b1c4de3402 package & cleanup
claus
parents: 216
diff changeset
  1976
    classAndSelector isNil ifTrue:[
19847
ef7bf75df3ee #DOCUMENTATION by cg
Claus Gittinger <cg@exept.de>
parents: 19782
diff changeset
  1977
        "
ef7bf75df3ee #DOCUMENTATION by cg
Claus Gittinger <cg@exept.de>
parents: 19782
diff changeset
  1978
         not anchored in any class.
ef7bf75df3ee #DOCUMENTATION by cg
Claus Gittinger <cg@exept.de>
parents: 19782
diff changeset
  1979
         check if wrapped (to be more informative in inspectors)
ef7bf75df3ee #DOCUMENTATION by cg
Claus Gittinger <cg@exept.de>
parents: 19782
diff changeset
  1980
        "
ef7bf75df3ee #DOCUMENTATION by cg
Claus Gittinger <cg@exept.de>
parents: 19782
diff changeset
  1981
        m := self wrapper.
ef7bf75df3ee #DOCUMENTATION by cg
Claus Gittinger <cg@exept.de>
parents: 19782
diff changeset
  1982
        m notNil ifTrue:[
ef7bf75df3ee #DOCUMENTATION by cg
Claus Gittinger <cg@exept.de>
parents: 19782
diff changeset
  1983
            classAndSelector := m who.
ef7bf75df3ee #DOCUMENTATION by cg
Claus Gittinger <cg@exept.de>
parents: 19782
diff changeset
  1984
            wrapped := true.
ef7bf75df3ee #DOCUMENTATION by cg
Claus Gittinger <cg@exept.de>
parents: 19782
diff changeset
  1985
        ]
227
23b1c4de3402 package & cleanup
claus
parents: 216
diff changeset
  1986
    ].
176
48061f8659aa more queries
claus
parents: 159
diff changeset
  1987
    classAndSelector notNil ifTrue:[
19847
ef7bf75df3ee #DOCUMENTATION by cg
Claus Gittinger <cg@exept.de>
parents: 19782
diff changeset
  1988
        (classAndSelector methodClass) name printOn:aStream.
ef7bf75df3ee #DOCUMENTATION by cg
Claus Gittinger <cg@exept.de>
parents: 19782
diff changeset
  1989
        "/ print out in a form that can directly be evaluated (>> is a selector in Behavior)
21156
975c87964fac #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 20804
diff changeset
  1990
        "/ in order to not break existing code which parses those strings,
21937
2cea97649a40 #DOCUMENTATION by cg
Claus Gittinger <cg@exept.de>
parents: 21765
diff changeset
  1991
        "/ do not replace '>>' by ' » '
19847
ef7bf75df3ee #DOCUMENTATION by cg
Claus Gittinger <cg@exept.de>
parents: 19782
diff changeset
  1992
        aStream nextPutAll:' >> '.
ef7bf75df3ee #DOCUMENTATION by cg
Claus Gittinger <cg@exept.de>
parents: 19782
diff changeset
  1993
        (classAndSelector methodSelector) printOn:aStream.
1
a27a279701f8 Initial revision
claus
parents:
diff changeset
  1994
    ] ifFalse:[
19847
ef7bf75df3ee #DOCUMENTATION by cg
Claus Gittinger <cg@exept.de>
parents: 19782
diff changeset
  1995
        "
ef7bf75df3ee #DOCUMENTATION by cg
Claus Gittinger <cg@exept.de>
parents: 19782
diff changeset
  1996
         sorry, a method which is nowhere anchored
ef7bf75df3ee #DOCUMENTATION by cg
Claus Gittinger <cg@exept.de>
parents: 19782
diff changeset
  1997
        "
ef7bf75df3ee #DOCUMENTATION by cg
Claus Gittinger <cg@exept.de>
parents: 19782
diff changeset
  1998
        aStream nextPutAll:'unbound'
56
be0ed17e6f85 *** empty log message ***
claus
parents: 49
diff changeset
  1999
    ].
13101
7dc4234a844d changed: #printOn:
Claus Gittinger <cg@exept.de>
parents: 13100
diff changeset
  2000
    aStream nextPut:$).
7dc4234a844d changed: #printOn:
Claus Gittinger <cg@exept.de>
parents: 13100
diff changeset
  2001
7dc4234a844d changed: #printOn:
Claus Gittinger <cg@exept.de>
parents: 13100
diff changeset
  2002
    wrapped ifTrue:[
19847
ef7bf75df3ee #DOCUMENTATION by cg
Claus Gittinger <cg@exept.de>
parents: 19782
diff changeset
  2003
        aStream nextPutAll:'; wrapped'
13101
7dc4234a844d changed: #printOn:
Claus Gittinger <cg@exept.de>
parents: 13100
diff changeset
  2004
    ].
176
48061f8659aa more queries
claus
parents: 159
diff changeset
  2005
48061f8659aa more queries
claus
parents: 159
diff changeset
  2006
    "
253
30daee717a53 *** empty log message ***
claus
parents: 227
diff changeset
  2007
     (Object compiledMethodAt:#at:) printOn:Transcript. Transcript cr.
30daee717a53 *** empty log message ***
claus
parents: 227
diff changeset
  2008
     (Object compiledMethodAt:#at:) copy printOn:Transcript. Transcript cr.
10083
8cec9ab7373e *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10044
diff changeset
  2009
8cec9ab7373e *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10044
diff changeset
  2010
     (Object compiledMethodAt:#at:) whoString printOn:Transcript. Transcript cr.
8cec9ab7373e *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10044
diff changeset
  2011
     (Object compiledMethodAt:#at:) copy whoString printOn:Transcript. Transcript cr.
176
48061f8659aa more queries
claus
parents: 159
diff changeset
  2012
    "
1851
4accc9fafd19 change #who to return a proper object
Claus Gittinger <cg@exept.de>
parents: 1813
diff changeset
  2013
13101
7dc4234a844d changed: #printOn:
Claus Gittinger <cg@exept.de>
parents: 13100
diff changeset
  2014
    "Modified: / 22-10-2010 / 12:07:25 / cg"
952
d600e08a5936 handle the case where a method has a sourceFileInfo, but the class has not
Claus Gittinger <cg@exept.de>
parents: 934
diff changeset
  2015
!
d600e08a5936 handle the case where a method has a sourceFileInfo, but the class has not
Claus Gittinger <cg@exept.de>
parents: 934
diff changeset
  2016
d600e08a5936 handle the case where a method has a sourceFileInfo, but the class has not
Claus Gittinger <cg@exept.de>
parents: 934
diff changeset
  2017
whoString
d600e08a5936 handle the case where a method has a sourceFileInfo, but the class has not
Claus Gittinger <cg@exept.de>
parents: 934
diff changeset
  2018
    "return a string as className>>selector, if this is not an unbound
20208
79b24601b7d6 #OTHER by mawalch
mawalch
parents: 20035
diff changeset
  2019
     method.
19782
41efda05474e #DOCUMENTATION by cg
Claus Gittinger <cg@exept.de>
parents: 19739
diff changeset
  2020
     Otherwise return 'unbound'. Used with debugging."
952
d600e08a5936 handle the case where a method has a sourceFileInfo, but the class has not
Claus Gittinger <cg@exept.de>
parents: 934
diff changeset
  2021
1851
4accc9fafd19 change #who to return a proper object
Claus Gittinger <cg@exept.de>
parents: 1813
diff changeset
  2022
    |who|
952
d600e08a5936 handle the case where a method has a sourceFileInfo, but the class has not
Claus Gittinger <cg@exept.de>
parents: 934
diff changeset
  2023
1851
4accc9fafd19 change #who to return a proper object
Claus Gittinger <cg@exept.de>
parents: 1813
diff changeset
  2024
    who := self who.
4accc9fafd19 change #who to return a proper object
Claus Gittinger <cg@exept.de>
parents: 1813
diff changeset
  2025
    who notNil ifTrue:[
19782
41efda05474e #DOCUMENTATION by cg
Claus Gittinger <cg@exept.de>
parents: 19739
diff changeset
  2026
        "/ in order to not break existing code which parses those strings,
21937
2cea97649a40 #DOCUMENTATION by cg
Claus Gittinger <cg@exept.de>
parents: 21765
diff changeset
  2027
        "/ do not replace '>>' by ' » '
19782
41efda05474e #DOCUMENTATION by cg
Claus Gittinger <cg@exept.de>
parents: 19739
diff changeset
  2028
        ^ who methodClass name , ' >> ' , (who methodSelector storeString)
952
d600e08a5936 handle the case where a method has a sourceFileInfo, but the class has not
Claus Gittinger <cg@exept.de>
parents: 934
diff changeset
  2029
    ].
6071
c10946059080 whoString can be evaluated
Claus Gittinger <cg@exept.de>
parents: 6058
diff changeset
  2030
    ^ 'unboundMethod'
952
d600e08a5936 handle the case where a method has a sourceFileInfo, but the class has not
Claus Gittinger <cg@exept.de>
parents: 934
diff changeset
  2031
d600e08a5936 handle the case where a method has a sourceFileInfo, but the class has not
Claus Gittinger <cg@exept.de>
parents: 934
diff changeset
  2032
    "
12854
3a3d3c02c3bd *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 12695
diff changeset
  2033
     Method new whoString
952
d600e08a5936 handle the case where a method has a sourceFileInfo, but the class has not
Claus Gittinger <cg@exept.de>
parents: 934
diff changeset
  2034
     (Method compiledMethodAt:#whoString) whoString
d600e08a5936 handle the case where a method has a sourceFileInfo, but the class has not
Claus Gittinger <cg@exept.de>
parents: 934
diff changeset
  2035
    "
1851
4accc9fafd19 change #who to return a proper object
Claus Gittinger <cg@exept.de>
parents: 1813
diff changeset
  2036
4accc9fafd19 change #who to return a proper object
Claus Gittinger <cg@exept.de>
parents: 1813
diff changeset
  2037
    "Modified: 1.11.1996 / 16:27:04 / cg"
21156
975c87964fac #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 20804
diff changeset
  2038
!
975c87964fac #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 20804
diff changeset
  2039
22973
5e663a40211e #DOCUMENTATION by cg
Claus Gittinger <cg@exept.de>
parents: 22801
diff changeset
  2040
whoStringWith:sepString
5e663a40211e #DOCUMENTATION by cg
Claus Gittinger <cg@exept.de>
parents: 22801
diff changeset
  2041
    "return a string like className>>selector, where '>>' is replaced by sepString. 
5e663a40211e #DOCUMENTATION by cg
Claus Gittinger <cg@exept.de>
parents: 22801
diff changeset
  2042
     If this is an unbound method, return 'unbound'. 
5e663a40211e #DOCUMENTATION by cg
Claus Gittinger <cg@exept.de>
parents: 22801
diff changeset
  2043
     Used with debugging."
21156
975c87964fac #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 20804
diff changeset
  2044
975c87964fac #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 20804
diff changeset
  2045
    |who|
975c87964fac #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 20804
diff changeset
  2046
975c87964fac #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 20804
diff changeset
  2047
    who := self who.
975c87964fac #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 20804
diff changeset
  2048
    who notNil ifTrue:[
22973
5e663a40211e #DOCUMENTATION by cg
Claus Gittinger <cg@exept.de>
parents: 22801
diff changeset
  2049
        ^ who methodClass name , sepString , (who methodSelector storeString)
21156
975c87964fac #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 20804
diff changeset
  2050
    ].
975c87964fac #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 20804
diff changeset
  2051
    ^ 'unboundMethod'
975c87964fac #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 20804
diff changeset
  2052
975c87964fac #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 20804
diff changeset
  2053
    "
975c87964fac #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 20804
diff changeset
  2054
     Method new whoStringWith:' >> '
975c87964fac #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 20804
diff changeset
  2055
     (Method compiledMethodAt:#whoString) whoStringWith:' >> '
21937
2cea97649a40 #DOCUMENTATION by cg
Claus Gittinger <cg@exept.de>
parents: 21765
diff changeset
  2056
     (Method compiledMethodAt:#whoString) whoStringWith:' » '
21157
c4dc25f898da #DOCUMENTATION by cg
Claus Gittinger <cg@exept.de>
parents: 21156
diff changeset
  2057
     (Method compiledMethodAt:#whoString) whoStringWith:' -> '
21156
975c87964fac #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 20804
diff changeset
  2058
    "
1
a27a279701f8 Initial revision
claus
parents:
diff changeset
  2059
! !
a27a279701f8 Initial revision
claus
parents:
diff changeset
  2060
8141
41b25e5f7532 sourceStream access refactored (preps for utf8 decoding)
Claus Gittinger <cg@exept.de>
parents: 8117
diff changeset
  2061
!Method methodsFor:'private'!
41b25e5f7532 sourceStream access refactored (preps for utf8 decoding)
Claus Gittinger <cg@exept.de>
parents: 8117
diff changeset
  2062
13422
b43a8a47037c Jan's changes
vrany
parents: 13390
diff changeset
  2063
annotationAtIndex: index
14253
Claus Gittinger <cg@exept.de>
parents: 14251
diff changeset
  2064
    "return the annotation at given index.
18411
e6d26bb9b37b class: Method
Claus Gittinger <cg@exept.de>
parents: 18368
diff changeset
  2065
     any raw annotation array (as generated by the compiler)
e6d26bb9b37b class: Method
Claus Gittinger <cg@exept.de>
parents: 18368
diff changeset
  2066
     is lazily initialized from the 2-element format to real annotation instances here.
e6d26bb9b37b class: Method
Claus Gittinger <cg@exept.de>
parents: 18368
diff changeset
  2067
     This is done to avoid the need for knowledge about annotation instances in the stc compiler."
13422
b43a8a47037c Jan's changes
vrany
parents: 13390
diff changeset
  2068
13662
7d7ae1e5f589 changed: #annotationAtIndex:
Claus Gittinger <cg@exept.de>
parents: 13660
diff changeset
  2069
    | annotationOrArray annotation args |
13683
1b6be902030b comment/format in: #annotationAtIndex:
Claus Gittinger <cg@exept.de>
parents: 13679
diff changeset
  2070
13817
7d1e0e8ea364 changed:10 methods
Claus Gittinger <cg@exept.de>
parents: 13805
diff changeset
  2071
    annotations isNil ifTrue:[^nil].
18411
e6d26bb9b37b class: Method
Claus Gittinger <cg@exept.de>
parents: 18368
diff changeset
  2072
13662
7d7ae1e5f589 changed: #annotationAtIndex:
Claus Gittinger <cg@exept.de>
parents: 13660
diff changeset
  2073
    annotationOrArray := annotation := annotations at: index.
7d7ae1e5f589 changed: #annotationAtIndex:
Claus Gittinger <cg@exept.de>
parents: 13660
diff changeset
  2074
    annotationOrArray isArray ifTrue:[
20547
72ae31e8718b #BUGFIX by stefan
Stefan Vogel <sv@exept.de>
parents: 20209
diff changeset
  2075
        args := annotationOrArray size == 2
72ae31e8718b #BUGFIX by stefan
Stefan Vogel <sv@exept.de>
parents: 20209
diff changeset
  2076
                    ifTrue:[annotationOrArray second]
72ae31e8718b #BUGFIX by stefan
Stefan Vogel <sv@exept.de>
parents: 20209
diff changeset
  2077
                    ifFalse:[#()].
72ae31e8718b #BUGFIX by stefan
Stefan Vogel <sv@exept.de>
parents: 20209
diff changeset
  2078
        args isArray ifFalse:[args := Array with: args].
21373
d8c34dd8952f #DOCUMENTATION by cg
Claus Gittinger <cg@exept.de>
parents: 21372
diff changeset
  2079
        annotation := Annotation method:self key: annotationOrArray first arguments: args.
d8c34dd8952f #DOCUMENTATION by cg
Claus Gittinger <cg@exept.de>
parents: 21372
diff changeset
  2080
                        
d8c34dd8952f #DOCUMENTATION by cg
Claus Gittinger <cg@exept.de>
parents: 21372
diff changeset
  2081
        "/ unknown annotations are not written back,
d8c34dd8952f #DOCUMENTATION by cg
Claus Gittinger <cg@exept.de>
parents: 21372
diff changeset
  2082
        "/ to give later loaded annotation classes a chance to create
d8c34dd8952f #DOCUMENTATION by cg
Claus Gittinger <cg@exept.de>
parents: 21372
diff changeset
  2083
        "/ a proper instance (otherwise, it would be and remain an unknown annotation)
20547
72ae31e8718b #BUGFIX by stefan
Stefan Vogel <sv@exept.de>
parents: 20209
diff changeset
  2084
        annotation isUnknown ifFalse:[
72ae31e8718b #BUGFIX by stefan
Stefan Vogel <sv@exept.de>
parents: 20209
diff changeset
  2085
            annotations isImmutable ifTrue:[
72ae31e8718b #BUGFIX by stefan
Stefan Vogel <sv@exept.de>
parents: 20209
diff changeset
  2086
                annotations := annotations asMutableCollection
72ae31e8718b #BUGFIX by stefan
Stefan Vogel <sv@exept.de>
parents: 20209
diff changeset
  2087
            ].
72ae31e8718b #BUGFIX by stefan
Stefan Vogel <sv@exept.de>
parents: 20209
diff changeset
  2088
            annotations at: index put: annotation.
13422
b43a8a47037c Jan's changes
vrany
parents: 13390
diff changeset
  2089
"/            annotation annotatesMethod: self
20547
72ae31e8718b #BUGFIX by stefan
Stefan Vogel <sv@exept.de>
parents: 20209
diff changeset
  2090
        ].
21372
3b87306d0b09 #DOCUMENTATION by cg
Claus Gittinger <cg@exept.de>
parents: 21341
diff changeset
  2091
    ].    
13422
b43a8a47037c Jan's changes
vrany
parents: 13390
diff changeset
  2092
    ^annotation
b43a8a47037c Jan's changes
vrany
parents: 13390
diff changeset
  2093
b43a8a47037c Jan's changes
vrany
parents: 13390
diff changeset
  2094
    "Created: / 02-07-2010 / 22:30:44 / Jan Vrany <jan.vrany@fit.cvut.cz>"
b43a8a47037c Jan's changes
vrany
parents: 13390
diff changeset
  2095
    "Modified: / 11-07-2010 / 19:39:33 / Jan Vrany <jan.vrany@fit.cvut.cz>"
21373
d8c34dd8952f #DOCUMENTATION by cg
Claus Gittinger <cg@exept.de>
parents: 21372
diff changeset
  2096
    "Modified (format): / 07-02-2017 / 20:17:30 / cg"
13422
b43a8a47037c Jan's changes
vrany
parents: 13390
diff changeset
  2097
!
b43a8a47037c Jan's changes
vrany
parents: 13390
diff changeset
  2098
b43a8a47037c Jan's changes
vrany
parents: 13390
diff changeset
  2099
annotationIndexOf: key
14253
Claus Gittinger <cg@exept.de>
parents: 14251
diff changeset
  2100
    "Returns the index of annotation with given key
13422
b43a8a47037c Jan's changes
vrany
parents: 13390
diff changeset
  2101
     or nil if there is no such annotation"
b43a8a47037c Jan's changes
vrany
parents: 13390
diff changeset
  2102
13817
7d1e0e8ea364 changed:10 methods
Claus Gittinger <cg@exept.de>
parents: 13805
diff changeset
  2103
    annotations isNil ifTrue:[^nil].
7d1e0e8ea364 changed:10 methods
Claus Gittinger <cg@exept.de>
parents: 13805
diff changeset
  2104
7d1e0e8ea364 changed:10 methods
Claus Gittinger <cg@exept.de>
parents: 13805
diff changeset
  2105
    annotations keysAndValuesDo: [:index :annotationOrArray|
18620
b4e9f25d6ce6 preparations for lined index list in WeakArray
Claus Gittinger <cg@exept.de>
parents: 18462
diff changeset
  2106
	annotationOrArray isArray
b4e9f25d6ce6 preparations for lined index list in WeakArray
Claus Gittinger <cg@exept.de>
parents: 18462
diff changeset
  2107
	    ifTrue: [annotationOrArray first == key ifTrue:[^index]]
b4e9f25d6ce6 preparations for lined index list in WeakArray
Claus Gittinger <cg@exept.de>
parents: 18462
diff changeset
  2108
	    ifFalse:[annotationOrArray key == key ifTrue:[^index]]
13817
7d1e0e8ea364 changed:10 methods
Claus Gittinger <cg@exept.de>
parents: 13805
diff changeset
  2109
    ].
13422
b43a8a47037c Jan's changes
vrany
parents: 13390
diff changeset
  2110
    ^nil.
b43a8a47037c Jan's changes
vrany
parents: 13390
diff changeset
  2111
b43a8a47037c Jan's changes
vrany
parents: 13390
diff changeset
  2112
    "Created: / 19-05-2010 / 16:40:32 / Jan Vrany <jan.vrany@fit.cvut.cz>"
b43a8a47037c Jan's changes
vrany
parents: 13390
diff changeset
  2113
    "Modified: / 11-07-2010 / 19:23:21 / Jan Vrany <jan.vrany@fit.cvut.cz>"
14253
Claus Gittinger <cg@exept.de>
parents: 14251
diff changeset
  2114
    "Modified (comment): / 26-07-2012 / 15:48:14 / cg"
13422
b43a8a47037c Jan's changes
vrany
parents: 13390
diff changeset
  2115
!
b43a8a47037c Jan's changes
vrany
parents: 13390
diff changeset
  2116
12695
14b7044c2e4a changed:
Stefan Vogel <sv@exept.de>
parents: 12682
diff changeset
  2117
cacheSourceStream:aStream
14b7044c2e4a changed:
Stefan Vogel <sv@exept.de>
parents: 12682
diff changeset
  2118
    "remember a (raw) source stream for later use"
14b7044c2e4a changed:
Stefan Vogel <sv@exept.de>
parents: 12682
diff changeset
  2119
14b7044c2e4a changed:
Stefan Vogel <sv@exept.de>
parents: 12682
diff changeset
  2120
    |lastStream|
14b7044c2e4a changed:
Stefan Vogel <sv@exept.de>
parents: 12682
diff changeset
  2121
14b7044c2e4a changed:
Stefan Vogel <sv@exept.de>
parents: 12682
diff changeset
  2122
    (package notNil and:[package ~= PackageId noProjectID]) ifTrue:[
18620
b4e9f25d6ce6 preparations for lined index list in WeakArray
Claus Gittinger <cg@exept.de>
parents: 18462
diff changeset
  2123
	LastFileLock critical:[
b4e9f25d6ce6 preparations for lined index list in WeakArray
Claus Gittinger <cg@exept.de>
parents: 18462
diff changeset
  2124
	    lastStream := LastFileReference at:1.
b4e9f25d6ce6 preparations for lined index list in WeakArray
Claus Gittinger <cg@exept.de>
parents: 18462
diff changeset
  2125
	    (lastStream notNil
b4e9f25d6ce6 preparations for lined index list in WeakArray
Claus Gittinger <cg@exept.de>
parents: 18462
diff changeset
  2126
	      and:[lastStream class ~~ SmallInteger
b4e9f25d6ce6 preparations for lined index list in WeakArray
Claus Gittinger <cg@exept.de>
parents: 18462
diff changeset
  2127
	      and:[lastStream isOpen]]) ifTrue:[
b4e9f25d6ce6 preparations for lined index list in WeakArray
Claus Gittinger <cg@exept.de>
parents: 18462
diff changeset
  2128
		lastStream close.
b4e9f25d6ce6 preparations for lined index list in WeakArray
Claus Gittinger <cg@exept.de>
parents: 18462
diff changeset
  2129
	    ].
b4e9f25d6ce6 preparations for lined index list in WeakArray
Claus Gittinger <cg@exept.de>
parents: 18462
diff changeset
  2130
	    LastSourceFileName := package,'/',source.
b4e9f25d6ce6 preparations for lined index list in WeakArray
Claus Gittinger <cg@exept.de>
parents: 18462
diff changeset
  2131
	    LastFileReference at:1 put:aStream.
b4e9f25d6ce6 preparations for lined index list in WeakArray
Claus Gittinger <cg@exept.de>
parents: 18462
diff changeset
  2132
	].
12695
14b7044c2e4a changed:
Stefan Vogel <sv@exept.de>
parents: 12682
diff changeset
  2133
    ].
14b7044c2e4a changed:
Stefan Vogel <sv@exept.de>
parents: 12682
diff changeset
  2134
!
14b7044c2e4a changed:
Stefan Vogel <sv@exept.de>
parents: 12682
diff changeset
  2135
13422
b43a8a47037c Jan's changes
vrany
parents: 13390
diff changeset
  2136
getAnnotations
b43a8a47037c Jan's changes
vrany
parents: 13390
diff changeset
  2137
    ^annotations
b43a8a47037c Jan's changes
vrany
parents: 13390
diff changeset
  2138
b43a8a47037c Jan's changes
vrany
parents: 13390
diff changeset
  2139
    "Created: / 10-07-2010 / 21:55:02 / Jan Vrany <jan.vrany@fit.cvut.cz>"
b43a8a47037c Jan's changes
vrany
parents: 13390
diff changeset
  2140
    "Modified: / 11-07-2010 / 19:30:13 / Jan Vrany <jan.vrany@fit.cvut.cz>"
14253
Claus Gittinger <cg@exept.de>
parents: 14251
diff changeset
  2141
    "Modified (format): / 26-07-2012 / 15:49:38 / cg"
13422
b43a8a47037c Jan's changes
vrany
parents: 13390
diff changeset
  2142
!
b43a8a47037c Jan's changes
vrany
parents: 13390
diff changeset
  2143
b43a8a47037c Jan's changes
vrany
parents: 13390
diff changeset
  2144
getLookupObject
b43a8a47037c Jan's changes
vrany
parents: 13390
diff changeset
  2145
b43a8a47037c Jan's changes
vrany
parents: 13390
diff changeset
  2146
    ^lookupObject
b43a8a47037c Jan's changes
vrany
parents: 13390
diff changeset
  2147
b43a8a47037c Jan's changes
vrany
parents: 13390
diff changeset
  2148
    "Created: / 10-07-2010 / 21:55:02 / Jan Vrany <jan.vrany@fit.cvut.cz>"
b43a8a47037c Jan's changes
vrany
parents: 13390
diff changeset
  2149
!
b43a8a47037c Jan's changes
vrany
parents: 13390
diff changeset
  2150
8141
41b25e5f7532 sourceStream access refactored (preps for utf8 decoding)
Claus Gittinger <cg@exept.de>
parents: 8117
diff changeset
  2151
localSourceStream
41b25e5f7532 sourceStream access refactored (preps for utf8 decoding)
Claus Gittinger <cg@exept.de>
parents: 8117
diff changeset
  2152
    "try to open a stream from a local source file,
41b25e5f7532 sourceStream access refactored (preps for utf8 decoding)
Claus Gittinger <cg@exept.de>
parents: 8117
diff changeset
  2153
     searching in standard places."
41b25e5f7532 sourceStream access refactored (preps for utf8 decoding)
Claus Gittinger <cg@exept.de>
parents: 8117
diff changeset
  2154
8216
3b56b52db477 getpackageDir
ca
parents: 8169
diff changeset
  2155
    |dir fileName aStream|
8141
41b25e5f7532 sourceStream access refactored (preps for utf8 decoding)
Claus Gittinger <cg@exept.de>
parents: 8117
diff changeset
  2156
41b25e5f7532 sourceStream access refactored (preps for utf8 decoding)
Claus Gittinger <cg@exept.de>
parents: 8117
diff changeset
  2157
    package notNil ifTrue:[
18620
b4e9f25d6ce6 preparations for lined index list in WeakArray
Claus Gittinger <cg@exept.de>
parents: 18462
diff changeset
  2158
	"/
b4e9f25d6ce6 preparations for lined index list in WeakArray
Claus Gittinger <cg@exept.de>
parents: 18462
diff changeset
  2159
	"/ old: look in 'source/<filename>'
b4e9f25d6ce6 preparations for lined index list in WeakArray
Claus Gittinger <cg@exept.de>
parents: 18462
diff changeset
  2160
	"/ this is still kept in order to find user-private
b4e9f25d6ce6 preparations for lined index list in WeakArray
Claus Gittinger <cg@exept.de>
parents: 18462
diff changeset
  2161
	"/ classes in her currentDirectory.
b4e9f25d6ce6 preparations for lined index list in WeakArray
Claus Gittinger <cg@exept.de>
parents: 18462
diff changeset
  2162
	"/
b4e9f25d6ce6 preparations for lined index list in WeakArray
Claus Gittinger <cg@exept.de>
parents: 18462
diff changeset
  2163
	fileName := Smalltalk getSourceFileName:(package copyReplaceAll:$: with:$/) , '/' , source.
b4e9f25d6ce6 preparations for lined index list in WeakArray
Claus Gittinger <cg@exept.de>
parents: 18462
diff changeset
  2164
	fileName notNil ifTrue:[
b4e9f25d6ce6 preparations for lined index list in WeakArray
Claus Gittinger <cg@exept.de>
parents: 18462
diff changeset
  2165
	    aStream := fileName asFilename readStreamOrNil.
b4e9f25d6ce6 preparations for lined index list in WeakArray
Claus Gittinger <cg@exept.de>
parents: 18462
diff changeset
  2166
	    aStream notNil ifTrue:[^ aStream].
b4e9f25d6ce6 preparations for lined index list in WeakArray
Claus Gittinger <cg@exept.de>
parents: 18462
diff changeset
  2167
	].
b4e9f25d6ce6 preparations for lined index list in WeakArray
Claus Gittinger <cg@exept.de>
parents: 18462
diff changeset
  2168
	"/
b4e9f25d6ce6 preparations for lined index list in WeakArray
Claus Gittinger <cg@exept.de>
parents: 18462
diff changeset
  2169
	"/ new: look in package-dir
b4e9f25d6ce6 preparations for lined index list in WeakArray
Claus Gittinger <cg@exept.de>
parents: 18462
diff changeset
  2170
	"/
b4e9f25d6ce6 preparations for lined index list in WeakArray
Claus Gittinger <cg@exept.de>
parents: 18462
diff changeset
  2171
	dir := Smalltalk getPackageDirectoryForPackage:package.
b4e9f25d6ce6 preparations for lined index list in WeakArray
Claus Gittinger <cg@exept.de>
parents: 18462
diff changeset
  2172
	dir notNil ifTrue:[
b4e9f25d6ce6 preparations for lined index list in WeakArray
Claus Gittinger <cg@exept.de>
parents: 18462
diff changeset
  2173
	    fileName := dir construct:source.
b4e9f25d6ce6 preparations for lined index list in WeakArray
Claus Gittinger <cg@exept.de>
parents: 18462
diff changeset
  2174
	    aStream := fileName asFilename readStreamOrNil.
b4e9f25d6ce6 preparations for lined index list in WeakArray
Claus Gittinger <cg@exept.de>
parents: 18462
diff changeset
  2175
	    aStream notNil ifTrue:[^ aStream].
b4e9f25d6ce6 preparations for lined index list in WeakArray
Claus Gittinger <cg@exept.de>
parents: 18462
diff changeset
  2176
	].
8141
41b25e5f7532 sourceStream access refactored (preps for utf8 decoding)
Claus Gittinger <cg@exept.de>
parents: 8117
diff changeset
  2177
    ].
41b25e5f7532 sourceStream access refactored (preps for utf8 decoding)
Claus Gittinger <cg@exept.de>
parents: 8117
diff changeset
  2178
    fileName := Smalltalk getSourceFileName:source.
41b25e5f7532 sourceStream access refactored (preps for utf8 decoding)
Claus Gittinger <cg@exept.de>
parents: 8117
diff changeset
  2179
    fileName notNil ifTrue:[
18620
b4e9f25d6ce6 preparations for lined index list in WeakArray
Claus Gittinger <cg@exept.de>
parents: 18462
diff changeset
  2180
	aStream := fileName asFilename readStreamOrNil.
8141
41b25e5f7532 sourceStream access refactored (preps for utf8 decoding)
Claus Gittinger <cg@exept.de>
parents: 8117
diff changeset
  2181
    ].
41b25e5f7532 sourceStream access refactored (preps for utf8 decoding)
Claus Gittinger <cg@exept.de>
parents: 8117
diff changeset
  2182
    ^ aStream
41b25e5f7532 sourceStream access refactored (preps for utf8 decoding)
Claus Gittinger <cg@exept.de>
parents: 8117
diff changeset
  2183
!
41b25e5f7532 sourceStream access refactored (preps for utf8 decoding)
Claus Gittinger <cg@exept.de>
parents: 8117
diff changeset
  2184
12682
Stefan Vogel <sv@exept.de>
parents: 12620
diff changeset
  2185
rawSourceStreamUsingCache:usingCacheBoolean
Stefan Vogel <sv@exept.de>
parents: 12620
diff changeset
  2186
    "return an open sourceStream (needs positioning).
Stefan Vogel <sv@exept.de>
parents: 12620
diff changeset
  2187
     If usingCacheBoolean is true, cache the stream (but take care against concurrent access).
13390
3bee59036719 comment/format in: #rawSourceStreamUsingCache:
Stefan Vogel <sv@exept.de>
parents: 13381
diff changeset
  2188
     You have to close the stream, if usingCacheBoolean is false, and should not close it
12682
Stefan Vogel <sv@exept.de>
parents: 12620
diff changeset
  2189
     if usingCacheBoolean is true."
8141
41b25e5f7532 sourceStream access refactored (preps for utf8 decoding)
Claus Gittinger <cg@exept.de>
parents: 8117
diff changeset
  2190
15952
e55b89f8d241 class: Method
Claus Gittinger <cg@exept.de>
parents: 15787
diff changeset
  2191
    |aStream fileName who myClass mgr className classNameSymbol dir mod pkgDef |
8141
41b25e5f7532 sourceStream access refactored (preps for utf8 decoding)
Claus Gittinger <cg@exept.de>
parents: 8117
diff changeset
  2192
41b25e5f7532 sourceStream access refactored (preps for utf8 decoding)
Claus Gittinger <cg@exept.de>
parents: 8117
diff changeset
  2193
    "
41b25e5f7532 sourceStream access refactored (preps for utf8 decoding)
Claus Gittinger <cg@exept.de>
parents: 8117
diff changeset
  2194
     if sourcePosition is nonNil, its the fileName and
41b25e5f7532 sourceStream access refactored (preps for utf8 decoding)
Claus Gittinger <cg@exept.de>
parents: 8117
diff changeset
  2195
     abs(sourcePosition) is the offset.
41b25e5f7532 sourceStream access refactored (preps for utf8 decoding)
Claus Gittinger <cg@exept.de>
parents: 8117
diff changeset
  2196
     Otherwise, source is the real source
41b25e5f7532 sourceStream access refactored (preps for utf8 decoding)
Claus Gittinger <cg@exept.de>
parents: 8117
diff changeset
  2197
    "
41b25e5f7532 sourceStream access refactored (preps for utf8 decoding)
Claus Gittinger <cg@exept.de>
parents: 8117
diff changeset
  2198
    source isNil ifTrue:[^ nil].
41b25e5f7532 sourceStream access refactored (preps for utf8 decoding)
Claus Gittinger <cg@exept.de>
parents: 8117
diff changeset
  2199
    sourcePosition isNil ifTrue:[^ source readStream].
41b25e5f7532 sourceStream access refactored (preps for utf8 decoding)
Claus Gittinger <cg@exept.de>
parents: 8117
diff changeset
  2200
12682
Stefan Vogel <sv@exept.de>
parents: 12620
diff changeset
  2201
    usingCacheBoolean ifTrue:[
20035
74774e1ee05d #REFACTORING by stefan
Stefan Vogel <sv@exept.de>
parents: 20032
diff changeset
  2202
        (package notNil and:[package ~= PackageId noProjectID]) ifTrue:[
74774e1ee05d #REFACTORING by stefan
Stefan Vogel <sv@exept.de>
parents: 20032
diff changeset
  2203
            "/ keep the last source file open, because open/close
74774e1ee05d #REFACTORING by stefan
Stefan Vogel <sv@exept.de>
parents: 20032
diff changeset
  2204
            "/ operations maybe slow on NFS-mounted file systems.
74774e1ee05d #REFACTORING by stefan
Stefan Vogel <sv@exept.de>
parents: 20032
diff changeset
  2205
            "/ Since the reference to the file is weak, it will be closed
74774e1ee05d #REFACTORING by stefan
Stefan Vogel <sv@exept.de>
parents: 20032
diff changeset
  2206
            "/ automatically if the file is not referenced for a while.
74774e1ee05d #REFACTORING by stefan
Stefan Vogel <sv@exept.de>
parents: 20032
diff changeset
  2207
            "/ Neat trick.
74774e1ee05d #REFACTORING by stefan
Stefan Vogel <sv@exept.de>
parents: 20032
diff changeset
  2208
74774e1ee05d #REFACTORING by stefan
Stefan Vogel <sv@exept.de>
parents: 20032
diff changeset
  2209
            LastFileLock critical:[
74774e1ee05d #REFACTORING by stefan
Stefan Vogel <sv@exept.de>
parents: 20032
diff changeset
  2210
                aStream := LastFileReference at:1.
74774e1ee05d #REFACTORING by stefan
Stefan Vogel <sv@exept.de>
parents: 20032
diff changeset
  2211
                (aStream isNil
74774e1ee05d #REFACTORING by stefan
Stefan Vogel <sv@exept.de>
parents: 20032
diff changeset
  2212
                  or:[aStream class == SmallInteger
74774e1ee05d #REFACTORING by stefan
Stefan Vogel <sv@exept.de>
parents: 20032
diff changeset
  2213
                  or:[aStream isOpen not]]) ifTrue:[
74774e1ee05d #REFACTORING by stefan
Stefan Vogel <sv@exept.de>
parents: 20032
diff changeset
  2214
                    aStream := nil.
74774e1ee05d #REFACTORING by stefan
Stefan Vogel <sv@exept.de>
parents: 20032
diff changeset
  2215
                    LastFileReference at:1 put:nil.
74774e1ee05d #REFACTORING by stefan
Stefan Vogel <sv@exept.de>
parents: 20032
diff changeset
  2216
                ].
74774e1ee05d #REFACTORING by stefan
Stefan Vogel <sv@exept.de>
parents: 20032
diff changeset
  2217
                (aStream notNil
74774e1ee05d #REFACTORING by stefan
Stefan Vogel <sv@exept.de>
parents: 20032
diff changeset
  2218
                 and:[LastSourceFileName ~= (package,'/',source)]) ifTrue:[
74774e1ee05d #REFACTORING by stefan
Stefan Vogel <sv@exept.de>
parents: 20032
diff changeset
  2219
                    aStream := nil.
74774e1ee05d #REFACTORING by stefan
Stefan Vogel <sv@exept.de>
parents: 20032
diff changeset
  2220
                ].
74774e1ee05d #REFACTORING by stefan
Stefan Vogel <sv@exept.de>
parents: 20032
diff changeset
  2221
            ].
74774e1ee05d #REFACTORING by stefan
Stefan Vogel <sv@exept.de>
parents: 20032
diff changeset
  2222
74774e1ee05d #REFACTORING by stefan
Stefan Vogel <sv@exept.de>
parents: 20032
diff changeset
  2223
            aStream notNil ifTrue:[
74774e1ee05d #REFACTORING by stefan
Stefan Vogel <sv@exept.de>
parents: 20032
diff changeset
  2224
                ^ aStream
74774e1ee05d #REFACTORING by stefan
Stefan Vogel <sv@exept.de>
parents: 20032
diff changeset
  2225
            ].
74774e1ee05d #REFACTORING by stefan
Stefan Vogel <sv@exept.de>
parents: 20032
diff changeset
  2226
        ].
8141
41b25e5f7532 sourceStream access refactored (preps for utf8 decoding)
Claus Gittinger <cg@exept.de>
parents: 8117
diff changeset
  2227
    ].
41b25e5f7532 sourceStream access refactored (preps for utf8 decoding)
Claus Gittinger <cg@exept.de>
parents: 8117
diff changeset
  2228
41b25e5f7532 sourceStream access refactored (preps for utf8 decoding)
Claus Gittinger <cg@exept.de>
parents: 8117
diff changeset
  2229
    "/ a negative sourcePosition indicates
12854
3a3d3c02c3bd *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 12695
diff changeset
  2230
    "/ that this is a local file
8141
41b25e5f7532 sourceStream access refactored (preps for utf8 decoding)
Claus Gittinger <cg@exept.de>
parents: 8117
diff changeset
  2231
    "/ (not to be requested via the sourceCodeManager)
41b25e5f7532 sourceStream access refactored (preps for utf8 decoding)
Claus Gittinger <cg@exept.de>
parents: 8117
diff changeset
  2232
    "/ This kludge was added, to allow sourceCode to be
41b25e5f7532 sourceStream access refactored (preps for utf8 decoding)
Claus Gittinger <cg@exept.de>
parents: 8117
diff changeset
  2233
    "/ saved to a local source file (i.e. 'st.src')
41b25e5f7532 sourceStream access refactored (preps for utf8 decoding)
Claus Gittinger <cg@exept.de>
parents: 8117
diff changeset
  2234
    "/ and having a clue for which file is meant later.
41b25e5f7532 sourceStream access refactored (preps for utf8 decoding)
Claus Gittinger <cg@exept.de>
parents: 8117
diff changeset
  2235
41b25e5f7532 sourceStream access refactored (preps for utf8 decoding)
Claus Gittinger <cg@exept.de>
parents: 8117
diff changeset
  2236
    sourcePosition < 0 ifTrue:[
20035
74774e1ee05d #REFACTORING by stefan
Stefan Vogel <sv@exept.de>
parents: 20032
diff changeset
  2237
        aStream := source asFilename readStreamOrNil.
74774e1ee05d #REFACTORING by stefan
Stefan Vogel <sv@exept.de>
parents: 20032
diff changeset
  2238
        aStream isNil ifTrue:[
74774e1ee05d #REFACTORING by stefan
Stefan Vogel <sv@exept.de>
parents: 20032
diff changeset
  2239
            "/ search in some standard places
74774e1ee05d #REFACTORING by stefan
Stefan Vogel <sv@exept.de>
parents: 20032
diff changeset
  2240
            fileName := Smalltalk getSourceFileName:source.
74774e1ee05d #REFACTORING by stefan
Stefan Vogel <sv@exept.de>
parents: 20032
diff changeset
  2241
            fileName notNil ifTrue:[
74774e1ee05d #REFACTORING by stefan
Stefan Vogel <sv@exept.de>
parents: 20032
diff changeset
  2242
                aStream := fileName asFilename readStreamOrNil.
74774e1ee05d #REFACTORING by stefan
Stefan Vogel <sv@exept.de>
parents: 20032
diff changeset
  2243
            ].
74774e1ee05d #REFACTORING by stefan
Stefan Vogel <sv@exept.de>
parents: 20032
diff changeset
  2244
        ].
74774e1ee05d #REFACTORING by stefan
Stefan Vogel <sv@exept.de>
parents: 20032
diff changeset
  2245
        aStream notNil ifTrue:[
74774e1ee05d #REFACTORING by stefan
Stefan Vogel <sv@exept.de>
parents: 20032
diff changeset
  2246
            usingCacheBoolean ifTrue:[
74774e1ee05d #REFACTORING by stefan
Stefan Vogel <sv@exept.de>
parents: 20032
diff changeset
  2247
                self cacheSourceStream:aStream.
74774e1ee05d #REFACTORING by stefan
Stefan Vogel <sv@exept.de>
parents: 20032
diff changeset
  2248
            ].
74774e1ee05d #REFACTORING by stefan
Stefan Vogel <sv@exept.de>
parents: 20032
diff changeset
  2249
            ^ aStream
74774e1ee05d #REFACTORING by stefan
Stefan Vogel <sv@exept.de>
parents: 20032
diff changeset
  2250
        ].
8141
41b25e5f7532 sourceStream access refactored (preps for utf8 decoding)
Claus Gittinger <cg@exept.de>
parents: 8117
diff changeset
  2251
    ].
41b25e5f7532 sourceStream access refactored (preps for utf8 decoding)
Claus Gittinger <cg@exept.de>
parents: 8117
diff changeset
  2252
41b25e5f7532 sourceStream access refactored (preps for utf8 decoding)
Claus Gittinger <cg@exept.de>
parents: 8117
diff changeset
  2253
    "/
41b25e5f7532 sourceStream access refactored (preps for utf8 decoding)
Claus Gittinger <cg@exept.de>
parents: 8117
diff changeset
  2254
    "/ if there is no SourceManager, look in local standard places first
41b25e5f7532 sourceStream access refactored (preps for utf8 decoding)
Claus Gittinger <cg@exept.de>
parents: 8117
diff changeset
  2255
    "/
17254
053fe5d7fec8 class: Method
Claus Gittinger <cg@exept.de>
parents: 17250
diff changeset
  2256
    (mclass notNil and:[package == mclass package]) ifTrue:[
20035
74774e1ee05d #REFACTORING by stefan
Stefan Vogel <sv@exept.de>
parents: 20032
diff changeset
  2257
        mgr := mclass sourceCodeManagerFromBinaryRevision
15952
e55b89f8d241 class: Method
Claus Gittinger <cg@exept.de>
parents: 15787
diff changeset
  2258
    ] ifFalse:[
20035
74774e1ee05d #REFACTORING by stefan
Stefan Vogel <sv@exept.de>
parents: 20032
diff changeset
  2259
        "I'm an extension and we don't have binary revision info (!!)
74774e1ee05d #REFACTORING by stefan
Stefan Vogel <sv@exept.de>
parents: 20032
diff changeset
  2260
         for extensions, try to guess here"
74774e1ee05d #REFACTORING by stefan
Stefan Vogel <sv@exept.de>
parents: 20032
diff changeset
  2261
        pkgDef := ProjectDefinition definitionClassForPackage: package.
74774e1ee05d #REFACTORING by stefan
Stefan Vogel <sv@exept.de>
parents: 20032
diff changeset
  2262
        pkgDef notNil ifTrue:[
74774e1ee05d #REFACTORING by stefan
Stefan Vogel <sv@exept.de>
parents: 20032
diff changeset
  2263
            mgr := pkgDef sourceCodeManagerFromBinaryRevision
74774e1ee05d #REFACTORING by stefan
Stefan Vogel <sv@exept.de>
parents: 20032
diff changeset
  2264
        ] ifFalse:[
74774e1ee05d #REFACTORING by stefan
Stefan Vogel <sv@exept.de>
parents: 20032
diff changeset
  2265
            "OK, trust the configuration"
74774e1ee05d #REFACTORING by stefan
Stefan Vogel <sv@exept.de>
parents: 20032
diff changeset
  2266
            mgr := AbstractSourceCodeManager managerForPackage: package
74774e1ee05d #REFACTORING by stefan
Stefan Vogel <sv@exept.de>
parents: 20032
diff changeset
  2267
        ]
15952
e55b89f8d241 class: Method
Claus Gittinger <cg@exept.de>
parents: 15787
diff changeset
  2268
    ].
e55b89f8d241 class: Method
Claus Gittinger <cg@exept.de>
parents: 15787
diff changeset
  2269
e55b89f8d241 class: Method
Claus Gittinger <cg@exept.de>
parents: 15787
diff changeset
  2270
    (Class tryLocalSourceFirst or:[mgr isNil]) ifTrue:[
20035
74774e1ee05d #REFACTORING by stefan
Stefan Vogel <sv@exept.de>
parents: 20032
diff changeset
  2271
        aStream := self localSourceStream.
74774e1ee05d #REFACTORING by stefan
Stefan Vogel <sv@exept.de>
parents: 20032
diff changeset
  2272
        aStream notNil ifTrue:[
74774e1ee05d #REFACTORING by stefan
Stefan Vogel <sv@exept.de>
parents: 20032
diff changeset
  2273
            usingCacheBoolean ifTrue:[
74774e1ee05d #REFACTORING by stefan
Stefan Vogel <sv@exept.de>
parents: 20032
diff changeset
  2274
                self cacheSourceStream:aStream.
74774e1ee05d #REFACTORING by stefan
Stefan Vogel <sv@exept.de>
parents: 20032
diff changeset
  2275
            ].
74774e1ee05d #REFACTORING by stefan
Stefan Vogel <sv@exept.de>
parents: 20032
diff changeset
  2276
            ^ aStream
74774e1ee05d #REFACTORING by stefan
Stefan Vogel <sv@exept.de>
parents: 20032
diff changeset
  2277
        ].
8141
41b25e5f7532 sourceStream access refactored (preps for utf8 decoding)
Claus Gittinger <cg@exept.de>
parents: 8117
diff changeset
  2278
    ].
41b25e5f7532 sourceStream access refactored (preps for utf8 decoding)
Claus Gittinger <cg@exept.de>
parents: 8117
diff changeset
  2279
41b25e5f7532 sourceStream access refactored (preps for utf8 decoding)
Claus Gittinger <cg@exept.de>
parents: 8117
diff changeset
  2280
    "/
41b25e5f7532 sourceStream access refactored (preps for utf8 decoding)
Claus Gittinger <cg@exept.de>
parents: 8117
diff changeset
  2281
    "/ nope - ask my class for the source (this also invokes the SCMgr)
41b25e5f7532 sourceStream access refactored (preps for utf8 decoding)
Claus Gittinger <cg@exept.de>
parents: 8117
diff changeset
  2282
    "/
41b25e5f7532 sourceStream access refactored (preps for utf8 decoding)
Claus Gittinger <cg@exept.de>
parents: 8117
diff changeset
  2283
    who := self who.
41b25e5f7532 sourceStream access refactored (preps for utf8 decoding)
Claus Gittinger <cg@exept.de>
parents: 8117
diff changeset
  2284
    who notNil ifTrue:[
20035
74774e1ee05d #REFACTORING by stefan
Stefan Vogel <sv@exept.de>
parents: 20032
diff changeset
  2285
        myClass := who methodClass.
74774e1ee05d #REFACTORING by stefan
Stefan Vogel <sv@exept.de>
parents: 20032
diff changeset
  2286
74774e1ee05d #REFACTORING by stefan
Stefan Vogel <sv@exept.de>
parents: 20032
diff changeset
  2287
        (package notNil and:[package ~= myClass package and:[package ~= #'__NoProject__']]) ifTrue:[
74774e1ee05d #REFACTORING by stefan
Stefan Vogel <sv@exept.de>
parents: 20032
diff changeset
  2288
            "/ I am an extension
74774e1ee05d #REFACTORING by stefan
Stefan Vogel <sv@exept.de>
parents: 20032
diff changeset
  2289
            mgr notNil ifTrue:[
74774e1ee05d #REFACTORING by stefan
Stefan Vogel <sv@exept.de>
parents: 20032
diff changeset
  2290
                "/ try to get the source using my package information ...
74774e1ee05d #REFACTORING by stefan
Stefan Vogel <sv@exept.de>
parents: 20032
diff changeset
  2291
                mod := package asPackageId module.
74774e1ee05d #REFACTORING by stefan
Stefan Vogel <sv@exept.de>
parents: 20032
diff changeset
  2292
                dir := package asPackageId directory.
74774e1ee05d #REFACTORING by stefan
Stefan Vogel <sv@exept.de>
parents: 20032
diff changeset
  2293
                aStream := mgr streamForExtensionFile:source package:package directory:dir module:mod cache:true.
74774e1ee05d #REFACTORING by stefan
Stefan Vogel <sv@exept.de>
parents: 20032
diff changeset
  2294
                aStream notNil ifTrue:[
74774e1ee05d #REFACTORING by stefan
Stefan Vogel <sv@exept.de>
parents: 20032
diff changeset
  2295
                    usingCacheBoolean ifTrue:[
74774e1ee05d #REFACTORING by stefan
Stefan Vogel <sv@exept.de>
parents: 20032
diff changeset
  2296
                        self cacheSourceStream:aStream.
74774e1ee05d #REFACTORING by stefan
Stefan Vogel <sv@exept.de>
parents: 20032
diff changeset
  2297
                    ].
74774e1ee05d #REFACTORING by stefan
Stefan Vogel <sv@exept.de>
parents: 20032
diff changeset
  2298
                    ^ aStream
74774e1ee05d #REFACTORING by stefan
Stefan Vogel <sv@exept.de>
parents: 20032
diff changeset
  2299
                ].
74774e1ee05d #REFACTORING by stefan
Stefan Vogel <sv@exept.de>
parents: 20032
diff changeset
  2300
            ].
74774e1ee05d #REFACTORING by stefan
Stefan Vogel <sv@exept.de>
parents: 20032
diff changeset
  2301
            "/ consult the local fileSystem
74774e1ee05d #REFACTORING by stefan
Stefan Vogel <sv@exept.de>
parents: 20032
diff changeset
  2302
            aStream := self localSourceStream.
74774e1ee05d #REFACTORING by stefan
Stefan Vogel <sv@exept.de>
parents: 20032
diff changeset
  2303
            aStream notNil ifTrue:[
74774e1ee05d #REFACTORING by stefan
Stefan Vogel <sv@exept.de>
parents: 20032
diff changeset
  2304
                usingCacheBoolean ifTrue:[
74774e1ee05d #REFACTORING by stefan
Stefan Vogel <sv@exept.de>
parents: 20032
diff changeset
  2305
                    self cacheSourceStream:aStream.
74774e1ee05d #REFACTORING by stefan
Stefan Vogel <sv@exept.de>
parents: 20032
diff changeset
  2306
                ].
74774e1ee05d #REFACTORING by stefan
Stefan Vogel <sv@exept.de>
parents: 20032
diff changeset
  2307
                ^ aStream
74774e1ee05d #REFACTORING by stefan
Stefan Vogel <sv@exept.de>
parents: 20032
diff changeset
  2308
            ]
74774e1ee05d #REFACTORING by stefan
Stefan Vogel <sv@exept.de>
parents: 20032
diff changeset
  2309
        ].
74774e1ee05d #REFACTORING by stefan
Stefan Vogel <sv@exept.de>
parents: 20032
diff changeset
  2310
74774e1ee05d #REFACTORING by stefan
Stefan Vogel <sv@exept.de>
parents: 20032
diff changeset
  2311
        aStream := myClass sourceStreamFor:source.
74774e1ee05d #REFACTORING by stefan
Stefan Vogel <sv@exept.de>
parents: 20032
diff changeset
  2312
        aStream notNil ifTrue:[
74774e1ee05d #REFACTORING by stefan
Stefan Vogel <sv@exept.de>
parents: 20032
diff changeset
  2313
            usingCacheBoolean ifTrue:[
74774e1ee05d #REFACTORING by stefan
Stefan Vogel <sv@exept.de>
parents: 20032
diff changeset
  2314
                self cacheSourceStream:aStream.
74774e1ee05d #REFACTORING by stefan
Stefan Vogel <sv@exept.de>
parents: 20032
diff changeset
  2315
            ].
74774e1ee05d #REFACTORING by stefan
Stefan Vogel <sv@exept.de>
parents: 20032
diff changeset
  2316
            ^ aStream
74774e1ee05d #REFACTORING by stefan
Stefan Vogel <sv@exept.de>
parents: 20032
diff changeset
  2317
        ].
8141
41b25e5f7532 sourceStream access refactored (preps for utf8 decoding)
Claus Gittinger <cg@exept.de>
parents: 8117
diff changeset
  2318
    ].
41b25e5f7532 sourceStream access refactored (preps for utf8 decoding)
Claus Gittinger <cg@exept.de>
parents: 8117
diff changeset
  2319
41b25e5f7532 sourceStream access refactored (preps for utf8 decoding)
Claus Gittinger <cg@exept.de>
parents: 8117
diff changeset
  2320
    "/
12854
3a3d3c02c3bd *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 12695
diff changeset
  2321
    "/ nope - look in standard places
8141
41b25e5f7532 sourceStream access refactored (preps for utf8 decoding)
Claus Gittinger <cg@exept.de>
parents: 8117
diff changeset
  2322
    "/ (if there is a source-code manager - otherwise, we already did that)
41b25e5f7532 sourceStream access refactored (preps for utf8 decoding)
Claus Gittinger <cg@exept.de>
parents: 8117
diff changeset
  2323
    "/
10207
b5ca553d15ad localSourceFirst for extensions.
Claus Gittinger <cg@exept.de>
parents: 10201
diff changeset
  2324
    (mgr notNil and:[Class tryLocalSourceFirst not]) ifTrue:[
20035
74774e1ee05d #REFACTORING by stefan
Stefan Vogel <sv@exept.de>
parents: 20032
diff changeset
  2325
        aStream := self localSourceStream.
74774e1ee05d #REFACTORING by stefan
Stefan Vogel <sv@exept.de>
parents: 20032
diff changeset
  2326
        aStream notNil ifTrue:[
74774e1ee05d #REFACTORING by stefan
Stefan Vogel <sv@exept.de>
parents: 20032
diff changeset
  2327
            usingCacheBoolean ifTrue:[
74774e1ee05d #REFACTORING by stefan
Stefan Vogel <sv@exept.de>
parents: 20032
diff changeset
  2328
                self cacheSourceStream:aStream.
74774e1ee05d #REFACTORING by stefan
Stefan Vogel <sv@exept.de>
parents: 20032
diff changeset
  2329
            ].
74774e1ee05d #REFACTORING by stefan
Stefan Vogel <sv@exept.de>
parents: 20032
diff changeset
  2330
            ^ aStream
74774e1ee05d #REFACTORING by stefan
Stefan Vogel <sv@exept.de>
parents: 20032
diff changeset
  2331
        ].
8141
41b25e5f7532 sourceStream access refactored (preps for utf8 decoding)
Claus Gittinger <cg@exept.de>
parents: 8117
diff changeset
  2332
    ].
41b25e5f7532 sourceStream access refactored (preps for utf8 decoding)
Claus Gittinger <cg@exept.de>
parents: 8117
diff changeset
  2333
41b25e5f7532 sourceStream access refactored (preps for utf8 decoding)
Claus Gittinger <cg@exept.de>
parents: 8117
diff changeset
  2334
    "/
41b25e5f7532 sourceStream access refactored (preps for utf8 decoding)
Claus Gittinger <cg@exept.de>
parents: 8117
diff changeset
  2335
    "/ final chance: try current directory
41b25e5f7532 sourceStream access refactored (preps for utf8 decoding)
Claus Gittinger <cg@exept.de>
parents: 8117
diff changeset
  2336
    "/
41b25e5f7532 sourceStream access refactored (preps for utf8 decoding)
Claus Gittinger <cg@exept.de>
parents: 8117
diff changeset
  2337
    aStream isNil ifTrue:[
20035
74774e1ee05d #REFACTORING by stefan
Stefan Vogel <sv@exept.de>
parents: 20032
diff changeset
  2338
        aStream := source asFilename readStreamOrNil.
74774e1ee05d #REFACTORING by stefan
Stefan Vogel <sv@exept.de>
parents: 20032
diff changeset
  2339
        aStream notNil ifTrue:[
74774e1ee05d #REFACTORING by stefan
Stefan Vogel <sv@exept.de>
parents: 20032
diff changeset
  2340
            usingCacheBoolean ifTrue:[
74774e1ee05d #REFACTORING by stefan
Stefan Vogel <sv@exept.de>
parents: 20032
diff changeset
  2341
                self cacheSourceStream:aStream.
74774e1ee05d #REFACTORING by stefan
Stefan Vogel <sv@exept.de>
parents: 20032
diff changeset
  2342
            ].
74774e1ee05d #REFACTORING by stefan
Stefan Vogel <sv@exept.de>
parents: 20032
diff changeset
  2343
            ^ aStream
74774e1ee05d #REFACTORING by stefan
Stefan Vogel <sv@exept.de>
parents: 20032
diff changeset
  2344
        ].
8141
41b25e5f7532 sourceStream access refactored (preps for utf8 decoding)
Claus Gittinger <cg@exept.de>
parents: 8117
diff changeset
  2345
    ].
41b25e5f7532 sourceStream access refactored (preps for utf8 decoding)
Claus Gittinger <cg@exept.de>
parents: 8117
diff changeset
  2346
41b25e5f7532 sourceStream access refactored (preps for utf8 decoding)
Claus Gittinger <cg@exept.de>
parents: 8117
diff changeset
  2347
    (who isNil and:[source notNil]) ifTrue:[
20035
74774e1ee05d #REFACTORING by stefan
Stefan Vogel <sv@exept.de>
parents: 20032
diff changeset
  2348
        "/
74774e1ee05d #REFACTORING by stefan
Stefan Vogel <sv@exept.de>
parents: 20032
diff changeset
  2349
        "/ mhmh - seems to be a method which used to be in some
74774e1ee05d #REFACTORING by stefan
Stefan Vogel <sv@exept.de>
parents: 20032
diff changeset
  2350
        "/ class, but has been overwritten by another or removed.
74774e1ee05d #REFACTORING by stefan
Stefan Vogel <sv@exept.de>
parents: 20032
diff changeset
  2351
        "/ (i.e. it has no containing class anyMore)
74774e1ee05d #REFACTORING by stefan
Stefan Vogel <sv@exept.de>
parents: 20032
diff changeset
  2352
        "/ try to guess the class from the sourceFileName.
74774e1ee05d #REFACTORING by stefan
Stefan Vogel <sv@exept.de>
parents: 20032
diff changeset
  2353
        "/ and retry.
74774e1ee05d #REFACTORING by stefan
Stefan Vogel <sv@exept.de>
parents: 20032
diff changeset
  2354
        "/
74774e1ee05d #REFACTORING by stefan
Stefan Vogel <sv@exept.de>
parents: 20032
diff changeset
  2355
        className := Smalltalk classNameForFile:source.
74774e1ee05d #REFACTORING by stefan
Stefan Vogel <sv@exept.de>
parents: 20032
diff changeset
  2356
        (classNameSymbol := className asSymbolIfInterned) notNil ifTrue:[
74774e1ee05d #REFACTORING by stefan
Stefan Vogel <sv@exept.de>
parents: 20032
diff changeset
  2357
            myClass := Smalltalk at:classNameSymbol ifAbsent:nil.
74774e1ee05d #REFACTORING by stefan
Stefan Vogel <sv@exept.de>
parents: 20032
diff changeset
  2358
            myClass notNil ifTrue:[
74774e1ee05d #REFACTORING by stefan
Stefan Vogel <sv@exept.de>
parents: 20032
diff changeset
  2359
                aStream := myClass sourceStreamFor:source.
74774e1ee05d #REFACTORING by stefan
Stefan Vogel <sv@exept.de>
parents: 20032
diff changeset
  2360
                aStream notNil ifTrue:[
74774e1ee05d #REFACTORING by stefan
Stefan Vogel <sv@exept.de>
parents: 20032
diff changeset
  2361
                    usingCacheBoolean ifTrue:[
74774e1ee05d #REFACTORING by stefan
Stefan Vogel <sv@exept.de>
parents: 20032
diff changeset
  2362
                        self cacheSourceStream:aStream.
74774e1ee05d #REFACTORING by stefan
Stefan Vogel <sv@exept.de>
parents: 20032
diff changeset
  2363
                    ].
74774e1ee05d #REFACTORING by stefan
Stefan Vogel <sv@exept.de>
parents: 20032
diff changeset
  2364
                    ^ aStream
74774e1ee05d #REFACTORING by stefan
Stefan Vogel <sv@exept.de>
parents: 20032
diff changeset
  2365
                ].
74774e1ee05d #REFACTORING by stefan
Stefan Vogel <sv@exept.de>
parents: 20032
diff changeset
  2366
            ]
74774e1ee05d #REFACTORING by stefan
Stefan Vogel <sv@exept.de>
parents: 20032
diff changeset
  2367
        ]
12854
3a3d3c02c3bd *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 12695
diff changeset
  2368
    ].
8141
41b25e5f7532 sourceStream access refactored (preps for utf8 decoding)
Claus Gittinger <cg@exept.de>
parents: 8117
diff changeset
  2369
41b25e5f7532 sourceStream access refactored (preps for utf8 decoding)
Claus Gittinger <cg@exept.de>
parents: 8117
diff changeset
  2370
    ^ nil
10201
f90568a94903 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10196
diff changeset
  2371
f90568a94903 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10196
diff changeset
  2372
    "Modified: / 26-11-2006 / 22:33:38 / cg"
8141
41b25e5f7532 sourceStream access refactored (preps for utf8 decoding)
Claus Gittinger <cg@exept.de>
parents: 8117
diff changeset
  2373
!
41b25e5f7532 sourceStream access refactored (preps for utf8 decoding)
Claus Gittinger <cg@exept.de>
parents: 8117
diff changeset
  2374
23316
4eaf91738705 #REFACTORING by cg
Claus Gittinger <cg@exept.de>
parents: 23254
diff changeset
  2375
setAnnotations: anObject
4eaf91738705 #REFACTORING by cg
Claus Gittinger <cg@exept.de>
parents: 23254
diff changeset
  2376
    "set the annotations (low level - do not use)"
4eaf91738705 #REFACTORING by cg
Claus Gittinger <cg@exept.de>
parents: 23254
diff changeset
  2377
4eaf91738705 #REFACTORING by cg
Claus Gittinger <cg@exept.de>
parents: 23254
diff changeset
  2378
    annotations :=  anObject
4eaf91738705 #REFACTORING by cg
Claus Gittinger <cg@exept.de>
parents: 23254
diff changeset
  2379
4eaf91738705 #REFACTORING by cg
Claus Gittinger <cg@exept.de>
parents: 23254
diff changeset
  2380
    "Created: / 20-05-2010 / 11:27:18 / Jan Vrany <jan.vrany@fit.cvut.cz>"
4eaf91738705 #REFACTORING by cg
Claus Gittinger <cg@exept.de>
parents: 23254
diff changeset
  2381
    "Modified (comment): / 29-08-2018 / 10:25:51 / Claus Gittinger"
4eaf91738705 #REFACTORING by cg
Claus Gittinger <cg@exept.de>
parents: 23254
diff changeset
  2382
!
4eaf91738705 #REFACTORING by cg
Claus Gittinger <cg@exept.de>
parents: 23254
diff changeset
  2383
13422
b43a8a47037c Jan's changes
vrany
parents: 13390
diff changeset
  2384
setLookupObject: lookup
b43a8a47037c Jan's changes
vrany
parents: 13390
diff changeset
  2385
    "set the lookupObject (low level - use lookupObject:)"
b43a8a47037c Jan's changes
vrany
parents: 13390
diff changeset
  2386
14536
db30b9862370 class: Method
Claus Gittinger <cg@exept.de>
parents: 14508
diff changeset
  2387
    lookupObject ~~ lookup ifTrue:[
18620
b4e9f25d6ce6 preparations for lined index list in WeakArray
Claus Gittinger <cg@exept.de>
parents: 18462
diff changeset
  2388
	lookupObject := lookup.
b4e9f25d6ce6 preparations for lined index list in WeakArray
Claus Gittinger <cg@exept.de>
parents: 18462
diff changeset
  2389
	ObjectMemory flushCaches.
14536
db30b9862370 class: Method
Claus Gittinger <cg@exept.de>
parents: 14508
diff changeset
  2390
    ].
13422
b43a8a47037c Jan's changes
vrany
parents: 13390
diff changeset
  2391
b43a8a47037c Jan's changes
vrany
parents: 13390
diff changeset
  2392
    "Created: / 11-07-2010 / 19:31:59 / Jan Vrany <jan.vrany@fit.cvut.cz>"
b43a8a47037c Jan's changes
vrany
parents: 13390
diff changeset
  2393
!
b43a8a47037c Jan's changes
vrany
parents: 13390
diff changeset
  2394
8141
41b25e5f7532 sourceStream access refactored (preps for utf8 decoding)
Claus Gittinger <cg@exept.de>
parents: 8117
diff changeset
  2395
sourceChunkFromStream:aStream
10673
05229646ecd7 #source - handle DecodingError when fetching the method's source
Stefan Vogel <sv@exept.de>
parents: 10608
diff changeset
  2396
    PositionError handle:[:ex |
18620
b4e9f25d6ce6 preparations for lined index list in WeakArray
Claus Gittinger <cg@exept.de>
parents: 18462
diff changeset
  2397
	^ nil
8141
41b25e5f7532 sourceStream access refactored (preps for utf8 decoding)
Claus Gittinger <cg@exept.de>
parents: 8117
diff changeset
  2398
    ] do:[
18620
b4e9f25d6ce6 preparations for lined index list in WeakArray
Claus Gittinger <cg@exept.de>
parents: 18462
diff changeset
  2399
	aStream position:(sourcePosition ? 1) abs - 1.
8141
41b25e5f7532 sourceStream access refactored (preps for utf8 decoding)
Claus Gittinger <cg@exept.de>
parents: 8117
diff changeset
  2400
    ].
41b25e5f7532 sourceStream access refactored (preps for utf8 decoding)
Claus Gittinger <cg@exept.de>
parents: 8117
diff changeset
  2401
    ^ aStream nextChunk.
41b25e5f7532 sourceStream access refactored (preps for utf8 decoding)
Claus Gittinger <cg@exept.de>
parents: 8117
diff changeset
  2402
!
41b25e5f7532 sourceStream access refactored (preps for utf8 decoding)
Claus Gittinger <cg@exept.de>
parents: 8117
diff changeset
  2403
12682
Stefan Vogel <sv@exept.de>
parents: 12620
diff changeset
  2404
sourceStreamUsingCache:usingCacheBoolean
Stefan Vogel <sv@exept.de>
parents: 12620
diff changeset
  2405
    "return an open sourceStream (needs positioning).
Stefan Vogel <sv@exept.de>
parents: 12620
diff changeset
  2406
     If usingCacheBoolean is true, cache the stream (but take care against concurrent access).
14090
bb45ad9b6aab changed: #sourceStreamUsingCache:
Stefan Vogel <sv@exept.de>
parents: 14047
diff changeset
  2407
     You have to close the stream, if usingCacheBoolean is false, and should not close it
12682
Stefan Vogel <sv@exept.de>
parents: 12620
diff changeset
  2408
     if usingCacheBoolean is true."
8141
41b25e5f7532 sourceStream access refactored (preps for utf8 decoding)
Claus Gittinger <cg@exept.de>
parents: 8117
diff changeset
  2409
12695
14b7044c2e4a changed:
Stefan Vogel <sv@exept.de>
parents: 12682
diff changeset
  2410
    |rawStream|
14b7044c2e4a changed:
Stefan Vogel <sv@exept.de>
parents: 12682
diff changeset
  2411
14b7044c2e4a changed:
Stefan Vogel <sv@exept.de>
parents: 12682
diff changeset
  2412
    rawStream := self rawSourceStreamUsingCache:usingCacheBoolean.
14b7044c2e4a changed:
Stefan Vogel <sv@exept.de>
parents: 12682
diff changeset
  2413
    rawStream isNil ifTrue:[
21431
e3a47227faa1 #DOCUMENTATION by cg
Claus Gittinger <cg@exept.de>
parents: 21373
diff changeset
  2414
        ^ nil.
8141
41b25e5f7532 sourceStream access refactored (preps for utf8 decoding)
Claus Gittinger <cg@exept.de>
parents: 8117
diff changeset
  2415
    ].
14090
bb45ad9b6aab changed: #sourceStreamUsingCache:
Stefan Vogel <sv@exept.de>
parents: 14047
diff changeset
  2416
    rawStream position:0.
12695
14b7044c2e4a changed:
Stefan Vogel <sv@exept.de>
parents: 12682
diff changeset
  2417
21431
e3a47227faa1 #DOCUMENTATION by cg
Claus Gittinger <cg@exept.de>
parents: 21373
diff changeset
  2418
    "/ see if it's utf8 encoded...
12695
14b7044c2e4a changed:
Stefan Vogel <sv@exept.de>
parents: 12682
diff changeset
  2419
    ^ EncodedStream decodedStreamFor:rawStream.
21431
e3a47227faa1 #DOCUMENTATION by cg
Claus Gittinger <cg@exept.de>
parents: 21373
diff changeset
  2420
e3a47227faa1 #DOCUMENTATION by cg
Claus Gittinger <cg@exept.de>
parents: 21373
diff changeset
  2421
    "Modified (comment): / 13-02-2017 / 20:26:54 / cg"
8141
41b25e5f7532 sourceStream access refactored (preps for utf8 decoding)
Claus Gittinger <cg@exept.de>
parents: 8117
diff changeset
  2422
! !
41b25e5f7532 sourceStream access refactored (preps for utf8 decoding)
Claus Gittinger <cg@exept.de>
parents: 8117
diff changeset
  2423
1093
1e742016eea0 category rename / added access to RESOURCE and CALLED flags
Claus Gittinger <cg@exept.de>
parents: 1087
diff changeset
  2424
!Method methodsFor:'private-compiler interface'!
1e742016eea0 category rename / added access to RESOURCE and CALLED flags
Claus Gittinger <cg@exept.de>
parents: 1087
diff changeset
  2425
5405
f07c8045ab4e *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5398
diff changeset
  2426
primitiveNumber
f07c8045ab4e *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5398
diff changeset
  2427
    "for stx rel >= 5.x only:
f07c8045ab4e *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5398
diff changeset
  2428
     return the primitive number."
f07c8045ab4e *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5398
diff changeset
  2429
f07c8045ab4e *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5398
diff changeset
  2430
%{  /* NOCONTEXT */
f07c8045ab4e *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5398
diff changeset
  2431
f07c8045ab4e *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5398
diff changeset
  2432
#ifdef F_PRIMITIVE
f07c8045ab4e *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5398
diff changeset
  2433
    INT f = __intVal(__INST(flags));
6014
14acbd7c25d4 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6006
diff changeset
  2434
    OBJ nr = 0;
5405
f07c8045ab4e *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5398
diff changeset
  2435
f07c8045ab4e *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5398
diff changeset
  2436
    if (f & F_PRIMITIVE) {
18620
b4e9f25d6ce6 preparations for lined index list in WeakArray
Claus Gittinger <cg@exept.de>
parents: 18462
diff changeset
  2437
	nr = __INST(code_);
5405
f07c8045ab4e *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5398
diff changeset
  2438
    }
f07c8045ab4e *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5398
diff changeset
  2439
    RETURN (nr);
f07c8045ab4e *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5398
diff changeset
  2440
#endif
f07c8045ab4e *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5398
diff changeset
  2441
%}.
f07c8045ab4e *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5398
diff changeset
  2442
    self primitiveFailed
f07c8045ab4e *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5398
diff changeset
  2443
!
f07c8045ab4e *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5398
diff changeset
  2444
f07c8045ab4e *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5398
diff changeset
  2445
setPrimitiveNumber:aNumber
f07c8045ab4e *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5398
diff changeset
  2446
    "for stx rel >= 5.x only:
f07c8045ab4e *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5398
diff changeset
  2447
     mark the method as having primitive code."
f07c8045ab4e *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5398
diff changeset
  2448
f07c8045ab4e *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5398
diff changeset
  2449
%{  /* NOCONTEXT */
f07c8045ab4e *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5398
diff changeset
  2450
f07c8045ab4e *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5398
diff changeset
  2451
#ifdef F_PRIMITIVE
f07c8045ab4e *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5398
diff changeset
  2452
    INT f = __intVal(__INST(flags));
f07c8045ab4e *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5398
diff changeset
  2453
f07c8045ab4e *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5398
diff changeset
  2454
    f |= F_PRIMITIVE;
8913
b9498d27a554 64bit; mkSmallInteger
Claus Gittinger <cg@exept.de>
parents: 8896
diff changeset
  2455
    __INST(flags) = __mkSmallInteger(f);
5405
f07c8045ab4e *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5398
diff changeset
  2456
    __INST(code_) = aNumber;
f07c8045ab4e *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5398
diff changeset
  2457
    RETURN (self);
f07c8045ab4e *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5398
diff changeset
  2458
#endif
f07c8045ab4e *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5398
diff changeset
  2459
%}.
f07c8045ab4e *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5398
diff changeset
  2460
    self primitiveFailed
f07c8045ab4e *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5398
diff changeset
  2461
f07c8045ab4e *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5398
diff changeset
  2462
f07c8045ab4e *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5398
diff changeset
  2463
f07c8045ab4e *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5398
diff changeset
  2464
!
f07c8045ab4e *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5398
diff changeset
  2465
1093
1e742016eea0 category rename / added access to RESOURCE and CALLED flags
Claus Gittinger <cg@exept.de>
parents: 1087
diff changeset
  2466
setResourceFlag
1e742016eea0 category rename / added access to RESOURCE and CALLED flags
Claus Gittinger <cg@exept.de>
parents: 1087
diff changeset
  2467
    "mark the method as having a <resource> definition in its
8518
7dc3f9909640 Interchanged the meaning of method privacy -
Stefan Vogel <sv@exept.de>
parents: 8465
diff changeset
  2468
     source. This flag can be used to find resource-flagged methods quicker."
1093
1e742016eea0 category rename / added access to RESOURCE and CALLED flags
Claus Gittinger <cg@exept.de>
parents: 1087
diff changeset
  2469
1e742016eea0 category rename / added access to RESOURCE and CALLED flags
Claus Gittinger <cg@exept.de>
parents: 1087
diff changeset
  2470
%{  /* NOCONTEXT */
1e742016eea0 category rename / added access to RESOURCE and CALLED flags
Claus Gittinger <cg@exept.de>
parents: 1087
diff changeset
  2471
1e742016eea0 category rename / added access to RESOURCE and CALLED flags
Claus Gittinger <cg@exept.de>
parents: 1087
diff changeset
  2472
#ifdef F_RESOURCE
2868
772c890f907c alpha64
Claus Gittinger <cg@exept.de>
parents: 2826
diff changeset
  2473
    INT f = __intVal(__INST(flags));
1093
1e742016eea0 category rename / added access to RESOURCE and CALLED flags
Claus Gittinger <cg@exept.de>
parents: 1087
diff changeset
  2474
1e742016eea0 category rename / added access to RESOURCE and CALLED flags
Claus Gittinger <cg@exept.de>
parents: 1087
diff changeset
  2475
    f |= F_RESOURCE;
8913
b9498d27a554 64bit; mkSmallInteger
Claus Gittinger <cg@exept.de>
parents: 8896
diff changeset
  2476
    __INST(flags) = __mkSmallInteger(f);
1093
1e742016eea0 category rename / added access to RESOURCE and CALLED flags
Claus Gittinger <cg@exept.de>
parents: 1087
diff changeset
  2477
#endif
1e742016eea0 category rename / added access to RESOURCE and CALLED flags
Claus Gittinger <cg@exept.de>
parents: 1087
diff changeset
  2478
%}
1e742016eea0 category rename / added access to RESOURCE and CALLED flags
Claus Gittinger <cg@exept.de>
parents: 1087
diff changeset
  2479
! !
1e742016eea0 category rename / added access to RESOURCE and CALLED flags
Claus Gittinger <cg@exept.de>
parents: 1087
diff changeset
  2480
952
d600e08a5936 handle the case where a method has a sourceFileInfo, but the class has not
Claus Gittinger <cg@exept.de>
parents: 934
diff changeset
  2481
!Method methodsFor:'queries'!
d600e08a5936 handle the case where a method has a sourceFileInfo, but the class has not
Claus Gittinger <cg@exept.de>
parents: 934
diff changeset
  2482
2702
5d6f23d8ee18 more ST80 queries
Claus Gittinger <cg@exept.de>
parents: 2695
diff changeset
  2483
accessedInstVars
5d6f23d8ee18 more ST80 queries
Claus Gittinger <cg@exept.de>
parents: 2695
diff changeset
  2484
    "return a collection of instVarNames, which are accessed by
5d6f23d8ee18 more ST80 queries
Claus Gittinger <cg@exept.de>
parents: 2695
diff changeset
  2485
     the receiver method"
5d6f23d8ee18 more ST80 queries
Claus Gittinger <cg@exept.de>
parents: 2695
diff changeset
  2486
5d6f23d8ee18 more ST80 queries
Claus Gittinger <cg@exept.de>
parents: 2695
diff changeset
  2487
    |src parser|
5d6f23d8ee18 more ST80 queries
Claus Gittinger <cg@exept.de>
parents: 2695
diff changeset
  2488
5d6f23d8ee18 more ST80 queries
Claus Gittinger <cg@exept.de>
parents: 2695
diff changeset
  2489
    src := self source.
5d6f23d8ee18 more ST80 queries
Claus Gittinger <cg@exept.de>
parents: 2695
diff changeset
  2490
    src notNil ifTrue:[
18620
b4e9f25d6ce6 preparations for lined index list in WeakArray
Claus Gittinger <cg@exept.de>
parents: 18462
diff changeset
  2491
	parser := Parser
b4e9f25d6ce6 preparations for lined index list in WeakArray
Claus Gittinger <cg@exept.de>
parents: 18462
diff changeset
  2492
			parseMethod:src
b4e9f25d6ce6 preparations for lined index list in WeakArray
Claus Gittinger <cg@exept.de>
parents: 18462
diff changeset
  2493
			in:self containingClass
b4e9f25d6ce6 preparations for lined index list in WeakArray
Claus Gittinger <cg@exept.de>
parents: 18462
diff changeset
  2494
			ignoreErrors:true
b4e9f25d6ce6 preparations for lined index list in WeakArray
Claus Gittinger <cg@exept.de>
parents: 18462
diff changeset
  2495
			ignoreWarnings:true.
b4e9f25d6ce6 preparations for lined index list in WeakArray
Claus Gittinger <cg@exept.de>
parents: 18462
diff changeset
  2496
b4e9f25d6ce6 preparations for lined index list in WeakArray
Claus Gittinger <cg@exept.de>
parents: 18462
diff changeset
  2497
	(parser notNil and:[parser ~~ #Error]) ifTrue:[
b4e9f25d6ce6 preparations for lined index list in WeakArray
Claus Gittinger <cg@exept.de>
parents: 18462
diff changeset
  2498
	    ^ parser usedInstVars
b4e9f25d6ce6 preparations for lined index list in WeakArray
Claus Gittinger <cg@exept.de>
parents: 18462
diff changeset
  2499
	].
2702
5d6f23d8ee18 more ST80 queries
Claus Gittinger <cg@exept.de>
parents: 2695
diff changeset
  2500
    ].
5d6f23d8ee18 more ST80 queries
Claus Gittinger <cg@exept.de>
parents: 2695
diff changeset
  2501
    ^ #() "/ actually: unknown
5d6f23d8ee18 more ST80 queries
Claus Gittinger <cg@exept.de>
parents: 2695
diff changeset
  2502
5d6f23d8ee18 more ST80 queries
Claus Gittinger <cg@exept.de>
parents: 2695
diff changeset
  2503
    "Modified: 19.6.1997 / 17:54:09 / cg"
5d6f23d8ee18 more ST80 queries
Claus Gittinger <cg@exept.de>
parents: 2695
diff changeset
  2504
!
5d6f23d8ee18 more ST80 queries
Claus Gittinger <cg@exept.de>
parents: 2695
diff changeset
  2505
14237
Claus Gittinger <cg@exept.de>
parents: 14236
diff changeset
  2506
accessesField:instVarIndex
Claus Gittinger <cg@exept.de>
parents: 14236
diff changeset
  2507
    "return true, if the instvar at instVarIndex is accessed by the receiver.
Claus Gittinger <cg@exept.de>
parents: 14236
diff changeset
  2508
     Uses parser (for now); could look at bytecode as well here..."
Claus Gittinger <cg@exept.de>
parents: 14236
diff changeset
  2509
Claus Gittinger <cg@exept.de>
parents: 14236
diff changeset
  2510
    |instVarName|
Claus Gittinger <cg@exept.de>
parents: 14236
diff changeset
  2511
Claus Gittinger <cg@exept.de>
parents: 14236
diff changeset
  2512
    instVarName := (self mclass allInstVarNames) at:instVarIndex.
Claus Gittinger <cg@exept.de>
parents: 14236
diff changeset
  2513
    ^ self accessesInstVar:instVarName
Claus Gittinger <cg@exept.de>
parents: 14236
diff changeset
  2514
Claus Gittinger <cg@exept.de>
parents: 14236
diff changeset
  2515
    "Created: / 23-07-2012 / 11:13:54 / cg"
Claus Gittinger <cg@exept.de>
parents: 14236
diff changeset
  2516
!
Claus Gittinger <cg@exept.de>
parents: 14236
diff changeset
  2517
Claus Gittinger <cg@exept.de>
parents: 14236
diff changeset
  2518
accessesInstVar:instVarName
Claus Gittinger <cg@exept.de>
parents: 14236
diff changeset
  2519
    "return true, if the named instvar is accessed by the receiver.
Claus Gittinger <cg@exept.de>
parents: 14236
diff changeset
  2520
     Uses parser (for now); could look at bytecode as well here..."
Claus Gittinger <cg@exept.de>
parents: 14236
diff changeset
  2521
Claus Gittinger <cg@exept.de>
parents: 14236
diff changeset
  2522
    |usedInstVars|
Claus Gittinger <cg@exept.de>
parents: 14236
diff changeset
  2523
Claus Gittinger <cg@exept.de>
parents: 14236
diff changeset
  2524
    (self source includesString:instVarName) ifFalse:[^ false].     "/ that's much faster than parsing...
Claus Gittinger <cg@exept.de>
parents: 14236
diff changeset
  2525
    usedInstVars := self parse:#'parseMethodSilent:in:' with:self mclass  return:#usedInstVars or:#().
Claus Gittinger <cg@exept.de>
parents: 14236
diff changeset
  2526
    ^ usedInstVars includes:instVarName.
Claus Gittinger <cg@exept.de>
parents: 14236
diff changeset
  2527
Claus Gittinger <cg@exept.de>
parents: 14236
diff changeset
  2528
    "Created: / 23-07-2012 / 11:15:02 / cg"
Claus Gittinger <cg@exept.de>
parents: 14236
diff changeset
  2529
!
Claus Gittinger <cg@exept.de>
parents: 14236
diff changeset
  2530
952
d600e08a5936 handle the case where a method has a sourceFileInfo, but the class has not
Claus Gittinger <cg@exept.de>
parents: 934
diff changeset
  2531
containingClass
12854
3a3d3c02c3bd *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 12695
diff changeset
  2532
    "return the class I am defined in.
17278
7813956ffab4 class: Method
Claus Gittinger <cg@exept.de>
parents: 17254
diff changeset
  2533
     Notice, that the containingClass query returns nil, if a method is wrapped or no longer valid
18620
b4e9f25d6ce6 preparations for lined index list in WeakArray
Claus Gittinger <cg@exept.de>
parents: 18462
diff changeset
  2534
     due to an accept in a browser or debugger.
17278
7813956ffab4 class: Method
Claus Gittinger <cg@exept.de>
parents: 17254
diff changeset
  2535
     However, the mclass slot still contains a reference to the once valid class and can be fetched
7813956ffab4 class: Method
Claus Gittinger <cg@exept.de>
parents: 17254
diff changeset
  2536
     via getMclass.
952
d600e08a5936 handle the case where a method has a sourceFileInfo, but the class has not
Claus Gittinger <cg@exept.de>
parents: 934
diff changeset
  2537
     See comment in who."
d600e08a5936 handle the case where a method has a sourceFileInfo, but the class has not
Claus Gittinger <cg@exept.de>
parents: 934
diff changeset
  2538
d600e08a5936 handle the case where a method has a sourceFileInfo, but the class has not
Claus Gittinger <cg@exept.de>
parents: 934
diff changeset
  2539
    "based on who, which has been added for ST-80 compatibility"
d600e08a5936 handle the case where a method has a sourceFileInfo, but the class has not
Claus Gittinger <cg@exept.de>
parents: 934
diff changeset
  2540
1851
4accc9fafd19 change #who to return a proper object
Claus Gittinger <cg@exept.de>
parents: 1813
diff changeset
  2541
    |who|
952
d600e08a5936 handle the case where a method has a sourceFileInfo, but the class has not
Claus Gittinger <cg@exept.de>
parents: 934
diff changeset
  2542
5704
aeeece3a93ef flush mclass, if no longer valid
Claus Gittinger <cg@exept.de>
parents: 5700
diff changeset
  2543
    mclass notNil ifTrue:[
18620
b4e9f25d6ce6 preparations for lined index list in WeakArray
Claus Gittinger <cg@exept.de>
parents: 18462
diff changeset
  2544
	"/ check if this (cached) info is still valid...
b4e9f25d6ce6 preparations for lined index list in WeakArray
Claus Gittinger <cg@exept.de>
parents: 18462
diff changeset
  2545
	(mclass containsMethod:self) ifTrue:[
b4e9f25d6ce6 preparations for lined index list in WeakArray
Claus Gittinger <cg@exept.de>
parents: 18462
diff changeset
  2546
	    ^ mclass
b4e9f25d6ce6 preparations for lined index list in WeakArray
Claus Gittinger <cg@exept.de>
parents: 18462
diff changeset
  2547
	].
b4e9f25d6ce6 preparations for lined index list in WeakArray
Claus Gittinger <cg@exept.de>
parents: 18462
diff changeset
  2548
	^ nil.
5704
aeeece3a93ef flush mclass, if no longer valid
Claus Gittinger <cg@exept.de>
parents: 5700
diff changeset
  2549
    ].
5324
5c9959ce98af make use of mclass
Claus Gittinger <cg@exept.de>
parents: 5322
diff changeset
  2550
1851
4accc9fafd19 change #who to return a proper object
Claus Gittinger <cg@exept.de>
parents: 1813
diff changeset
  2551
    who := self who.
17254
053fe5d7fec8 class: Method
Claus Gittinger <cg@exept.de>
parents: 17250
diff changeset
  2552
    who notNil ifTrue:[
18620
b4e9f25d6ce6 preparations for lined index list in WeakArray
Claus Gittinger <cg@exept.de>
parents: 18462
diff changeset
  2553
	mclass := who methodClass.
b4e9f25d6ce6 preparations for lined index list in WeakArray
Claus Gittinger <cg@exept.de>
parents: 18462
diff changeset
  2554
	^ mclass
17254
053fe5d7fec8 class: Method
Claus Gittinger <cg@exept.de>
parents: 17250
diff changeset
  2555
    ].
952
d600e08a5936 handle the case where a method has a sourceFileInfo, but the class has not
Claus Gittinger <cg@exept.de>
parents: 934
diff changeset
  2556
    "
d600e08a5936 handle the case where a method has a sourceFileInfo, but the class has not
Claus Gittinger <cg@exept.de>
parents: 934
diff changeset
  2557
     none found - sorry
d600e08a5936 handle the case where a method has a sourceFileInfo, but the class has not
Claus Gittinger <cg@exept.de>
parents: 934
diff changeset
  2558
    "
d600e08a5936 handle the case where a method has a sourceFileInfo, but the class has not
Claus Gittinger <cg@exept.de>
parents: 934
diff changeset
  2559
    ^ nil
d600e08a5936 handle the case where a method has a sourceFileInfo, but the class has not
Claus Gittinger <cg@exept.de>
parents: 934
diff changeset
  2560
d600e08a5936 handle the case where a method has a sourceFileInfo, but the class has not
Claus Gittinger <cg@exept.de>
parents: 934
diff changeset
  2561
    "
12854
3a3d3c02c3bd *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 12695
diff changeset
  2562
     (Object compiledMethodAt:#at:) containingClass
3a3d3c02c3bd *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 12695
diff changeset
  2563
3a3d3c02c3bd *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 12695
diff changeset
  2564
     (Object class compiledMethodAt:#version) containingClass
952
d600e08a5936 handle the case where a method has a sourceFileInfo, but the class has not
Claus Gittinger <cg@exept.de>
parents: 934
diff changeset
  2565
    "
d600e08a5936 handle the case where a method has a sourceFileInfo, but the class has not
Claus Gittinger <cg@exept.de>
parents: 934
diff changeset
  2566
!
d600e08a5936 handle the case where a method has a sourceFileInfo, but the class has not
Claus Gittinger <cg@exept.de>
parents: 934
diff changeset
  2567
10482
11b634beb199 +ole queries
fm
parents: 10375
diff changeset
  2568
externalLibraryFunction
11b634beb199 +ole queries
fm
parents: 10375
diff changeset
  2569
    "if this is an externalLibraryFunction call, return the externalLibraryFunction.
11b634beb199 +ole queries
fm
parents: 10375
diff changeset
  2570
     Returns nil otherwise."
11b634beb199 +ole queries
fm
parents: 10375
diff changeset
  2571
23830
802fef671b06 #REFACTORING by cg
Claus Gittinger <cg@exept.de>
parents: 23827
diff changeset
  2572
    |invokeSelectors newMethod function|
802fef671b06 #REFACTORING by cg
Claus Gittinger <cg@exept.de>
parents: 23827
diff changeset
  2573
802fef671b06 #REFACTORING by cg
Claus Gittinger <cg@exept.de>
parents: 23827
diff changeset
  2574
    invokeSelectors := ExternalLibraryFunction invokeSelectors.
13463
7c98583d98c8 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 13422
diff changeset
  2575
    (self
23830
802fef671b06 #REFACTORING by cg
Claus Gittinger <cg@exept.de>
parents: 23827
diff changeset
  2576
        literalsDetect:[:lit | invokeSelectors includes:lit]
23827
d9f5a3454db2 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 23786
diff changeset
  2577
        ifNone:nil) notNil
13189
96fe3d9e3f3a changed: #externalLibraryFunction
Claus Gittinger <cg@exept.de>
parents: 13156
diff changeset
  2578
    ifTrue:[
23827
d9f5a3454db2 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 23786
diff changeset
  2579
        "/ sigh - for stc-compiled code, this does not work:
d9f5a3454db2 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 23786
diff changeset
  2580
        function := self literalsDetect:[:lit | lit isExternalLibraryFunction] ifNone:nil.
d9f5a3454db2 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 23786
diff changeset
  2581
        function isNil ifTrue:[
d9f5a3454db2 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 23786
diff changeset
  2582
            "/ parse it and ask the parser
d9f5a3454db2 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 23786
diff changeset
  2583
            newMethod := Compiler compile:self source forClass:self mclass install:false.
d9f5a3454db2 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 23786
diff changeset
  2584
            function := newMethod literalsDetect:[:lit | lit isExternalLibraryFunction] ifNone:nil.
d9f5a3454db2 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 23786
diff changeset
  2585
        ].
d9f5a3454db2 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 23786
diff changeset
  2586
        ^ function
13189
96fe3d9e3f3a changed: #externalLibraryFunction
Claus Gittinger <cg@exept.de>
parents: 13156
diff changeset
  2587
    ].
96fe3d9e3f3a changed: #externalLibraryFunction
Claus Gittinger <cg@exept.de>
parents: 13156
diff changeset
  2588
    ^ nil
96fe3d9e3f3a changed: #externalLibraryFunction
Claus Gittinger <cg@exept.de>
parents: 13156
diff changeset
  2589
96fe3d9e3f3a changed: #externalLibraryFunction
Claus Gittinger <cg@exept.de>
parents: 13156
diff changeset
  2590
    "
96fe3d9e3f3a changed: #externalLibraryFunction
Claus Gittinger <cg@exept.de>
parents: 13156
diff changeset
  2591
     (IDispatchPointer compiledMethodAt:#'invokeGetTypeInfo:_:_:')
23827
d9f5a3454db2 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 23786
diff changeset
  2592
        externalLibraryFunction
13189
96fe3d9e3f3a changed: #externalLibraryFunction
Claus Gittinger <cg@exept.de>
parents: 13156
diff changeset
  2593
    "
23827
d9f5a3454db2 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 23786
diff changeset
  2594
23830
802fef671b06 #REFACTORING by cg
Claus Gittinger <cg@exept.de>
parents: 23827
diff changeset
  2595
    "Modified: / 04-03-2019 / 09:37:01 / Claus Gittinger"
10482
11b634beb199 +ole queries
fm
parents: 10375
diff changeset
  2596
!
11b634beb199 +ole queries
fm
parents: 10375
diff changeset
  2597
13422
b43a8a47037c Jan's changes
vrany
parents: 13390
diff changeset
  2598
hasAnnotation
14253
Claus Gittinger <cg@exept.de>
parents: 14251
diff changeset
  2599
    "Return true iff the method has any annotation"
13422
b43a8a47037c Jan's changes
vrany
parents: 13390
diff changeset
  2600
b43a8a47037c Jan's changes
vrany
parents: 13390
diff changeset
  2601
    ^annotations notNil
b43a8a47037c Jan's changes
vrany
parents: 13390
diff changeset
  2602
b43a8a47037c Jan's changes
vrany
parents: 13390
diff changeset
  2603
    "Created: / 11-07-2010 / 19:27:10 / Jan Vrany <jan.vrany@fit.cvut.cz>"
14253
Claus Gittinger <cg@exept.de>
parents: 14251
diff changeset
  2604
    "Modified (comment): / 26-07-2012 / 15:49:59 / cg"
13422
b43a8a47037c Jan's changes
vrany
parents: 13390
diff changeset
  2605
!
b43a8a47037c Jan's changes
vrany
parents: 13390
diff changeset
  2606
b43a8a47037c Jan's changes
vrany
parents: 13390
diff changeset
  2607
hasAnnotation: key
14253
Claus Gittinger <cg@exept.de>
parents: 14251
diff changeset
  2608
    "Return true iff the method is annotated with the given key"
13422
b43a8a47037c Jan's changes
vrany
parents: 13390
diff changeset
  2609
17463
9f3633d1b67e class: Method
Claus Gittinger <cg@exept.de>
parents: 17452
diff changeset
  2610
    annotations isNil ifTrue:[^ false].
9f3633d1b67e class: Method
Claus Gittinger <cg@exept.de>
parents: 17452
diff changeset
  2611
    ^ (self annotationIndexOf: key) notNil
13422
b43a8a47037c Jan's changes
vrany
parents: 13390
diff changeset
  2612
b43a8a47037c Jan's changes
vrany
parents: 13390
diff changeset
  2613
    "Created: / 11-07-2010 / 19:28:00 / Jan Vrany <jan.vrany@fit.cvut.cz>"
14253
Claus Gittinger <cg@exept.de>
parents: 14251
diff changeset
  2614
    "Modified (comment): / 26-07-2012 / 15:49:54 / cg"
13422
b43a8a47037c Jan's changes
vrany
parents: 13390
diff changeset
  2615
!
b43a8a47037c Jan's changes
vrany
parents: 13390
diff changeset
  2616
12913
142c9566a768 added: #hasAnyResource:
Claus Gittinger <cg@exept.de>
parents: 12900
diff changeset
  2617
hasAnyResource:aCollectionOfSymbols
142c9566a768 added: #hasAnyResource:
Claus Gittinger <cg@exept.de>
parents: 12900
diff changeset
  2618
    "return true if the method has a <resource> definition for any symbol in aCollectionOfSymbols"
142c9566a768 added: #hasAnyResource:
Claus Gittinger <cg@exept.de>
parents: 12900
diff changeset
  2619
142c9566a768 added: #hasAnyResource:
Claus Gittinger <cg@exept.de>
parents: 12900
diff changeset
  2620
    ^ self hasResource and:[ self resources keys includesAny:aCollectionOfSymbols ]
142c9566a768 added: #hasAnyResource:
Claus Gittinger <cg@exept.de>
parents: 12900
diff changeset
  2621
142c9566a768 added: #hasAnyResource:
Claus Gittinger <cg@exept.de>
parents: 12900
diff changeset
  2622
    "
142c9566a768 added: #hasAnyResource:
Claus Gittinger <cg@exept.de>
parents: 12900
diff changeset
  2623
     Method allInstancesDo:[:m |
18620
b4e9f25d6ce6 preparations for lined index list in WeakArray
Claus Gittinger <cg@exept.de>
parents: 18462
diff changeset
  2624
	(m hasAnyResource:#(image canvas)) ifTrue:[self halt]
12913
142c9566a768 added: #hasAnyResource:
Claus Gittinger <cg@exept.de>
parents: 12900
diff changeset
  2625
     ].
142c9566a768 added: #hasAnyResource:
Claus Gittinger <cg@exept.de>
parents: 12900
diff changeset
  2626
    "
142c9566a768 added: #hasAnyResource:
Claus Gittinger <cg@exept.de>
parents: 12900
diff changeset
  2627
!
142c9566a768 added: #hasAnyResource:
Claus Gittinger <cg@exept.de>
parents: 12900
diff changeset
  2628
952
d600e08a5936 handle the case where a method has a sourceFileInfo, but the class has not
Claus Gittinger <cg@exept.de>
parents: 934
diff changeset
  2629
hasPrimitiveCode
d600e08a5936 handle the case where a method has a sourceFileInfo, but the class has not
Claus Gittinger <cg@exept.de>
parents: 934
diff changeset
  2630
    "return true, if the method contains primitive code; false if not.
d600e08a5936 handle the case where a method has a sourceFileInfo, but the class has not
Claus Gittinger <cg@exept.de>
parents: 934
diff changeset
  2631
     Uses Parser to parse methods source and get the information."
d600e08a5936 handle the case where a method has a sourceFileInfo, but the class has not
Claus Gittinger <cg@exept.de>
parents: 934
diff changeset
  2632
d600e08a5936 handle the case where a method has a sourceFileInfo, but the class has not
Claus Gittinger <cg@exept.de>
parents: 934
diff changeset
  2633
    |src|
159
514c749165c3 *** empty log message ***
claus
parents: 142
diff changeset
  2634
2218
93c4cb83372a comment
Claus Gittinger <cg@exept.de>
parents: 2201
diff changeset
  2635
    "/ first a trivial reject, if the source does not
5534
bf00d9a2dfd5 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5530
diff changeset
  2636
    "/ contain a '% {' sequence
2218
93c4cb83372a comment
Claus Gittinger <cg@exept.de>
parents: 2201
diff changeset
  2637
952
d600e08a5936 handle the case where a method has a sourceFileInfo, but the class has not
Claus Gittinger <cg@exept.de>
parents: 934
diff changeset
  2638
    src := self source.
d600e08a5936 handle the case where a method has a sourceFileInfo, but the class has not
Claus Gittinger <cg@exept.de>
parents: 934
diff changeset
  2639
    src notNil ifTrue:[
18620
b4e9f25d6ce6 preparations for lined index list in WeakArray
Claus Gittinger <cg@exept.de>
parents: 18462
diff changeset
  2640
	(src includesString:(String with:$% with:${) "<- no constant here - to avoid trouble with stupid scanners" ) ifFalse:[
b4e9f25d6ce6 preparations for lined index list in WeakArray
Claus Gittinger <cg@exept.de>
parents: 18462
diff changeset
  2641
	    "/ cannot contain primitive code.
b4e9f25d6ce6 preparations for lined index list in WeakArray
Claus Gittinger <cg@exept.de>
parents: 18462
diff changeset
  2642
	    ^ false
b4e9f25d6ce6 preparations for lined index list in WeakArray
Claus Gittinger <cg@exept.de>
parents: 18462
diff changeset
  2643
	]
952
d600e08a5936 handle the case where a method has a sourceFileInfo, but the class has not
Claus Gittinger <cg@exept.de>
parents: 934
diff changeset
  2644
    ].
2218
93c4cb83372a comment
Claus Gittinger <cg@exept.de>
parents: 2201
diff changeset
  2645
93c4cb83372a comment
Claus Gittinger <cg@exept.de>
parents: 2201
diff changeset
  2646
    "/ ok; it may or may not ...
93c4cb83372a comment
Claus Gittinger <cg@exept.de>
parents: 2201
diff changeset
  2647
952
d600e08a5936 handle the case where a method has a sourceFileInfo, but the class has not
Claus Gittinger <cg@exept.de>
parents: 934
diff changeset
  2648
    ^ self parse:#'parseMethodSilent:' return:#hasPrimitiveCode or:false
d600e08a5936 handle the case where a method has a sourceFileInfo, but the class has not
Claus Gittinger <cg@exept.de>
parents: 934
diff changeset
  2649
d600e08a5936 handle the case where a method has a sourceFileInfo, but the class has not
Claus Gittinger <cg@exept.de>
parents: 934
diff changeset
  2650
    "
12854
3a3d3c02c3bd *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 12695
diff changeset
  2651
     (Method compiledMethodAt:#hasPrimitiveCode) hasPrimitiveCode
3a3d3c02c3bd *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 12695
diff changeset
  2652
     (Object compiledMethodAt:#at:) hasPrimitiveCode
3a3d3c02c3bd *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 12695
diff changeset
  2653
     (Object compiledMethodAt:#basicAt:) hasPrimitiveCode
952
d600e08a5936 handle the case where a method has a sourceFileInfo, but the class has not
Claus Gittinger <cg@exept.de>
parents: 934
diff changeset
  2654
    "
159
514c749165c3 *** empty log message ***
claus
parents: 142
diff changeset
  2655
2218
93c4cb83372a comment
Claus Gittinger <cg@exept.de>
parents: 2201
diff changeset
  2656
    "Modified: 22.1.1997 / 00:03:45 / cg"
952
d600e08a5936 handle the case where a method has a sourceFileInfo, but the class has not
Claus Gittinger <cg@exept.de>
parents: 934
diff changeset
  2657
!
d600e08a5936 handle the case where a method has a sourceFileInfo, but the class has not
Claus Gittinger <cg@exept.de>
parents: 934
diff changeset
  2658
1093
1e742016eea0 category rename / added access to RESOURCE and CALLED flags
Claus Gittinger <cg@exept.de>
parents: 1087
diff changeset
  2659
hasResource
1e742016eea0 category rename / added access to RESOURCE and CALLED flags
Claus Gittinger <cg@exept.de>
parents: 1087
diff changeset
  2660
    "return true if the method had a <resource> definition in its
8518
7dc3f9909640 Interchanged the meaning of method privacy -
Stefan Vogel <sv@exept.de>
parents: 8465
diff changeset
  2661
     source. This flag can be used to find resource-flagged methods quicker."
1093
1e742016eea0 category rename / added access to RESOURCE and CALLED flags
Claus Gittinger <cg@exept.de>
parents: 1087
diff changeset
  2662
1e742016eea0 category rename / added access to RESOURCE and CALLED flags
Claus Gittinger <cg@exept.de>
parents: 1087
diff changeset
  2663
%{  /* NOCONTEXT */
1e742016eea0 category rename / added access to RESOURCE and CALLED flags
Claus Gittinger <cg@exept.de>
parents: 1087
diff changeset
  2664
1e742016eea0 category rename / added access to RESOURCE and CALLED flags
Claus Gittinger <cg@exept.de>
parents: 1087
diff changeset
  2665
#ifdef F_RESOURCE
1133
961f2b095c22 underline cleanup
Claus Gittinger <cg@exept.de>
parents: 1103
diff changeset
  2666
    RETURN (((INT)__INST(flags) & __MASKSMALLINT(F_RESOURCE)) ? true : false);
1093
1e742016eea0 category rename / added access to RESOURCE and CALLED flags
Claus Gittinger <cg@exept.de>
parents: 1087
diff changeset
  2667
#endif
1e742016eea0 category rename / added access to RESOURCE and CALLED flags
Claus Gittinger <cg@exept.de>
parents: 1087
diff changeset
  2668
%}.
1e742016eea0 category rename / added access to RESOURCE and CALLED flags
Claus Gittinger <cg@exept.de>
parents: 1087
diff changeset
  2669
    ^ false
1e742016eea0 category rename / added access to RESOURCE and CALLED flags
Claus Gittinger <cg@exept.de>
parents: 1087
diff changeset
  2670
!
1e742016eea0 category rename / added access to RESOURCE and CALLED flags
Claus Gittinger <cg@exept.de>
parents: 1087
diff changeset
  2671
10482
11b634beb199 +ole queries
fm
parents: 10375
diff changeset
  2672
indexOfOLECall
14357
08d5b662477a comment/format in: #indexOfOLECall
Claus Gittinger <cg@exept.de>
parents: 14274
diff changeset
  2673
    "return the vtable inedx, if the method contains an ole call; nil if not.
10482
11b634beb199 +ole queries
fm
parents: 10375
diff changeset
  2674
     Uses Parser to parse methods source and get the information."
11b634beb199 +ole queries
fm
parents: 10375
diff changeset
  2675
11b634beb199 +ole queries
fm
parents: 10375
diff changeset
  2676
    |funcOrNil|
11b634beb199 +ole queries
fm
parents: 10375
diff changeset
  2677
11b634beb199 +ole queries
fm
parents: 10375
diff changeset
  2678
    funcOrNil := self externalLibraryFunction.
11b634beb199 +ole queries
fm
parents: 10375
diff changeset
  2679
    (funcOrNil isNil or:[funcOrNil isCallTypeOLE not]) ifTrue:[^ nil].
11b634beb199 +ole queries
fm
parents: 10375
diff changeset
  2680
    ^ funcOrNil vtableIndex
11b634beb199 +ole queries
fm
parents: 10375
diff changeset
  2681
11b634beb199 +ole queries
fm
parents: 10375
diff changeset
  2682
    "
12854
3a3d3c02c3bd *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 12695
diff changeset
  2683
     (Method compiledMethodAt:#hasPrimitiveCode) isOLECall
3a3d3c02c3bd *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 12695
diff changeset
  2684
     (Method compiledMethodAt:#hasPrimitiveCode) indexOfOLECall
3a3d3c02c3bd *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 12695
diff changeset
  2685
3a3d3c02c3bd *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 12695
diff changeset
  2686
     (Win32OperatingSystem class compiledMethodAt:#primClosePrinter:) isOLECall
3a3d3c02c3bd *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 12695
diff changeset
  2687
     (Win32OperatingSystem class compiledMethodAt:#primClosePrinter:) indexOfOLECall
3a3d3c02c3bd *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 12695
diff changeset
  2688
     (Win32OperatingSystem class compiledMethodAt:#primClosePrinter:) isExternalLibraryFunctionCall
3a3d3c02c3bd *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 12695
diff changeset
  2689
     (Win32OperatingSystem class compiledMethodAt:#primClosePrinter:) externalLibraryFunctionCall
3a3d3c02c3bd *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 12695
diff changeset
  2690
3a3d3c02c3bd *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 12695
diff changeset
  2691
     (IUnknownPointer compiledMethodAt:#invokeAddRef) isExternalLibraryFunctionCall
3a3d3c02c3bd *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 12695
diff changeset
  2692
     (IUnknownPointer compiledMethodAt:#invokeAddRef) externalLibraryFunction
3a3d3c02c3bd *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 12695
diff changeset
  2693
     (IUnknownPointer compiledMethodAt:#invokeAddRef) isOLECall
3a3d3c02c3bd *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 12695
diff changeset
  2694
     (IUnknownPointer compiledMethodAt:#invokeAddRef) indexOfOLECall
10482
11b634beb199 +ole queries
fm
parents: 10375
diff changeset
  2695
    "
14357
08d5b662477a comment/format in: #indexOfOLECall
Claus Gittinger <cg@exept.de>
parents: 14274
diff changeset
  2696
08d5b662477a comment/format in: #indexOfOLECall
Claus Gittinger <cg@exept.de>
parents: 14274
diff changeset
  2697
    "Modified (comment): / 25-09-2012 / 12:01:32 / cg"
10482
11b634beb199 +ole queries
fm
parents: 10375
diff changeset
  2698
!
11b634beb199 +ole queries
fm
parents: 10375
diff changeset
  2699
11986
3f2738b9e2c3 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 11985
diff changeset
  2700
isDocumentationMethod
11987
05e30e073541 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 11986
diff changeset
  2701
    "Return true, if this is a documentation only (only a comment) method
05e30e073541 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 11986
diff changeset
  2702
     (implies being a metaclass method)"
11986
3f2738b9e2c3 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 11985
diff changeset
  2703
12275
8ca2aabefa4e changed: #isDocumentationMethod
Claus Gittinger <cg@exept.de>
parents: 12216
diff changeset
  2704
    self mclass isMeta ifFalse:[^ false].
12283
54b6f67bcc26 changed: #isDocumentationMethod
Claus Gittinger <cg@exept.de>
parents: 12275
diff changeset
  2705
    self isVersionMethod ifTrue:[^ false].
12159
1768c0019100 compiler interface
fm
parents: 12017
diff changeset
  2706
    ^ self parse:#'parseMethodSilent:' return:#isEmptyMethod or:false.
11986
3f2738b9e2c3 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 11985
diff changeset
  2707
!
3f2738b9e2c3 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 11985
diff changeset
  2708
13639
01a74c51c29a added: #isExtension
Claus Gittinger <cg@exept.de>
parents: 13638
diff changeset
  2709
isExtension
01a74c51c29a added: #isExtension
Claus Gittinger <cg@exept.de>
parents: 13638
diff changeset
  2710
    "return true, if this method is an extension (i.e. package ~= classes' package)"
01a74c51c29a added: #isExtension
Claus Gittinger <cg@exept.de>
parents: 13638
diff changeset
  2711
01a74c51c29a added: #isExtension
Claus Gittinger <cg@exept.de>
parents: 13638
diff changeset
  2712
    ^ package ~= self mclass package
01a74c51c29a added: #isExtension
Claus Gittinger <cg@exept.de>
parents: 13638
diff changeset
  2713
01a74c51c29a added: #isExtension
Claus Gittinger <cg@exept.de>
parents: 13638
diff changeset
  2714
    "Created: / 07-09-2011 / 09:29:13 / cg"
01a74c51c29a added: #isExtension
Claus Gittinger <cg@exept.de>
parents: 13638
diff changeset
  2715
!
01a74c51c29a added: #isExtension
Claus Gittinger <cg@exept.de>
parents: 13638
diff changeset
  2716
10482
11b634beb199 +ole queries
fm
parents: 10375
diff changeset
  2717
isExternalLibraryFunctionCall
11b634beb199 +ole queries
fm
parents: 10375
diff changeset
  2718
    "Return true, if this is an externalLibraryFunction call."
11b634beb199 +ole queries
fm
parents: 10375
diff changeset
  2719
12569
b97efbbc1ac7 comment/format in: #isExternalLibraryFunctionCall
Claus Gittinger <cg@exept.de>
parents: 12546
diff changeset
  2720
    "/ sigh - for now, stc-compiled code does not have it in the literal array
b97efbbc1ac7 comment/format in: #isExternalLibraryFunctionCall
Claus Gittinger <cg@exept.de>
parents: 12546
diff changeset
  2721
    "/ to be fixed...
b97efbbc1ac7 comment/format in: #isExternalLibraryFunctionCall
Claus Gittinger <cg@exept.de>
parents: 12546
diff changeset
  2722
10482
11b634beb199 +ole queries
fm
parents: 10375
diff changeset
  2723
    ^ self externalLibraryFunction notNil
11b634beb199 +ole queries
fm
parents: 10375
diff changeset
  2724
!
11b634beb199 +ole queries
fm
parents: 10375
diff changeset
  2725
20683
728746379f4b #QUALITY by stefan
Stefan Vogel <sv@exept.de>
parents: 20547
diff changeset
  2726
isForCompatibility
728746379f4b #QUALITY by stefan
Stefan Vogel <sv@exept.de>
parents: 20547
diff changeset
  2727
    "returns true, if this method only used for compatibility
728746379f4b #QUALITY by stefan
Stefan Vogel <sv@exept.de>
parents: 20547
diff changeset
  2728
     and should use only when porting foreign code but not otherwise"
728746379f4b #QUALITY by stefan
Stefan Vogel <sv@exept.de>
parents: 20547
diff changeset
  2729
21450
0f7f5f090f81 #REFACTORING by cg
Claus Gittinger <cg@exept.de>
parents: 21431
diff changeset
  2730
    ^ (self package == #'stx:libcompat') or:[self isTaggedAs:#compatibility]
0f7f5f090f81 #REFACTORING by cg
Claus Gittinger <cg@exept.de>
parents: 21431
diff changeset
  2731
0f7f5f090f81 #REFACTORING by cg
Claus Gittinger <cg@exept.de>
parents: 21431
diff changeset
  2732
    "Modified: / 15-02-2017 / 17:16:10 / cg"
20683
728746379f4b #QUALITY by stefan
Stefan Vogel <sv@exept.de>
parents: 20547
diff changeset
  2733
!
728746379f4b #QUALITY by stefan
Stefan Vogel <sv@exept.de>
parents: 20547
diff changeset
  2734
952
d600e08a5936 handle the case where a method has a sourceFileInfo, but the class has not
Claus Gittinger <cg@exept.de>
parents: 934
diff changeset
  2735
isInvalid
d600e08a5936 handle the case where a method has a sourceFileInfo, but the class has not
Claus Gittinger <cg@exept.de>
parents: 934
diff changeset
  2736
    "return true, if this method is not executable due to
1194
628abcb5fbb6 moved some protocol from to upper levels
Claus Gittinger <cg@exept.de>
parents: 1190
diff changeset
  2737
     a (re)-compilation error. Since invalidation is by patching the
17452
b97d151f8a34 class: Method
Claus Gittinger <cg@exept.de>
parents: 17402
diff changeset
  2738
     method's code-pointer to a trap function, check for that here.
1194
628abcb5fbb6 moved some protocol from to upper levels
Claus Gittinger <cg@exept.de>
parents: 1190
diff changeset
  2739
     (see comment in Method>>invalidCodeObject)."
952
d600e08a5936 handle the case where a method has a sourceFileInfo, but the class has not
Claus Gittinger <cg@exept.de>
parents: 934
diff changeset
  2740
2558
07e7d6fef46d removed unused var
Claus Gittinger <cg@exept.de>
parents: 2541
diff changeset
  2741
    |m myCode|
1873
3544a4a94a2a checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1870
diff changeset
  2742
3544a4a94a2a checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1870
diff changeset
  2743
    myCode := self code.
3544a4a94a2a checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1870
diff changeset
  2744
18438
0655839a70f8 class: Method
Stefan Vogel <sv@exept.de>
parents: 18431
diff changeset
  2745
    m := self trapMethodForNumArgs:(self argumentCount).
1873
3544a4a94a2a checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1870
diff changeset
  2746
    (m notNil and:[self ~~ m]) ifTrue:[
18620
b4e9f25d6ce6 preparations for lined index list in WeakArray
Claus Gittinger <cg@exept.de>
parents: 18462
diff changeset
  2747
	(myCode notNil and:[myCode = m code]) ifTrue:[^ true].
b4e9f25d6ce6 preparations for lined index list in WeakArray
Claus Gittinger <cg@exept.de>
parents: 18462
diff changeset
  2748
	(byteCode notNil and:[byteCode == m byteCode]) ifTrue:[^ true].
952
d600e08a5936 handle the case where a method has a sourceFileInfo, but the class has not
Claus Gittinger <cg@exept.de>
parents: 934
diff changeset
  2749
    ].
159
514c749165c3 *** empty log message ***
claus
parents: 142
diff changeset
  2750
952
d600e08a5936 handle the case where a method has a sourceFileInfo, but the class has not
Claus Gittinger <cg@exept.de>
parents: 934
diff changeset
  2751
    m := Method compiledMethodAt:#uncompiledCodeObject.
1873
3544a4a94a2a checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1870
diff changeset
  2752
    (m notNil and:[self ~~ m]) ifTrue:[
18620
b4e9f25d6ce6 preparations for lined index list in WeakArray
Claus Gittinger <cg@exept.de>
parents: 18462
diff changeset
  2753
	(myCode notNil and:[myCode = m code]) ifTrue:[^ true].
b4e9f25d6ce6 preparations for lined index list in WeakArray
Claus Gittinger <cg@exept.de>
parents: 18462
diff changeset
  2754
	(byteCode notNil and:[byteCode == m byteCode]) ifTrue:[^ true].
952
d600e08a5936 handle the case where a method has a sourceFileInfo, but the class has not
Claus Gittinger <cg@exept.de>
parents: 934
diff changeset
  2755
    ].
1873
3544a4a94a2a checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1870
diff changeset
  2756
3544a4a94a2a checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1870
diff changeset
  2757
    m := Method compiledMethodAt:#unloadedCodeObject.
3544a4a94a2a checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1870
diff changeset
  2758
    (m notNil and:[self ~~ m]) ifTrue:[
18620
b4e9f25d6ce6 preparations for lined index list in WeakArray
Claus Gittinger <cg@exept.de>
parents: 18462
diff changeset
  2759
	(myCode notNil and:[myCode = m code]) ifTrue:[^ true].
b4e9f25d6ce6 preparations for lined index list in WeakArray
Claus Gittinger <cg@exept.de>
parents: 18462
diff changeset
  2760
	(byteCode notNil and:[byteCode == m byteCode]) ifTrue:[^ true].
952
d600e08a5936 handle the case where a method has a sourceFileInfo, but the class has not
Claus Gittinger <cg@exept.de>
parents: 934
diff changeset
  2761
    ].
1873
3544a4a94a2a checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1870
diff changeset
  2762
952
d600e08a5936 handle the case where a method has a sourceFileInfo, but the class has not
Claus Gittinger <cg@exept.de>
parents: 934
diff changeset
  2763
    ^ false
1194
628abcb5fbb6 moved some protocol from to upper levels
Claus Gittinger <cg@exept.de>
parents: 1190
diff changeset
  2764
1873
3544a4a94a2a checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1870
diff changeset
  2765
    "Modified: 4.11.1996 / 23:34:24 / cg"
952
d600e08a5936 handle the case where a method has a sourceFileInfo, but the class has not
Claus Gittinger <cg@exept.de>
parents: 934
diff changeset
  2766
!
d600e08a5936 handle the case where a method has a sourceFileInfo, but the class has not
Claus Gittinger <cg@exept.de>
parents: 934
diff changeset
  2767
d600e08a5936 handle the case where a method has a sourceFileInfo, but the class has not
Claus Gittinger <cg@exept.de>
parents: 934
diff changeset
  2768
isMethod
d600e08a5936 handle the case where a method has a sourceFileInfo, but the class has not
Claus Gittinger <cg@exept.de>
parents: 934
diff changeset
  2769
    "return true, if the receiver is some kind of method;
d600e08a5936 handle the case where a method has a sourceFileInfo, but the class has not
Claus Gittinger <cg@exept.de>
parents: 934
diff changeset
  2770
     true returned here - the method is redefined from Object."
d600e08a5936 handle the case where a method has a sourceFileInfo, but the class has not
Claus Gittinger <cg@exept.de>
parents: 934
diff changeset
  2771
d600e08a5936 handle the case where a method has a sourceFileInfo, but the class has not
Claus Gittinger <cg@exept.de>
parents: 934
diff changeset
  2772
    ^ true
d600e08a5936 handle the case where a method has a sourceFileInfo, but the class has not
Claus Gittinger <cg@exept.de>
parents: 934
diff changeset
  2773
!
d600e08a5936 handle the case where a method has a sourceFileInfo, but the class has not
Claus Gittinger <cg@exept.de>
parents: 934
diff changeset
  2774
10482
11b634beb199 +ole queries
fm
parents: 10375
diff changeset
  2775
isOLECall
11b634beb199 +ole queries
fm
parents: 10375
diff changeset
  2776
    "return true, if the method is an ole call; false if not."
11b634beb199 +ole queries
fm
parents: 10375
diff changeset
  2777
11b634beb199 +ole queries
fm
parents: 10375
diff changeset
  2778
    |funcOrNil|
11b634beb199 +ole queries
fm
parents: 10375
diff changeset
  2779
11b634beb199 +ole queries
fm
parents: 10375
diff changeset
  2780
    funcOrNil := self externalLibraryFunction.
11b634beb199 +ole queries
fm
parents: 10375
diff changeset
  2781
    ^ funcOrNil notNil and:[funcOrNil isCallTypeOLE]
11b634beb199 +ole queries
fm
parents: 10375
diff changeset
  2782
!
11b634beb199 +ole queries
fm
parents: 10375
diff changeset
  2783
5894
ed6193fa6040 Define #isObsolete and fix various comments
Stefan Vogel <sv@exept.de>
parents: 5818
diff changeset
  2784
isObsolete
22443
0670bf503559 #DOCUMENTATION by cg
Claus Gittinger <cg@exept.de>
parents: 22372
diff changeset
  2785
    "returns true, if this method is obsolete and should not be used any longer.
0670bf503559 #DOCUMENTATION by cg
Claus Gittinger <cg@exept.de>
parents: 22372
diff changeset
  2786
     Obsolete methods are marked by a:
0670bf503559 #DOCUMENTATION by cg
Claus Gittinger <cg@exept.de>
parents: 22372
diff changeset
  2787
        <resource: #obsolete> 
0670bf503559 #DOCUMENTATION by cg
Claus Gittinger <cg@exept.de>
parents: 22372
diff changeset
  2788
     attribute.
0670bf503559 #DOCUMENTATION by cg
Claus Gittinger <cg@exept.de>
parents: 22372
diff changeset
  2789
    "
5894
ed6193fa6040 Define #isObsolete and fix various comments
Stefan Vogel <sv@exept.de>
parents: 5818
diff changeset
  2790
21450
0f7f5f090f81 #REFACTORING by cg
Claus Gittinger <cg@exept.de>
parents: 21431
diff changeset
  2791
    ^ self isTaggedAs:#obsolete
0f7f5f090f81 #REFACTORING by cg
Claus Gittinger <cg@exept.de>
parents: 21431
diff changeset
  2792
22443
0670bf503559 #DOCUMENTATION by cg
Claus Gittinger <cg@exept.de>
parents: 22372
diff changeset
  2793
    "
0670bf503559 #DOCUMENTATION by cg
Claus Gittinger <cg@exept.de>
parents: 22372
diff changeset
  2794
     SystemBrowser browseMethods:(Method allInstances select:#isObsolete)  
0670bf503559 #DOCUMENTATION by cg
Claus Gittinger <cg@exept.de>
parents: 22372
diff changeset
  2795
    "
0670bf503559 #DOCUMENTATION by cg
Claus Gittinger <cg@exept.de>
parents: 22372
diff changeset
  2796
21450
0f7f5f090f81 #REFACTORING by cg
Claus Gittinger <cg@exept.de>
parents: 21431
diff changeset
  2797
    "Modified: / 15-02-2017 / 17:15:25 / cg"
5894
ed6193fa6040 Define #isObsolete and fix various comments
Stefan Vogel <sv@exept.de>
parents: 5818
diff changeset
  2798
!
ed6193fa6040 Define #isObsolete and fix various comments
Stefan Vogel <sv@exept.de>
parents: 5818
diff changeset
  2799
15079
8f16af69c964 class: Method
Claus Gittinger <cg@exept.de>
parents: 15045
diff changeset
  2800
isShadowingExtension
8f16af69c964 class: Method
Claus Gittinger <cg@exept.de>
parents: 15045
diff changeset
  2801
    "return true, if this method is an extension (i.e. package ~= classes' package)
8f16af69c964 class: Method
Claus Gittinger <cg@exept.de>
parents: 15045
diff changeset
  2802
     which shadows an existing method from another package (i.e. a package conflict)"
8f16af69c964 class: Method
Claus Gittinger <cg@exept.de>
parents: 15045
diff changeset
  2803
16877
d4a452edacb5 Added Method>>shadowedMethod returning shadowed method or nil.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 16847
diff changeset
  2804
    ^ self shadowedMethod notNil.
d4a452edacb5 Added Method>>shadowedMethod returning shadowed method or nil.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 16847
diff changeset
  2805
d4a452edacb5 Added Method>>shadowedMethod returning shadowed method or nil.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 16847
diff changeset
  2806
    "Modified: / 03-10-2014 / 15:16:32 / Jan Vrany <jan.vrany@fit.cvut.cz>"
15079
8f16af69c964 class: Method
Claus Gittinger <cg@exept.de>
parents: 15045
diff changeset
  2807
!
8f16af69c964 class: Method
Claus Gittinger <cg@exept.de>
parents: 15045
diff changeset
  2808
22019
86723ef64f2d #REFACTORING by cg
Claus Gittinger <cg@exept.de>
parents: 21937
diff changeset
  2809
isSubclassResponsibility
86723ef64f2d #REFACTORING by cg
Claus Gittinger <cg@exept.de>
parents: 21937
diff changeset
  2810
    ^ self 
86723ef64f2d #REFACTORING by cg
Claus Gittinger <cg@exept.de>
parents: 21937
diff changeset
  2811
        sendsAnySelector:#( 
86723ef64f2d #REFACTORING by cg
Claus Gittinger <cg@exept.de>
parents: 21937
diff changeset
  2812
            #subclassResponsibility #subclassResponsibility: 
86723ef64f2d #REFACTORING by cg
Claus Gittinger <cg@exept.de>
parents: 21937
diff changeset
  2813
            #implementedBySubclass  "/ ST/V code uses this
86723ef64f2d #REFACTORING by cg
Claus Gittinger <cg@exept.de>
parents: 21937
diff changeset
  2814
        ).
86723ef64f2d #REFACTORING by cg
Claus Gittinger <cg@exept.de>
parents: 21937
diff changeset
  2815
86723ef64f2d #REFACTORING by cg
Claus Gittinger <cg@exept.de>
parents: 21937
diff changeset
  2816
    "Created: / 16-07-2017 / 11:25:54 / cg"
86723ef64f2d #REFACTORING by cg
Claus Gittinger <cg@exept.de>
parents: 21937
diff changeset
  2817
!
86723ef64f2d #REFACTORING by cg
Claus Gittinger <cg@exept.de>
parents: 21937
diff changeset
  2818
13422
b43a8a47037c Jan's changes
vrany
parents: 13390
diff changeset
  2819
isSynthetic
21336
570b6f97951f #DOCUMENTATION by stefan
Stefan Vogel <sv@exept.de>
parents: 21157
diff changeset
  2820
    "a synthetic method does not really exist - it is only shown in a browser's list"
13638
c5b12d3594ba changed: #rationale
Claus Gittinger <cg@exept.de>
parents: 13634
diff changeset
  2821
c5b12d3594ba changed: #rationale
Claus Gittinger <cg@exept.de>
parents: 13634
diff changeset
  2822
    ^ false
c5b12d3594ba changed: #rationale
Claus Gittinger <cg@exept.de>
parents: 13634
diff changeset
  2823
c5b12d3594ba changed: #rationale
Claus Gittinger <cg@exept.de>
parents: 13634
diff changeset
  2824
    "Modified (format): / 07-09-2011 / 09:00:56 / cg"
21336
570b6f97951f #DOCUMENTATION by stefan
Stefan Vogel <sv@exept.de>
parents: 21157
diff changeset
  2825
    "Modified (comment): / 01-02-2017 / 16:58:39 / stefan"
13422
b43a8a47037c Jan's changes
vrany
parents: 13390
diff changeset
  2826
!
b43a8a47037c Jan's changes
vrany
parents: 13390
diff changeset
  2827
21450
0f7f5f090f81 #REFACTORING by cg
Claus Gittinger <cg@exept.de>
parents: 21431
diff changeset
  2828
isTaggedAs:tag
0f7f5f090f81 #REFACTORING by cg
Claus Gittinger <cg@exept.de>
parents: 21431
diff changeset
  2829
    "returns true, if this method has a <resource: tag> annotation"
0f7f5f090f81 #REFACTORING by cg
Claus Gittinger <cg@exept.de>
parents: 21431
diff changeset
  2830
0f7f5f090f81 #REFACTORING by cg
Claus Gittinger <cg@exept.de>
parents: 21431
diff changeset
  2831
    |res|
0f7f5f090f81 #REFACTORING by cg
Claus Gittinger <cg@exept.de>
parents: 21431
diff changeset
  2832
0f7f5f090f81 #REFACTORING by cg
Claus Gittinger <cg@exept.de>
parents: 21431
diff changeset
  2833
    ^ (res := self resources) notNil and:[res includesKey:tag]
0f7f5f090f81 #REFACTORING by cg
Claus Gittinger <cg@exept.de>
parents: 21431
diff changeset
  2834
0f7f5f090f81 #REFACTORING by cg
Claus Gittinger <cg@exept.de>
parents: 21431
diff changeset
  2835
    "Created: / 15-02-2017 / 17:15:15 / cg"
0f7f5f090f81 #REFACTORING by cg
Claus Gittinger <cg@exept.de>
parents: 21431
diff changeset
  2836
!
0f7f5f090f81 #REFACTORING by cg
Claus Gittinger <cg@exept.de>
parents: 21431
diff changeset
  2837
11985
5fb68bfa4648 +isVersionMethod
Claus Gittinger <cg@exept.de>
parents: 11950
diff changeset
  2838
isVersionMethod
12017
908685b92c3e comment/format in: #isVersionMethod
Claus Gittinger <cg@exept.de>
parents: 12016
diff changeset
  2839
    "Return true, if this is a CVS, SVN or other version method.
908685b92c3e comment/format in: #isVersionMethod
Claus Gittinger <cg@exept.de>
parents: 12016
diff changeset
  2840
     Stupid: need to know all of them here; better add a pragma or
908685b92c3e comment/format in: #isVersionMethod
Claus Gittinger <cg@exept.de>
parents: 12016
diff changeset
  2841
     method attribute for that..."
11985
5fb68bfa4648 +isVersionMethod
Claus Gittinger <cg@exept.de>
parents: 11950
diff changeset
  2842
12016
7918f05b2046 changed: #isVersionMethod
Claus Gittinger <cg@exept.de>
parents: 11987
diff changeset
  2843
    ^ self mclass isMeta
12165
ca71a1aba926 changed: #isVersionMethod
fm
parents: 12159
diff changeset
  2844
    and:[(AbstractSourceCodeManager isVersionMethodSelector:self selector)]
11985
5fb68bfa4648 +isVersionMethod
Claus Gittinger <cg@exept.de>
parents: 11950
diff changeset
  2845
5fb68bfa4648 +isVersionMethod
Claus Gittinger <cg@exept.de>
parents: 11950
diff changeset
  2846
    "
12854
3a3d3c02c3bd *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 12695
diff changeset
  2847
     (Method class compiledMethodAt:#version) isVersionMethod
11985
5fb68bfa4648 +isVersionMethod
Claus Gittinger <cg@exept.de>
parents: 11950
diff changeset
  2848
     (Method class compiledMethodAt:#documentation) isVersionMethod
5fb68bfa4648 +isVersionMethod
Claus Gittinger <cg@exept.de>
parents: 11950
diff changeset
  2849
    "
5fb68bfa4648 +isVersionMethod
Claus Gittinger <cg@exept.de>
parents: 11950
diff changeset
  2850
!
5fb68bfa4648 +isVersionMethod
Claus Gittinger <cg@exept.de>
parents: 11950
diff changeset
  2851
11848
ca89d472f9cf *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 11778
diff changeset
  2852
isVisualWorksTypedef
ca89d472f9cf *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 11778
diff changeset
  2853
    "Return true, if this is a type-returning method (a visualWorks typedef)"
ca89d472f9cf *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 11778
diff changeset
  2854
23786
fee4d65305fd #REFACTORING by cg
Claus Gittinger <cg@exept.de>
parents: 23742
diff changeset
  2855
    ^ (self literals size ~~ 0)
11848
ca89d472f9cf *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 11778
diff changeset
  2856
    and:[ (self literalAt:1) isKindOf:CType ]
23786
fee4d65305fd #REFACTORING by cg
Claus Gittinger <cg@exept.de>
parents: 23742
diff changeset
  2857
fee4d65305fd #REFACTORING by cg
Claus Gittinger <cg@exept.de>
parents: 23742
diff changeset
  2858
    "Modified: / 01-03-2019 / 15:59:37 / Claus Gittinger"
11848
ca89d472f9cf *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 11778
diff changeset
  2859
!
ca89d472f9cf *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 11778
diff changeset
  2860
2695
79229a9ab2da added #mclass for ST80 compatibility
Claus Gittinger <cg@exept.de>
parents: 2694
diff changeset
  2861
mclass
17278
7813956ffab4 class: Method
Claus Gittinger <cg@exept.de>
parents: 17254
diff changeset
  2862
    "return the class in which the receiver is currently contained in.
7813956ffab4 class: Method
Claus Gittinger <cg@exept.de>
parents: 17254
diff changeset
  2863
     Notice, that the mclass query returns nil, if a method is wrapped or no longer valid
18620
b4e9f25d6ce6 preparations for lined index list in WeakArray
Claus Gittinger <cg@exept.de>
parents: 18462
diff changeset
  2864
     due to an accept in a browser or debugger.
17278
7813956ffab4 class: Method
Claus Gittinger <cg@exept.de>
parents: 17254
diff changeset
  2865
     However, the mclass slot still contains a reference to the once valid class and can be fetched
7813956ffab4 class: Method
Claus Gittinger <cg@exept.de>
parents: 17254
diff changeset
  2866
     via getMclass.
2695
79229a9ab2da added #mclass for ST80 compatibility
Claus Gittinger <cg@exept.de>
parents: 2694
diff changeset
  2867
     Same as #containingClass, for ST80 compatibility."
79229a9ab2da added #mclass for ST80 compatibility
Claus Gittinger <cg@exept.de>
parents: 2694
diff changeset
  2868
79229a9ab2da added #mclass for ST80 compatibility
Claus Gittinger <cg@exept.de>
parents: 2694
diff changeset
  2869
    ^ self containingClass
79229a9ab2da added #mclass for ST80 compatibility
Claus Gittinger <cg@exept.de>
parents: 2694
diff changeset
  2870
79229a9ab2da added #mclass for ST80 compatibility
Claus Gittinger <cg@exept.de>
parents: 2694
diff changeset
  2871
    "Created: 19.6.1997 / 16:26:13 / cg"
79229a9ab2da added #mclass for ST80 compatibility
Claus Gittinger <cg@exept.de>
parents: 2694
diff changeset
  2872
!
79229a9ab2da added #mclass for ST80 compatibility
Claus Gittinger <cg@exept.de>
parents: 2694
diff changeset
  2873
5696
958a0643496d compatibility
Claus Gittinger <cg@exept.de>
parents: 5676
diff changeset
  2874
messages
958a0643496d compatibility
Claus Gittinger <cg@exept.de>
parents: 5676
diff changeset
  2875
    "return a collection of message-selectors, sent by this method."
958a0643496d compatibility
Claus Gittinger <cg@exept.de>
parents: 5676
diff changeset
  2876
958a0643496d compatibility
Claus Gittinger <cg@exept.de>
parents: 5676
diff changeset
  2877
    ^ self messagesSent
958a0643496d compatibility
Claus Gittinger <cg@exept.de>
parents: 5676
diff changeset
  2878
!
958a0643496d compatibility
Claus Gittinger <cg@exept.de>
parents: 5676
diff changeset
  2879
5584
b175797a8c4d #messagesDo: (VW compatibility)
Claus Gittinger <cg@exept.de>
parents: 5582
diff changeset
  2880
messagesDo:aBlock
b175797a8c4d #messagesDo: (VW compatibility)
Claus Gittinger <cg@exept.de>
parents: 5582
diff changeset
  2881
    "evaluate aBlock for each message-selector sent by this method.
b175797a8c4d #messagesDo: (VW compatibility)
Claus Gittinger <cg@exept.de>
parents: 5582
diff changeset
  2882
     Uses Parser to parse methods source and extract the names."
b175797a8c4d #messagesDo: (VW compatibility)
Claus Gittinger <cg@exept.de>
parents: 5582
diff changeset
  2883
b175797a8c4d #messagesDo: (VW compatibility)
Claus Gittinger <cg@exept.de>
parents: 5582
diff changeset
  2884
    ^ self messagesSent do:aBlock
b175797a8c4d #messagesDo: (VW compatibility)
Claus Gittinger <cg@exept.de>
parents: 5582
diff changeset
  2885
!
b175797a8c4d #messagesDo: (VW compatibility)
Claus Gittinger <cg@exept.de>
parents: 5582
diff changeset
  2886
14402
Claus Gittinger <cg@exept.de>
parents: 14375
diff changeset
  2887
messagesPossiblySent
Claus Gittinger <cg@exept.de>
parents: 14375
diff changeset
  2888
    "return a collection with the message selectors possibly sent to by the receiver.
Claus Gittinger <cg@exept.de>
parents: 14375
diff changeset
  2889
     Uses Parser to parse methods source and extract the names.
Claus Gittinger <cg@exept.de>
parents: 14375
diff changeset
  2890
     The returned collection includes perform-like and possibly performed messages"
Claus Gittinger <cg@exept.de>
parents: 14375
diff changeset
  2891
Claus Gittinger <cg@exept.de>
parents: 14375
diff changeset
  2892
    ^ self parse:#'parseMethodSilent:in:' with:self mclass return:#messagesPossiblySent or:#()
Claus Gittinger <cg@exept.de>
parents: 14375
diff changeset
  2893
Claus Gittinger <cg@exept.de>
parents: 14375
diff changeset
  2894
    "
Claus Gittinger <cg@exept.de>
parents: 14375
diff changeset
  2895
     (Method compiledMethodAt:#printOn:) messagesSent
Claus Gittinger <cg@exept.de>
parents: 14375
diff changeset
  2896
     (Point compiledMethodAt:#x:) messagesSent
17173
e8fd5eb30331 class: Method
Claus Gittinger <cg@exept.de>
parents: 17159
diff changeset
  2897
18620
b4e9f25d6ce6 preparations for lined index list in WeakArray
Claus Gittinger <cg@exept.de>
parents: 18462
diff changeset
  2898
     (WindowEvent class compiledMethodAt:#focusInView:) messagesSent
b4e9f25d6ce6 preparations for lined index list in WeakArray
Claus Gittinger <cg@exept.de>
parents: 18462
diff changeset
  2899
     (WindowEvent class compiledMethodAt:#focusInView:) messagesPossiblySent
b4e9f25d6ce6 preparations for lined index list in WeakArray
Claus Gittinger <cg@exept.de>
parents: 18462
diff changeset
  2900
b4e9f25d6ce6 preparations for lined index list in WeakArray
Claus Gittinger <cg@exept.de>
parents: 18462
diff changeset
  2901
     (Method compiledMethodAt:#messagesPossiblySent) messagesSent
b4e9f25d6ce6 preparations for lined index list in WeakArray
Claus Gittinger <cg@exept.de>
parents: 18462
diff changeset
  2902
     (Method compiledMethodAt:#messagesPossiblySent) messagesPossiblySent
14402
Claus Gittinger <cg@exept.de>
parents: 14375
diff changeset
  2903
    "
Claus Gittinger <cg@exept.de>
parents: 14375
diff changeset
  2904
!
Claus Gittinger <cg@exept.de>
parents: 14375
diff changeset
  2905
5582
737d121ae7de *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5564
diff changeset
  2906
messagesSent
737d121ae7de *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5564
diff changeset
  2907
    "return a collection with the message selectors sent to by the receiver.
737d121ae7de *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5564
diff changeset
  2908
     Uses Parser to parse methods source and extract the names.
737d121ae7de *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5564
diff changeset
  2909
     The returned collection includes all used message selectors (i.e. including super-send messages)"
737d121ae7de *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5564
diff changeset
  2910
12854
3a3d3c02c3bd *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 12695
diff changeset
  2911
    ^ self parse:#'parseMethodSilent:in:' with:self mclass return:#messagesSent or:#()
5582
737d121ae7de *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5564
diff changeset
  2912
737d121ae7de *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5564
diff changeset
  2913
    "
12854
3a3d3c02c3bd *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 12695
diff changeset
  2914
     (Method compiledMethodAt:#printOn:) messagesSent
3a3d3c02c3bd *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 12695
diff changeset
  2915
     (Point compiledMethodAt:#x:) messagesSent
5582
737d121ae7de *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5564
diff changeset
  2916
    "
737d121ae7de *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5564
diff changeset
  2917
!
737d121ae7de *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5564
diff changeset
  2918
737d121ae7de *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5564
diff changeset
  2919
messagesSentToSelf
737d121ae7de *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5564
diff changeset
  2920
    "return a collection with the message selectors sent to self by the receiver.
737d121ae7de *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5564
diff changeset
  2921
     Uses Parser to parse methods source and extract the names."
737d121ae7de *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5564
diff changeset
  2922
12854
3a3d3c02c3bd *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 12695
diff changeset
  2923
    ^ self parse:#'parseMethodSilent:in:' with:self mclass return:#messagesSentToSelf or:#()
5652
f832f4c5cfdd messagesSentTo* fixed
Claus Gittinger <cg@exept.de>
parents: 5644
diff changeset
  2924
5582
737d121ae7de *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5564
diff changeset
  2925
!
737d121ae7de *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5564
diff changeset
  2926
737d121ae7de *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5564
diff changeset
  2927
messagesSentToSuper
737d121ae7de *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5564
diff changeset
  2928
    "return a collection with the message selectors sent to super by the receiver.
737d121ae7de *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5564
diff changeset
  2929
     Uses Parser to parse methods source and extract the names."
737d121ae7de *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5564
diff changeset
  2930
12854
3a3d3c02c3bd *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 12695
diff changeset
  2931
    ^ self parse:#'parseMethodSilent:in:' with:self mclass return:#messagesSentToSuper or:#()
5652
f832f4c5cfdd messagesSentTo* fixed
Claus Gittinger <cg@exept.de>
parents: 5644
diff changeset
  2932
5582
737d121ae7de *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5564
diff changeset
  2933
!
737d121ae7de *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5564
diff changeset
  2934
952
d600e08a5936 handle the case where a method has a sourceFileInfo, but the class has not
Claus Gittinger <cg@exept.de>
parents: 934
diff changeset
  2935
methodArgAndVarNames
22372
72db331204d4 #DOCUMENTATION by cg
Claus Gittinger <cg@exept.de>
parents: 22188
diff changeset
  2936
    "return a collection with the method's argument and variable names.
72db331204d4 #DOCUMENTATION by cg
Claus Gittinger <cg@exept.de>
parents: 22188
diff changeset
  2937
     Uses Parser to parse the method's source and extract the names.
15787
7ea8bff49835 class: Method
Claus Gittinger <cg@exept.de>
parents: 15768
diff changeset
  2938
     Returns an empty collection if the source is not available, or some other
18620
b4e9f25d6ce6 preparations for lined index list in WeakArray
Claus Gittinger <cg@exept.de>
parents: 18462
diff changeset
  2939
     syntax/parse error occurred.
15787
7ea8bff49835 class: Method
Claus Gittinger <cg@exept.de>
parents: 15768
diff changeset
  2940
     For methods with no args and no vars, an empty collection is returned."
952
d600e08a5936 handle the case where a method has a sourceFileInfo, but the class has not
Claus Gittinger <cg@exept.de>
parents: 934
diff changeset
  2941
8427
bba41f189196 parserClass stuff
ca
parents: 8419
diff changeset
  2942
    |parserClass parser sourceString argNames varNames|
bba41f189196 parserClass stuff
ca
parents: 8419
diff changeset
  2943
bba41f189196 parserClass stuff
ca
parents: 8419
diff changeset
  2944
    parserClass := self parserClass.
952
d600e08a5936 handle the case where a method has a sourceFileInfo, but the class has not
Claus Gittinger <cg@exept.de>
parents: 934
diff changeset
  2945
    sourceString := self source.
8427
bba41f189196 parserClass stuff
ca
parents: 8419
diff changeset
  2946
    (parserClass notNil and:[sourceString notNil]) ifTrue:[
22372
72db331204d4 #DOCUMENTATION by cg
Claus Gittinger <cg@exept.de>
parents: 22188
diff changeset
  2947
        parser := parserClass parseMethodArgAndVarSpecificationSilent:sourceString.
72db331204d4 #DOCUMENTATION by cg
Claus Gittinger <cg@exept.de>
parents: 22188
diff changeset
  2948
        (parser isNil or:[parser == #Error]) ifTrue:[^ #()].
72db331204d4 #DOCUMENTATION by cg
Claus Gittinger <cg@exept.de>
parents: 22188
diff changeset
  2949
        argNames := parser methodArgs.
72db331204d4 #DOCUMENTATION by cg
Claus Gittinger <cg@exept.de>
parents: 22188
diff changeset
  2950
        varNames := parser methodVars.
72db331204d4 #DOCUMENTATION by cg
Claus Gittinger <cg@exept.de>
parents: 22188
diff changeset
  2951
        argNames isNil ifTrue:[^ varNames ? #()].
72db331204d4 #DOCUMENTATION by cg
Claus Gittinger <cg@exept.de>
parents: 22188
diff changeset
  2952
        varNames isNil ifTrue:[^ argNames ? #()].
72db331204d4 #DOCUMENTATION by cg
Claus Gittinger <cg@exept.de>
parents: 22188
diff changeset
  2953
        ^ (argNames , varNames)
159
514c749165c3 *** empty log message ***
claus
parents: 142
diff changeset
  2954
    ].
15787
7ea8bff49835 class: Method
Claus Gittinger <cg@exept.de>
parents: 15768
diff changeset
  2955
    ^ #()
952
d600e08a5936 handle the case where a method has a sourceFileInfo, but the class has not
Claus Gittinger <cg@exept.de>
parents: 934
diff changeset
  2956
159
514c749165c3 *** empty log message ***
claus
parents: 142
diff changeset
  2957
    "
952
d600e08a5936 handle the case where a method has a sourceFileInfo, but the class has not
Claus Gittinger <cg@exept.de>
parents: 934
diff changeset
  2958
     (Method compiledMethodAt:#printOn:) methodArgAndVarNames
159
514c749165c3 *** empty log message ***
claus
parents: 142
diff changeset
  2959
    "
22372
72db331204d4 #DOCUMENTATION by cg
Claus Gittinger <cg@exept.de>
parents: 22188
diff changeset
  2960
72db331204d4 #DOCUMENTATION by cg
Claus Gittinger <cg@exept.de>
parents: 22188
diff changeset
  2961
    "Modified (comment): / 21-11-2017 / 13:04:33 / cg"
952
d600e08a5936 handle the case where a method has a sourceFileInfo, but the class has not
Claus Gittinger <cg@exept.de>
parents: 934
diff changeset
  2962
!
d600e08a5936 handle the case where a method has a sourceFileInfo, but the class has not
Claus Gittinger <cg@exept.de>
parents: 934
diff changeset
  2963
15649
4484fd85cb9e class: Method
Stefan Vogel <sv@exept.de>
parents: 15614
diff changeset
  2964
methodArgAndVarNamesInContext: context
15727
d0ec35ce96fc class: Method
Claus Gittinger <cg@exept.de>
parents: 15649
diff changeset
  2965
    "return a collection with the method's argument and variable names.
15649
4484fd85cb9e class: Method
Stefan Vogel <sv@exept.de>
parents: 15614
diff changeset
  2966
     Uses Parser to parse methods source and extract the names.
4484fd85cb9e class: Method
Stefan Vogel <sv@exept.de>
parents: 15614
diff changeset
  2967
     Returns nil if the source is not available, or some other
4484fd85cb9e class: Method
Stefan Vogel <sv@exept.de>
parents: 15614
diff changeset
  2968
     syntax/parse error occurred. For methods with no args and no vars,
4484fd85cb9e class: Method
Stefan Vogel <sv@exept.de>
parents: 15614
diff changeset
  2969
     an empty collection is returned."
18620
b4e9f25d6ce6 preparations for lined index list in WeakArray
Claus Gittinger <cg@exept.de>
parents: 18462
diff changeset
  2970
15649
4484fd85cb9e class: Method
Stefan Vogel <sv@exept.de>
parents: 15614
diff changeset
  2971
     ^self methodArgAndVarNames
18620
b4e9f25d6ce6 preparations for lined index list in WeakArray
Claus Gittinger <cg@exept.de>
parents: 18462
diff changeset
  2972
15649
4484fd85cb9e class: Method
Stefan Vogel <sv@exept.de>
parents: 15614
diff changeset
  2973
     "Created: / 18-12-2012 / 18:17:30 / Jan Vrany <jan.vrany@fit.cvut.cz>"
4484fd85cb9e class: Method
Stefan Vogel <sv@exept.de>
parents: 15614
diff changeset
  2974
!
4484fd85cb9e class: Method
Stefan Vogel <sv@exept.de>
parents: 15614
diff changeset
  2975
952
d600e08a5936 handle the case where a method has a sourceFileInfo, but the class has not
Claus Gittinger <cg@exept.de>
parents: 934
diff changeset
  2976
methodArgNames
22372
72db331204d4 #DOCUMENTATION by cg
Claus Gittinger <cg@exept.de>
parents: 22188
diff changeset
  2977
    "return a collection with the method's argument names.
72db331204d4 #DOCUMENTATION by cg
Claus Gittinger <cg@exept.de>
parents: 22188
diff changeset
  2978
     Uses Parser to parse the method's source and extract the names."
952
d600e08a5936 handle the case where a method has a sourceFileInfo, but the class has not
Claus Gittinger <cg@exept.de>
parents: 934
diff changeset
  2979
22669
308cc7b248e5 #BUGFIX by stefan
Stefan Vogel <sv@exept.de>
parents: 22527
diff changeset
  2980
    ^ self parse:#parseMethodSpecificationSilent: return:#methodArgs or:nil
952
d600e08a5936 handle the case where a method has a sourceFileInfo, but the class has not
Claus Gittinger <cg@exept.de>
parents: 934
diff changeset
  2981
d600e08a5936 handle the case where a method has a sourceFileInfo, but the class has not
Claus Gittinger <cg@exept.de>
parents: 934
diff changeset
  2982
    "
d600e08a5936 handle the case where a method has a sourceFileInfo, but the class has not
Claus Gittinger <cg@exept.de>
parents: 934
diff changeset
  2983
     (Method compiledMethodAt:#printOn:) methodArgNames
d600e08a5936 handle the case where a method has a sourceFileInfo, but the class has not
Claus Gittinger <cg@exept.de>
parents: 934
diff changeset
  2984
    "
d600e08a5936 handle the case where a method has a sourceFileInfo, but the class has not
Claus Gittinger <cg@exept.de>
parents: 934
diff changeset
  2985
22372
72db331204d4 #DOCUMENTATION by cg
Claus Gittinger <cg@exept.de>
parents: 22188
diff changeset
  2986
    "Modified: / 31-10-1995 / 14:36:46 / cg"
72db331204d4 #DOCUMENTATION by cg
Claus Gittinger <cg@exept.de>
parents: 22188
diff changeset
  2987
    "Modified (comment): / 21-11-2017 / 13:04:44 / cg"
22669
308cc7b248e5 #BUGFIX by stefan
Stefan Vogel <sv@exept.de>
parents: 22527
diff changeset
  2988
    "Modified (format): / 12-04-2018 / 08:41:23 / stefan"
872
af04035b443d binary class storage support
Claus Gittinger <cg@exept.de>
parents: 829
diff changeset
  2989
!
af04035b443d binary class storage support
Claus Gittinger <cg@exept.de>
parents: 829
diff changeset
  2990
952
d600e08a5936 handle the case where a method has a sourceFileInfo, but the class has not
Claus Gittinger <cg@exept.de>
parents: 934
diff changeset
  2991
methodComment
22372
72db331204d4 #DOCUMENTATION by cg
Claus Gittinger <cg@exept.de>
parents: 22188
diff changeset
  2992
    "return the method's first comment, nil if there is none.
952
d600e08a5936 handle the case where a method has a sourceFileInfo, but the class has not
Claus Gittinger <cg@exept.de>
parents: 934
diff changeset
  2993
     This is a somewhat stupid implementation."
872
af04035b443d binary class storage support
Claus Gittinger <cg@exept.de>
parents: 829
diff changeset
  2994
952
d600e08a5936 handle the case where a method has a sourceFileInfo, but the class has not
Claus Gittinger <cg@exept.de>
parents: 934
diff changeset
  2995
    |text line nQuote index qIndex qIndex2 comment|
d600e08a5936 handle the case where a method has a sourceFileInfo, but the class has not
Claus Gittinger <cg@exept.de>
parents: 934
diff changeset
  2996
d600e08a5936 handle the case where a method has a sourceFileInfo, but the class has not
Claus Gittinger <cg@exept.de>
parents: 934
diff changeset
  2997
    text := self source asCollectionOfLines.
d600e08a5936 handle the case where a method has a sourceFileInfo, but the class has not
Claus Gittinger <cg@exept.de>
parents: 934
diff changeset
  2998
    (text size < 2) ifTrue:[^nil].
872
af04035b443d binary class storage support
Claus Gittinger <cg@exept.de>
parents: 829
diff changeset
  2999
952
d600e08a5936 handle the case where a method has a sourceFileInfo, but the class has not
Claus Gittinger <cg@exept.de>
parents: 934
diff changeset
  3000
    line := (text at:2).
d600e08a5936 handle the case where a method has a sourceFileInfo, but the class has not
Claus Gittinger <cg@exept.de>
parents: 934
diff changeset
  3001
    nQuote := line occurrencesOf:(Character doubleQuote).
d600e08a5936 handle the case where a method has a sourceFileInfo, but the class has not
Claus Gittinger <cg@exept.de>
parents: 934
diff changeset
  3002
    (nQuote == 2) ifTrue:[
22372
72db331204d4 #DOCUMENTATION by cg
Claus Gittinger <cg@exept.de>
parents: 22188
diff changeset
  3003
        qIndex := line indexOf:(Character doubleQuote).
72db331204d4 #DOCUMENTATION by cg
Claus Gittinger <cg@exept.de>
parents: 22188
diff changeset
  3004
        qIndex2 := line indexOf:(Character doubleQuote) startingAt:(qIndex + 1).
72db331204d4 #DOCUMENTATION by cg
Claus Gittinger <cg@exept.de>
parents: 22188
diff changeset
  3005
        ^ line copyFrom:(qIndex + 1) to:(qIndex2 - 1)
872
af04035b443d binary class storage support
Claus Gittinger <cg@exept.de>
parents: 829
diff changeset
  3006
    ].
952
d600e08a5936 handle the case where a method has a sourceFileInfo, but the class has not
Claus Gittinger <cg@exept.de>
parents: 934
diff changeset
  3007
    (nQuote == 1) ifTrue:[
22372
72db331204d4 #DOCUMENTATION by cg
Claus Gittinger <cg@exept.de>
parents: 22188
diff changeset
  3008
        qIndex := line indexOf:(Character doubleQuote).
72db331204d4 #DOCUMENTATION by cg
Claus Gittinger <cg@exept.de>
parents: 22188
diff changeset
  3009
        comment := line copyFrom:(qIndex + 1).
72db331204d4 #DOCUMENTATION by cg
Claus Gittinger <cg@exept.de>
parents: 22188
diff changeset
  3010
        (line indexOf:$/ startingAt:qIndex) == (qIndex+1) ifTrue:[
72db331204d4 #DOCUMENTATION by cg
Claus Gittinger <cg@exept.de>
parents: 22188
diff changeset
  3011
            "/ an EOL comment
72db331204d4 #DOCUMENTATION by cg
Claus Gittinger <cg@exept.de>
parents: 22188
diff changeset
  3012
            ^ (comment copyFrom:2) withoutSeparators
72db331204d4 #DOCUMENTATION by cg
Claus Gittinger <cg@exept.de>
parents: 22188
diff changeset
  3013
        ].
72db331204d4 #DOCUMENTATION by cg
Claus Gittinger <cg@exept.de>
parents: 22188
diff changeset
  3014
72db331204d4 #DOCUMENTATION by cg
Claus Gittinger <cg@exept.de>
parents: 22188
diff changeset
  3015
        "/ not an EOL comment
72db331204d4 #DOCUMENTATION by cg
Claus Gittinger <cg@exept.de>
parents: 22188
diff changeset
  3016
        index := 3.
72db331204d4 #DOCUMENTATION by cg
Claus Gittinger <cg@exept.de>
parents: 22188
diff changeset
  3017
        line := text at:index.
72db331204d4 #DOCUMENTATION by cg
Claus Gittinger <cg@exept.de>
parents: 22188
diff changeset
  3018
        nQuote := line occurrencesOf:(Character doubleQuote).
72db331204d4 #DOCUMENTATION by cg
Claus Gittinger <cg@exept.de>
parents: 22188
diff changeset
  3019
        [nQuote ~~ 1] whileTrue:[
72db331204d4 #DOCUMENTATION by cg
Claus Gittinger <cg@exept.de>
parents: 22188
diff changeset
  3020
            comment := comment , Character cr asString , line withoutSpaces.
72db331204d4 #DOCUMENTATION by cg
Claus Gittinger <cg@exept.de>
parents: 22188
diff changeset
  3021
            index := index + 1.
72db331204d4 #DOCUMENTATION by cg
Claus Gittinger <cg@exept.de>
parents: 22188
diff changeset
  3022
            line := text at:index.
72db331204d4 #DOCUMENTATION by cg
Claus Gittinger <cg@exept.de>
parents: 22188
diff changeset
  3023
            nQuote := line occurrencesOf:(Character doubleQuote)
72db331204d4 #DOCUMENTATION by cg
Claus Gittinger <cg@exept.de>
parents: 22188
diff changeset
  3024
        ].
72db331204d4 #DOCUMENTATION by cg
Claus Gittinger <cg@exept.de>
parents: 22188
diff changeset
  3025
        qIndex := line indexOf:(Character doubleQuote).
72db331204d4 #DOCUMENTATION by cg
Claus Gittinger <cg@exept.de>
parents: 22188
diff changeset
  3026
        ^ comment , Character cr asString , (line copyTo:(qIndex - 1)) withoutSpaces
952
d600e08a5936 handle the case where a method has a sourceFileInfo, but the class has not
Claus Gittinger <cg@exept.de>
parents: 934
diff changeset
  3027
    ].
d600e08a5936 handle the case where a method has a sourceFileInfo, but the class has not
Claus Gittinger <cg@exept.de>
parents: 934
diff changeset
  3028
    ^ nil
d600e08a5936 handle the case where a method has a sourceFileInfo, but the class has not
Claus Gittinger <cg@exept.de>
parents: 934
diff changeset
  3029
d600e08a5936 handle the case where a method has a sourceFileInfo, but the class has not
Claus Gittinger <cg@exept.de>
parents: 934
diff changeset
  3030
    "
d600e08a5936 handle the case where a method has a sourceFileInfo, but the class has not
Claus Gittinger <cg@exept.de>
parents: 934
diff changeset
  3031
     (Method compiledMethodAt:#methodComment) methodComment
d600e08a5936 handle the case where a method has a sourceFileInfo, but the class has not
Claus Gittinger <cg@exept.de>
parents: 934
diff changeset
  3032
    "
22372
72db331204d4 #DOCUMENTATION by cg
Claus Gittinger <cg@exept.de>
parents: 22188
diff changeset
  3033
72db331204d4 #DOCUMENTATION by cg
Claus Gittinger <cg@exept.de>
parents: 22188
diff changeset
  3034
    "Modified (comment): / 21-11-2017 / 13:04:50 / cg"
952
d600e08a5936 handle the case where a method has a sourceFileInfo, but the class has not
Claus Gittinger <cg@exept.de>
parents: 934
diff changeset
  3035
!
872
af04035b443d binary class storage support
Claus Gittinger <cg@exept.de>
parents: 829
diff changeset
  3036
9364
beef5f0aa8bb New: #methodDefinitionTemplate
Stefan Vogel <sv@exept.de>
parents: 9288
diff changeset
  3037
methodDefinitionTemplate
beef5f0aa8bb New: #methodDefinitionTemplate
Stefan Vogel <sv@exept.de>
parents: 9288
diff changeset
  3038
    "return the string that defines the method and the arguments"
beef5f0aa8bb New: #methodDefinitionTemplate
Stefan Vogel <sv@exept.de>
parents: 9288
diff changeset
  3039
16261
52a0604a7b95 class: Method
Stefan Vogel <sv@exept.de>
parents: 16221
diff changeset
  3040
    ^ self class
18620
b4e9f25d6ce6 preparations for lined index list in WeakArray
Claus Gittinger <cg@exept.de>
parents: 18462
diff changeset
  3041
	methodDefinitionTemplateForSelector:self selector
b4e9f25d6ce6 preparations for lined index list in WeakArray
Claus Gittinger <cg@exept.de>
parents: 18462
diff changeset
  3042
	andArgumentNames:self methodArgNames
9364
beef5f0aa8bb New: #methodDefinitionTemplate
Stefan Vogel <sv@exept.de>
parents: 9288
diff changeset
  3043
beef5f0aa8bb New: #methodDefinitionTemplate
Stefan Vogel <sv@exept.de>
parents: 9288
diff changeset
  3044
    "
beef5f0aa8bb New: #methodDefinitionTemplate
Stefan Vogel <sv@exept.de>
parents: 9288
diff changeset
  3045
      (self compiledMethodAt:#printOn:) methodDefinitionTemplate
beef5f0aa8bb New: #methodDefinitionTemplate
Stefan Vogel <sv@exept.de>
parents: 9288
diff changeset
  3046
    "
beef5f0aa8bb New: #methodDefinitionTemplate
Stefan Vogel <sv@exept.de>
parents: 9288
diff changeset
  3047
!
beef5f0aa8bb New: #methodDefinitionTemplate
Stefan Vogel <sv@exept.de>
parents: 9288
diff changeset
  3048
12900
4cda19285039 category of: #methodInvocationInfo
Claus Gittinger <cg@exept.de>
parents: 12899
diff changeset
  3049
methodInvocationInfo
13567
fe6564553977 comment: #methodInvocationInfo
Claus Gittinger <cg@exept.de>
parents: 13463
diff changeset
  3050
    "redefined by InstrumentedMethod, to return the collected info"
fe6564553977 comment: #methodInvocationInfo
Claus Gittinger <cg@exept.de>
parents: 13463
diff changeset
  3051
12900
4cda19285039 category of: #methodInvocationInfo
Claus Gittinger <cg@exept.de>
parents: 12899
diff changeset
  3052
    ^ nil
4cda19285039 category of: #methodInvocationInfo
Claus Gittinger <cg@exept.de>
parents: 12899
diff changeset
  3053
4cda19285039 category of: #methodInvocationInfo
Claus Gittinger <cg@exept.de>
parents: 12899
diff changeset
  3054
    "Created: / 27-04-2010 / 13:36:12 / cg"
4cda19285039 category of: #methodInvocationInfo
Claus Gittinger <cg@exept.de>
parents: 12899
diff changeset
  3055
!
4cda19285039 category of: #methodInvocationInfo
Claus Gittinger <cg@exept.de>
parents: 12899
diff changeset
  3056
952
d600e08a5936 handle the case where a method has a sourceFileInfo, but the class has not
Claus Gittinger <cg@exept.de>
parents: 934
diff changeset
  3057
methodVarNames
22372
72db331204d4 #DOCUMENTATION by cg
Claus Gittinger <cg@exept.de>
parents: 22188
diff changeset
  3058
    "return a collection with the method's local-variable names.
72db331204d4 #DOCUMENTATION by cg
Claus Gittinger <cg@exept.de>
parents: 22188
diff changeset
  3059
     Uses Parser to parse the method's source and extract the names."
952
d600e08a5936 handle the case where a method has a sourceFileInfo, but the class has not
Claus Gittinger <cg@exept.de>
parents: 934
diff changeset
  3060
d600e08a5936 handle the case where a method has a sourceFileInfo, but the class has not
Claus Gittinger <cg@exept.de>
parents: 934
diff changeset
  3061
    ^ self parse:#'parseMethodArgAndVarSpecificationSilent:' return:#methodVars or:nil
d600e08a5936 handle the case where a method has a sourceFileInfo, but the class has not
Claus Gittinger <cg@exept.de>
parents: 934
diff changeset
  3062
d600e08a5936 handle the case where a method has a sourceFileInfo, but the class has not
Claus Gittinger <cg@exept.de>
parents: 934
diff changeset
  3063
    "
d600e08a5936 handle the case where a method has a sourceFileInfo, but the class has not
Claus Gittinger <cg@exept.de>
parents: 934
diff changeset
  3064
     (Method compiledMethodAt:#printOn:) methodVarNames
d600e08a5936 handle the case where a method has a sourceFileInfo, but the class has not
Claus Gittinger <cg@exept.de>
parents: 934
diff changeset
  3065
    "
d600e08a5936 handle the case where a method has a sourceFileInfo, but the class has not
Claus Gittinger <cg@exept.de>
parents: 934
diff changeset
  3066
22372
72db331204d4 #DOCUMENTATION by cg
Claus Gittinger <cg@exept.de>
parents: 22188
diff changeset
  3067
    "Modified: / 31-10-1995 / 14:36:49 / cg"
72db331204d4 #DOCUMENTATION by cg
Claus Gittinger <cg@exept.de>
parents: 22188
diff changeset
  3068
    "Modified (comment): / 21-11-2017 / 13:04:59 / cg"
952
d600e08a5936 handle the case where a method has a sourceFileInfo, but the class has not
Claus Gittinger <cg@exept.de>
parents: 934
diff changeset
  3069
!
d600e08a5936 handle the case where a method has a sourceFileInfo, but the class has not
Claus Gittinger <cg@exept.de>
parents: 934
diff changeset
  3070
d600e08a5936 handle the case where a method has a sourceFileInfo, but the class has not
Claus Gittinger <cg@exept.de>
parents: 934
diff changeset
  3071
modificationTime
d600e08a5936 handle the case where a method has a sourceFileInfo, but the class has not
Claus Gittinger <cg@exept.de>
parents: 934
diff changeset
  3072
    "try to extract the modificationTime as a timeStamp from
19449
607eb2e0e46c #DOCUMENTATION
Claus Gittinger <cg@exept.de>
parents: 19025
diff changeset
  3073
     the receiver's source. If there is no source or no history line,
952
d600e08a5936 handle the case where a method has a sourceFileInfo, but the class has not
Claus Gittinger <cg@exept.de>
parents: 934
diff changeset
  3074
     we do not know the modification time, and nil is returned."
d600e08a5936 handle the case where a method has a sourceFileInfo, but the class has not
Claus Gittinger <cg@exept.de>
parents: 934
diff changeset
  3075
d600e08a5936 handle the case where a method has a sourceFileInfo, but the class has not
Claus Gittinger <cg@exept.de>
parents: 934
diff changeset
  3076
    |s list histLine|
877
63ebb325ed20 flush global-access cache (using snapshotID) when saving a methods binary code
Claus Gittinger <cg@exept.de>
parents: 872
diff changeset
  3077
952
d600e08a5936 handle the case where a method has a sourceFileInfo, but the class has not
Claus Gittinger <cg@exept.de>
parents: 934
diff changeset
  3078
    HistoryManager isNil ifTrue:[^ nil].
1873
3544a4a94a2a checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1870
diff changeset
  3079
952
d600e08a5936 handle the case where a method has a sourceFileInfo, but the class has not
Claus Gittinger <cg@exept.de>
parents: 934
diff changeset
  3080
    s := self source.
d600e08a5936 handle the case where a method has a sourceFileInfo, but the class has not
Claus Gittinger <cg@exept.de>
parents: 934
diff changeset
  3081
    s isNil ifTrue:[^ nil].
d600e08a5936 handle the case where a method has a sourceFileInfo, but the class has not
Claus Gittinger <cg@exept.de>
parents: 934
diff changeset
  3082
    list := HistoryManager getAllHistoriesFrom:s.
16261
52a0604a7b95 class: Method
Stefan Vogel <sv@exept.de>
parents: 16221
diff changeset
  3083
    list isEmptyOrNil ifTrue:[^ nil].
952
d600e08a5936 handle the case where a method has a sourceFileInfo, but the class has not
Claus Gittinger <cg@exept.de>
parents: 934
diff changeset
  3084
    histLine := list last.
12854
3a3d3c02c3bd *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 12695
diff changeset
  3085
    ^ Timestamp
19449
607eb2e0e46c #DOCUMENTATION
Claus Gittinger <cg@exept.de>
parents: 19025
diff changeset
  3086
        fromDate:histLine date
607eb2e0e46c #DOCUMENTATION
Claus Gittinger <cg@exept.de>
parents: 19025
diff changeset
  3087
        andTime:histLine time
952
d600e08a5936 handle the case where a method has a sourceFileInfo, but the class has not
Claus Gittinger <cg@exept.de>
parents: 934
diff changeset
  3088
d600e08a5936 handle the case where a method has a sourceFileInfo, but the class has not
Claus Gittinger <cg@exept.de>
parents: 934
diff changeset
  3089
    "
d600e08a5936 handle the case where a method has a sourceFileInfo, but the class has not
Claus Gittinger <cg@exept.de>
parents: 934
diff changeset
  3090
     (Method compiledMethodAt:#modificationTime) modificationTime
12854
3a3d3c02c3bd *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 12695
diff changeset
  3091
     (Method compiledMethodAt:#isMethod) modificationTime
952
d600e08a5936 handle the case where a method has a sourceFileInfo, but the class has not
Claus Gittinger <cg@exept.de>
parents: 934
diff changeset
  3092
    "
d600e08a5936 handle the case where a method has a sourceFileInfo, but the class has not
Claus Gittinger <cg@exept.de>
parents: 934
diff changeset
  3093
d600e08a5936 handle the case where a method has a sourceFileInfo, but the class has not
Claus Gittinger <cg@exept.de>
parents: 934
diff changeset
  3094
    "Modified: 8.9.1995 / 15:08:22 / claus"
1873
3544a4a94a2a checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1870
diff changeset
  3095
    "Modified: 4.11.1996 / 22:28:17 / cg"
952
d600e08a5936 handle the case where a method has a sourceFileInfo, but the class has not
Claus Gittinger <cg@exept.de>
parents: 934
diff changeset
  3096
!
d600e08a5936 handle the case where a method has a sourceFileInfo, but the class has not
Claus Gittinger <cg@exept.de>
parents: 934
diff changeset
  3097
15424
143d8fdfa609 class: Method
Claus Gittinger <cg@exept.de>
parents: 15416
diff changeset
  3098
modifiedInstVars
143d8fdfa609 class: Method
Claus Gittinger <cg@exept.de>
parents: 15416
diff changeset
  3099
    "returns a collection of instance variables which are modified by this method.
143d8fdfa609 class: Method
Claus Gittinger <cg@exept.de>
parents: 15416
diff changeset
  3100
     Uses parser (for now); could look at bytecode as well here..."
143d8fdfa609 class: Method
Claus Gittinger <cg@exept.de>
parents: 15416
diff changeset
  3101
143d8fdfa609 class: Method
Claus Gittinger <cg@exept.de>
parents: 15416
diff changeset
  3102
    ^ self parse:#'parseMethodSilent:in:' with:self mclass  return:#modifiedInstVars or:#().
143d8fdfa609 class: Method
Claus Gittinger <cg@exept.de>
parents: 15416
diff changeset
  3103
!
143d8fdfa609 class: Method
Claus Gittinger <cg@exept.de>
parents: 15416
diff changeset
  3104
3845
729fda604d59 added #name (for javaMethod compatibility)
Claus Gittinger <cg@exept.de>
parents: 3697
diff changeset
  3105
name
729fda604d59 added #name (for javaMethod compatibility)
Claus Gittinger <cg@exept.de>
parents: 3697
diff changeset
  3106
    "for compatibility with javaMethods"
729fda604d59 added #name (for javaMethod compatibility)
Claus Gittinger <cg@exept.de>
parents: 3697
diff changeset
  3107
729fda604d59 added #name (for javaMethod compatibility)
Claus Gittinger <cg@exept.de>
parents: 3697
diff changeset
  3108
    ^ self selector
729fda604d59 added #name (for javaMethod compatibility)
Claus Gittinger <cg@exept.de>
parents: 3697
diff changeset
  3109
729fda604d59 added #name (for javaMethod compatibility)
Claus Gittinger <cg@exept.de>
parents: 3697
diff changeset
  3110
    "Created: / 9.11.1998 / 06:15:08 / cg"
729fda604d59 added #name (for javaMethod compatibility)
Claus Gittinger <cg@exept.de>
parents: 3697
diff changeset
  3111
!
729fda604d59 added #name (for javaMethod compatibility)
Claus Gittinger <cg@exept.de>
parents: 3697
diff changeset
  3112
20208
79b24601b7d6 #OTHER by mawalch
mawalch
parents: 20035
diff changeset
  3113
overwrites:aMethod
20035
74774e1ee05d #REFACTORING by stefan
Stefan Vogel <sv@exept.de>
parents: 20032
diff changeset
  3114
    |mth|
74774e1ee05d #REFACTORING by stefan
Stefan Vogel <sv@exept.de>
parents: 20032
diff changeset
  3115
74774e1ee05d #REFACTORING by stefan
Stefan Vogel <sv@exept.de>
parents: 20032
diff changeset
  3116
    mth := self.
74774e1ee05d #REFACTORING by stefan
Stefan Vogel <sv@exept.de>
parents: 20032
diff changeset
  3117
    [ mth := mth overwrittenMethod. mth notNil ] whileTrue:[
74774e1ee05d #REFACTORING by stefan
Stefan Vogel <sv@exept.de>
parents: 20032
diff changeset
  3118
        mth == aMethod ifTrue:[
74774e1ee05d #REFACTORING by stefan
Stefan Vogel <sv@exept.de>
parents: 20032
diff changeset
  3119
            ^ true
74774e1ee05d #REFACTORING by stefan
Stefan Vogel <sv@exept.de>
parents: 20032
diff changeset
  3120
        ].
74774e1ee05d #REFACTORING by stefan
Stefan Vogel <sv@exept.de>
parents: 20032
diff changeset
  3121
    ].
74774e1ee05d #REFACTORING by stefan
Stefan Vogel <sv@exept.de>
parents: 20032
diff changeset
  3122
    ^ false
13422
b43a8a47037c Jan's changes
vrany
parents: 13390
diff changeset
  3123
15952
e55b89f8d241 class: Method
Claus Gittinger <cg@exept.de>
parents: 15787
diff changeset
  3124
    "Created: / 05-07-2012 / 10:52:04 / Jan Vrany <jan.vrany@fit.cvut.cz>"
13422
b43a8a47037c Jan's changes
vrany
parents: 13390
diff changeset
  3125
!
b43a8a47037c Jan's changes
vrany
parents: 13390
diff changeset
  3126
12854
3a3d3c02c3bd *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 12695
diff changeset
  3127
parse:parseSelector return:accessSelector or:valueIfNoSource
952
d600e08a5936 handle the case where a method has a sourceFileInfo, but the class has not
Claus Gittinger <cg@exept.de>
parents: 934
diff changeset
  3128
    "helper for methodArgNames, methodVarNames etc.
d600e08a5936 handle the case where a method has a sourceFileInfo, but the class has not
Claus Gittinger <cg@exept.de>
parents: 934
diff changeset
  3129
     Get the source, let parser parse it using parseSelector,
1873
3544a4a94a2a checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1870
diff changeset
  3130
     return parser-info using accessSelector"
952
d600e08a5936 handle the case where a method has a sourceFileInfo, but the class has not
Claus Gittinger <cg@exept.de>
parents: 934
diff changeset
  3131
5633
15b028ad5e03 #usedGlobals check was wrong sometimes
Claus Gittinger <cg@exept.de>
parents: 5584
diff changeset
  3132
    ^ self parse:parseSelector with:nil return:accessSelector or:valueIfNoSource
15b028ad5e03 #usedGlobals check was wrong sometimes
Claus Gittinger <cg@exept.de>
parents: 5584
diff changeset
  3133
15b028ad5e03 #usedGlobals check was wrong sometimes
Claus Gittinger <cg@exept.de>
parents: 5584
diff changeset
  3134
    "
15b028ad5e03 #usedGlobals check was wrong sometimes
Claus Gittinger <cg@exept.de>
parents: 5584
diff changeset
  3135
     (Method compiledMethodAt:#parse:return:or:)
18620
b4e9f25d6ce6 preparations for lined index list in WeakArray
Claus Gittinger <cg@exept.de>
parents: 18462
diff changeset
  3136
	parse:#'parseMethodSilent:' return:#sentMessages or:#()
5633
15b028ad5e03 #usedGlobals check was wrong sometimes
Claus Gittinger <cg@exept.de>
parents: 5584
diff changeset
  3137
    "
15b028ad5e03 #usedGlobals check was wrong sometimes
Claus Gittinger <cg@exept.de>
parents: 5584
diff changeset
  3138
!
15b028ad5e03 #usedGlobals check was wrong sometimes
Claus Gittinger <cg@exept.de>
parents: 5584
diff changeset
  3139
12854
3a3d3c02c3bd *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 12695
diff changeset
  3140
parse:parseSelector with:arg2 return:accessSelector or:valueIfNoSource
5633
15b028ad5e03 #usedGlobals check was wrong sometimes
Claus Gittinger <cg@exept.de>
parents: 5584
diff changeset
  3141
    "helper for methodArgNames, methodVarNames etc.
15b028ad5e03 #usedGlobals check was wrong sometimes
Claus Gittinger <cg@exept.de>
parents: 5584
diff changeset
  3142
     Get the source, let parser parse it using parseSelector,
15b028ad5e03 #usedGlobals check was wrong sometimes
Claus Gittinger <cg@exept.de>
parents: 5584
diff changeset
  3143
     return parser-info using accessSelector"
15b028ad5e03 #usedGlobals check was wrong sometimes
Claus Gittinger <cg@exept.de>
parents: 5584
diff changeset
  3144
13570
382db10e848d changed: #parse:with:return:or:
Claus Gittinger <cg@exept.de>
parents: 13569
diff changeset
  3145
    |parser parserClass sourceString cachedInfo|
8427
bba41f189196 parserClass stuff
ca
parents: 8419
diff changeset
  3146
bba41f189196 parserClass stuff
ca
parents: 8419
diff changeset
  3147
    parserClass := self parserClass.
13570
382db10e848d changed: #parse:with:return:or:
Claus Gittinger <cg@exept.de>
parents: 13569
diff changeset
  3148
14039
30251b45156a added: #flushParseTreeCache
Claus Gittinger <cg@exept.de>
parents: 13847
diff changeset
  3149
    "/ because parsing the same method multiple times for different aspects
13570
382db10e848d changed: #parse:with:return:or:
Claus Gittinger <cg@exept.de>
parents: 13569
diff changeset
  3150
    "/ is very common with the new browser's info displays, we cache a few
14047
016eab1c3b9a comment/format in: #parse:with:return:or:
Claus Gittinger <cg@exept.de>
parents: 14039
diff changeset
  3151
    "/ of them. If the same is parsed soon after, we do not have to parse again.
21581
20d4f3a38e2c #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 21450
diff changeset
  3152
    parseSelector == #'parseMethodSilent:in:' ifTrue:[
20d4f3a38e2c #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 21450
diff changeset
  3153
        LastParseTreeCache notNil ifTrue:[
20d4f3a38e2c #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 21450
diff changeset
  3154
            "/ to flush: LastParseTreeCache removeAll.
20d4f3a38e2c #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 21450
diff changeset
  3155
            cachedInfo := LastParseTreeCache at:self ifAbsent:nil.
20d4f3a38e2c #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 21450
diff changeset
  3156
            cachedInfo notNil ifTrue:[
20d4f3a38e2c #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 21450
diff changeset
  3157
                cachedInfo method == self ifTrue:[
20d4f3a38e2c #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 21450
diff changeset
  3158
                    cachedInfo parser class == parserClass ifTrue:[
20d4f3a38e2c #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 21450
diff changeset
  3159
                        "/ Transcript show:'hit '; showCR:self.
20d4f3a38e2c #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 21450
diff changeset
  3160
                        ^ cachedInfo parser perform:accessSelector
20d4f3a38e2c #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 21450
diff changeset
  3161
                    ]
20d4f3a38e2c #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 21450
diff changeset
  3162
                ].
20d4f3a38e2c #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 21450
diff changeset
  3163
                LastParseTreeCache removeKey:self
20d4f3a38e2c #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 21450
diff changeset
  3164
            ]
20d4f3a38e2c #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 21450
diff changeset
  3165
        ].
13570
382db10e848d changed: #parse:with:return:or:
Claus Gittinger <cg@exept.de>
parents: 13569
diff changeset
  3166
    ].
21581
20d4f3a38e2c #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 21450
diff changeset
  3167
    
952
d600e08a5936 handle the case where a method has a sourceFileInfo, but the class has not
Claus Gittinger <cg@exept.de>
parents: 934
diff changeset
  3168
    sourceString := self source.
8427
bba41f189196 parserClass stuff
ca
parents: 8419
diff changeset
  3169
    (parserClass notNil and:[sourceString notNil]) ifTrue:[
19716
34387335cbba #REFACTORING by cg
Claus Gittinger <cg@exept.de>
parents: 19699
diff changeset
  3170
        parseSelector argumentCount == 2 ifTrue:[
34387335cbba #REFACTORING by cg
Claus Gittinger <cg@exept.de>
parents: 19699
diff changeset
  3171
            parser := parserClass perform:parseSelector with:sourceString with:arg2.
34387335cbba #REFACTORING by cg
Claus Gittinger <cg@exept.de>
parents: 19699
diff changeset
  3172
        ] ifFalse:[
34387335cbba #REFACTORING by cg
Claus Gittinger <cg@exept.de>
parents: 19699
diff changeset
  3173
            parser := parserClass perform:parseSelector with:sourceString.
34387335cbba #REFACTORING by cg
Claus Gittinger <cg@exept.de>
parents: 19699
diff changeset
  3174
        ].
34387335cbba #REFACTORING by cg
Claus Gittinger <cg@exept.de>
parents: 19699
diff changeset
  3175
        (parser isNil or:[parser == #Error]) ifTrue:[^ valueIfNoSource].
21581
20d4f3a38e2c #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 21450
diff changeset
  3176
20d4f3a38e2c #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 21450
diff changeset
  3177
        parseSelector == #'parseMethodSilent:in:' ifTrue:[
20d4f3a38e2c #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 21450
diff changeset
  3178
            "do not cache the parser, if it was parsing for code - a lot of information is missing then"
20d4f3a38e2c #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 21450
diff changeset
  3179
            (self mclass notNil and:[parser wasParsedForCode not]) ifTrue:[
20d4f3a38e2c #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 21450
diff changeset
  3180
                LastParseTreeCache isNil ifTrue:[
20d4f3a38e2c #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 21450
diff changeset
  3181
                    LastParseTreeCache := CacheDictionary new:500.
20d4f3a38e2c #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 21450
diff changeset
  3182
                ].
23254
c3d49a7cb48d #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 22973
diff changeset
  3183
                LastParseTreeCache 
c3d49a7cb48d #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 22973
diff changeset
  3184
                    at:self 
c3d49a7cb48d #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 22973
diff changeset
  3185
                    put:(ParserCacheEntry new method:self parser:parser).
19716
34387335cbba #REFACTORING by cg
Claus Gittinger <cg@exept.de>
parents: 19699
diff changeset
  3186
            ].
34387335cbba #REFACTORING by cg
Claus Gittinger <cg@exept.de>
parents: 19699
diff changeset
  3187
        ].
22669
308cc7b248e5 #BUGFIX by stefan
Stefan Vogel <sv@exept.de>
parents: 22527
diff changeset
  3188
        ^ parser perform:accessSelector
952
d600e08a5936 handle the case where a method has a sourceFileInfo, but the class has not
Claus Gittinger <cg@exept.de>
parents: 934
diff changeset
  3189
    ].
1873
3544a4a94a2a checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1870
diff changeset
  3190
    ^ valueIfNoSource
3544a4a94a2a checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1870
diff changeset
  3191
5500
8bc3b30296ae more queries (sentMessages ...)
Claus Gittinger <cg@exept.de>
parents: 5406
diff changeset
  3192
    "
15579
cc4c6bae6927 class: Method
Claus Gittinger <cg@exept.de>
parents: 15445
diff changeset
  3193
     LastParseTreeCache removeAll.
cc4c6bae6927 class: Method
Claus Gittinger <cg@exept.de>
parents: 15445
diff changeset
  3194
5500
8bc3b30296ae more queries (sentMessages ...)
Claus Gittinger <cg@exept.de>
parents: 5406
diff changeset
  3195
     (Method compiledMethodAt:#parse:return:or:)
19716
34387335cbba #REFACTORING by cg
Claus Gittinger <cg@exept.de>
parents: 19699
diff changeset
  3196
        parse:#'parseMethodSilent:' return:#sentMessages or:#()
5500
8bc3b30296ae more queries (sentMessages ...)
Claus Gittinger <cg@exept.de>
parents: 5406
diff changeset
  3197
    "
13570
382db10e848d changed: #parse:with:return:or:
Claus Gittinger <cg@exept.de>
parents: 13569
diff changeset
  3198
21581
20d4f3a38e2c #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 21450
diff changeset
  3199
    "Modified: / 26-02-2017 / 12:05:50 / cg"
22669
308cc7b248e5 #BUGFIX by stefan
Stefan Vogel <sv@exept.de>
parents: 22527
diff changeset
  3200
    "Modified: / 12-04-2018 / 08:51:07 / stefan"
23254
c3d49a7cb48d #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 22973
diff changeset
  3201
    "Modified (format): / 01-08-2018 / 22:24:59 / Claus Gittinger"
952
d600e08a5936 handle the case where a method has a sourceFileInfo, but the class has not
Claus Gittinger <cg@exept.de>
parents: 934
diff changeset
  3202
!
159
514c749165c3 *** empty log message ***
claus
parents: 142
diff changeset
  3203
13422
b43a8a47037c Jan's changes
vrany
parents: 13390
diff changeset
  3204
parseAnnotations
17361
ab3b25502ca4 class: Method
Claus Gittinger <cg@exept.de>
parents: 17278
diff changeset
  3205
    "return the method's annotations."
13422
b43a8a47037c Jan's changes
vrany
parents: 13390
diff changeset
  3206
b43a8a47037c Jan's changes
vrany
parents: 13390
diff changeset
  3207
    |src parser|
b43a8a47037c Jan's changes
vrany
parents: 13390
diff changeset
  3208
b43a8a47037c Jan's changes
vrany
parents: 13390
diff changeset
  3209
    src := self source.
b43a8a47037c Jan's changes
vrany
parents: 13390
diff changeset
  3210
    src isNil ifTrue:[
20804
8fc0aa10c3a8 #DOCUMENTATION by cg
Claus Gittinger <cg@exept.de>
parents: 20683
diff changeset
  3211
        ^ nil "/ actually: don't know
13422
b43a8a47037c Jan's changes
vrany
parents: 13390
diff changeset
  3212
    ].
b43a8a47037c Jan's changes
vrany
parents: 13390
diff changeset
  3213
b43a8a47037c Jan's changes
vrany
parents: 13390
diff changeset
  3214
    self parserClass isNil ifTrue:[
20804
8fc0aa10c3a8 #DOCUMENTATION by cg
Claus Gittinger <cg@exept.de>
parents: 20683
diff changeset
  3215
        ^ nil
13422
b43a8a47037c Jan's changes
vrany
parents: 13390
diff changeset
  3216
    ].
b43a8a47037c Jan's changes
vrany
parents: 13390
diff changeset
  3217
    parser := self parserClass parseMethod: src.
b43a8a47037c Jan's changes
vrany
parents: 13390
diff changeset
  3218
    (parser isNil or: [parser == #Error]) ifTrue:[
20804
8fc0aa10c3a8 #DOCUMENTATION by cg
Claus Gittinger <cg@exept.de>
parents: 20683
diff changeset
  3219
        ^ nil "/ actually error
13422
b43a8a47037c Jan's changes
vrany
parents: 13390
diff changeset
  3220
    ].
b43a8a47037c Jan's changes
vrany
parents: 13390
diff changeset
  3221
    ^ annotations := parser annotations.
b43a8a47037c Jan's changes
vrany
parents: 13390
diff changeset
  3222
b43a8a47037c Jan's changes
vrany
parents: 13390
diff changeset
  3223
    "Created: / 10-07-2010 / 21:16:46 / Jan Vrany <jan.vrany@fit.cvut.cz>"
b43a8a47037c Jan's changes
vrany
parents: 13390
diff changeset
  3224
!
b43a8a47037c Jan's changes
vrany
parents: 13390
diff changeset
  3225
5721
5f97733ff519 methods now send change-notifications when the category changes
Claus Gittinger <cg@exept.de>
parents: 5704
diff changeset
  3226
parseResources
16218
5e87a242990b class: Method
Claus Gittinger <cg@exept.de>
parents: 16193
diff changeset
  3227
    "return the method's resource spec; either nil or a collection of symbols.
5e87a242990b class: Method
Claus Gittinger <cg@exept.de>
parents: 16193
diff changeset
  3228
     Resources are a special kind of annotation, of the form:
20804
8fc0aa10c3a8 #DOCUMENTATION by cg
Claus Gittinger <cg@exept.de>
parents: 20683
diff changeset
  3229
        <resource: #symbol...>
16218
5e87a242990b class: Method
Claus Gittinger <cg@exept.de>
parents: 16193
diff changeset
  3230
     and flags methods which depend on keyboard bindings or provide menus, specs or bitmap images"
5721
5f97733ff519 methods now send change-notifications when the category changes
Claus Gittinger <cg@exept.de>
parents: 5704
diff changeset
  3231
5f97733ff519 methods now send change-notifications when the category changes
Claus Gittinger <cg@exept.de>
parents: 5704
diff changeset
  3232
    |src parser|
5f97733ff519 methods now send change-notifications when the category changes
Claus Gittinger <cg@exept.de>
parents: 5704
diff changeset
  3233
5f97733ff519 methods now send change-notifications when the category changes
Claus Gittinger <cg@exept.de>
parents: 5704
diff changeset
  3234
    src := self source.
5f97733ff519 methods now send change-notifications when the category changes
Claus Gittinger <cg@exept.de>
parents: 5704
diff changeset
  3235
    src isNil ifTrue:[
20804
8fc0aa10c3a8 #DOCUMENTATION by cg
Claus Gittinger <cg@exept.de>
parents: 20683
diff changeset
  3236
        ^ nil "/ actually: don't know
5721
5f97733ff519 methods now send change-notifications when the category changes
Claus Gittinger <cg@exept.de>
parents: 5704
diff changeset
  3237
    ].
5f97733ff519 methods now send change-notifications when the category changes
Claus Gittinger <cg@exept.de>
parents: 5704
diff changeset
  3238
22669
308cc7b248e5 #BUGFIX by stefan
Stefan Vogel <sv@exept.de>
parents: 22527
diff changeset
  3239
    (src includesString:'resource:') ifFalse:[
20804
8fc0aa10c3a8 #DOCUMENTATION by cg
Claus Gittinger <cg@exept.de>
parents: 20683
diff changeset
  3240
        ^ nil "/ actually: error
5721
5f97733ff519 methods now send change-notifications when the category changes
Claus Gittinger <cg@exept.de>
parents: 5704
diff changeset
  3241
    ].
5f97733ff519 methods now send change-notifications when the category changes
Claus Gittinger <cg@exept.de>
parents: 5704
diff changeset
  3242
    "/ no need to parse all - only interested in resource-info
8427
bba41f189196 parserClass stuff
ca
parents: 8419
diff changeset
  3243
    self parserClass isNil ifTrue:[
20804
8fc0aa10c3a8 #DOCUMENTATION by cg
Claus Gittinger <cg@exept.de>
parents: 20683
diff changeset
  3244
        ^ nil
8427
bba41f189196 parserClass stuff
ca
parents: 8419
diff changeset
  3245
    ].
8419
42a6fd0ef3bd allow for subclasses to redefine the parserClass
ca
parents: 8364
diff changeset
  3246
    parser := self parserClass parseMethodArgAndVarSpecificationSilent:src in:nil.
5721
5f97733ff519 methods now send change-notifications when the category changes
Claus Gittinger <cg@exept.de>
parents: 5704
diff changeset
  3247
    parser isNil ifTrue:[
20804
8fc0aa10c3a8 #DOCUMENTATION by cg
Claus Gittinger <cg@exept.de>
parents: 20683
diff changeset
  3248
        ^ nil "/ actually error
5721
5f97733ff519 methods now send change-notifications when the category changes
Claus Gittinger <cg@exept.de>
parents: 5704
diff changeset
  3249
    ].
5f97733ff519 methods now send change-notifications when the category changes
Claus Gittinger <cg@exept.de>
parents: 5704
diff changeset
  3250
    ^ parser primitiveResources.
22669
308cc7b248e5 #BUGFIX by stefan
Stefan Vogel <sv@exept.de>
parents: 22527
diff changeset
  3251
308cc7b248e5 #BUGFIX by stefan
Stefan Vogel <sv@exept.de>
parents: 22527
diff changeset
  3252
    "Modified: / 12-04-2018 / 09:32:53 / stefan"
5721
5f97733ff519 methods now send change-notifications when the category changes
Claus Gittinger <cg@exept.de>
parents: 5704
diff changeset
  3253
!
5f97733ff519 methods now send change-notifications when the category changes
Claus Gittinger <cg@exept.de>
parents: 5704
diff changeset
  3254
14402
Claus Gittinger <cg@exept.de>
parents: 14375
diff changeset
  3255
possiblySends:aSelectorSymbol
Claus Gittinger <cg@exept.de>
parents: 14375
diff changeset
  3256
    "return true, if this method contains an indirect message-send
Claus Gittinger <cg@exept.de>
parents: 14375
diff changeset
  3257
     (such as perform) with aSelectorSymbol as selector."
Claus Gittinger <cg@exept.de>
parents: 14375
diff changeset
  3258
Claus Gittinger <cg@exept.de>
parents: 14375
diff changeset
  3259
    (self referencesLiteral:aSelectorSymbol) ifTrue:[
18620
b4e9f25d6ce6 preparations for lined index list in WeakArray
Claus Gittinger <cg@exept.de>
parents: 18462
diff changeset
  3260
	^ self messagesPossiblySent includesIdentical:aSelectorSymbol
14402
Claus Gittinger <cg@exept.de>
parents: 14375
diff changeset
  3261
    ].
Claus Gittinger <cg@exept.de>
parents: 14375
diff changeset
  3262
    ^ false
Claus Gittinger <cg@exept.de>
parents: 14375
diff changeset
  3263
!
Claus Gittinger <cg@exept.de>
parents: 14375
diff changeset
  3264
1923
97b099fef985 optionally keep a history of changed methods
Claus Gittinger <cg@exept.de>
parents: 1873
diff changeset
  3265
previousVersion
19449
607eb2e0e46c #DOCUMENTATION
Claus Gittinger <cg@exept.de>
parents: 19025
diff changeset
  3266
    "return the receiver's previous version's source code"
14251
c0d549a59039 added: #previousVersions:
Claus Gittinger <cg@exept.de>
parents: 14237
diff changeset
  3267
c0d549a59039 added: #previousVersions:
Claus Gittinger <cg@exept.de>
parents: 14237
diff changeset
  3268
    |previous|
c0d549a59039 added: #previousVersions:
Claus Gittinger <cg@exept.de>
parents: 14237
diff changeset
  3269
c0d549a59039 added: #previousVersions:
Claus Gittinger <cg@exept.de>
parents: 14237
diff changeset
  3270
    previous := self previousVersions:2.
c0d549a59039 added: #previousVersions:
Claus Gittinger <cg@exept.de>
parents: 14237
diff changeset
  3271
    previous isEmptyOrNil ifTrue:[^ nil].
c0d549a59039 added: #previousVersions:
Claus Gittinger <cg@exept.de>
parents: 14237
diff changeset
  3272
    ^ previous first.
c0d549a59039 added: #previousVersions:
Claus Gittinger <cg@exept.de>
parents: 14237
diff changeset
  3273
c0d549a59039 added: #previousVersions:
Claus Gittinger <cg@exept.de>
parents: 14237
diff changeset
  3274
"/    |sel cls previous|
c0d549a59039 added: #previousVersions:
Claus Gittinger <cg@exept.de>
parents: 14237
diff changeset
  3275
"/
c0d549a59039 added: #previousVersions:
Claus Gittinger <cg@exept.de>
parents: 14237
diff changeset
  3276
"/    sel := self selector.
c0d549a59039 added: #previousVersions:
Claus Gittinger <cg@exept.de>
parents: 14237
diff changeset
  3277
"/    sel isNil ifTrue:[ ^ nil ].
c0d549a59039 added: #previousVersions:
Claus Gittinger <cg@exept.de>
parents: 14237
diff changeset
  3278
"/
c0d549a59039 added: #previousVersions:
Claus Gittinger <cg@exept.de>
parents: 14237
diff changeset
  3279
"/    cls := self mclass.
c0d549a59039 added: #previousVersions:
Claus Gittinger <cg@exept.de>
parents: 14237
diff changeset
  3280
"/    cls isNil ifTrue:[ ^ nil ].
c0d549a59039 added: #previousVersions:
Claus Gittinger <cg@exept.de>
parents: 14237
diff changeset
  3281
"/
c0d549a59039 added: #previousVersions:
Claus Gittinger <cg@exept.de>
parents: 14237
diff changeset
  3282
"/    ChangeSet current reverseDo:[:change |
c0d549a59039 added: #previousVersions:
Claus Gittinger <cg@exept.de>
parents: 14237
diff changeset
  3283
"/        (change isMethodChange
c0d549a59039 added: #previousVersions:
Claus Gittinger <cg@exept.de>
parents: 14237
diff changeset
  3284
"/            and:[ (change selector == sel)
c0d549a59039 added: #previousVersions:
Claus Gittinger <cg@exept.de>
parents: 14237
diff changeset
  3285
"/            and:[ change changeClass == cls ]])
c0d549a59039 added: #previousVersions:
Claus Gittinger <cg@exept.de>
parents: 14237
diff changeset
  3286
"/        ifTrue:[
c0d549a59039 added: #previousVersions:
Claus Gittinger <cg@exept.de>
parents: 14237
diff changeset
  3287
"/            previous := change previousVersion.
c0d549a59039 added: #previousVersions:
Claus Gittinger <cg@exept.de>
parents: 14237
diff changeset
  3288
"/            previous notNil ifTrue:[
c0d549a59039 added: #previousVersions:
Claus Gittinger <cg@exept.de>
parents: 14237
diff changeset
  3289
"/                ^ previous
c0d549a59039 added: #previousVersions:
Claus Gittinger <cg@exept.de>
parents: 14237
diff changeset
  3290
"/            ]
c0d549a59039 added: #previousVersions:
Claus Gittinger <cg@exept.de>
parents: 14237
diff changeset
  3291
"/        ]
c0d549a59039 added: #previousVersions:
Claus Gittinger <cg@exept.de>
parents: 14237
diff changeset
  3292
"/    ].
c0d549a59039 added: #previousVersions:
Claus Gittinger <cg@exept.de>
parents: 14237
diff changeset
  3293
"/    ^ nil.
6644
141198d9b865 previousVersions stuff moved from NewSystemBrowser to here
Claus Gittinger <cg@exept.de>
parents: 6541
diff changeset
  3294
141198d9b865 previousVersions stuff moved from NewSystemBrowser to here
Claus Gittinger <cg@exept.de>
parents: 6541
diff changeset
  3295
"/    history := Class methodHistory.
141198d9b865 previousVersions stuff moved from NewSystemBrowser to here
Claus Gittinger <cg@exept.de>
parents: 6541
diff changeset
  3296
"/    history isNil ifTrue:[^ nil].
141198d9b865 previousVersions stuff moved from NewSystemBrowser to here
Claus Gittinger <cg@exept.de>
parents: 6541
diff changeset
  3297
"/
141198d9b865 previousVersions stuff moved from NewSystemBrowser to here
Claus Gittinger <cg@exept.de>
parents: 6541
diff changeset
  3298
"/    entry := history detect:[:entry | |type old new|
141198d9b865 previousVersions stuff moved from NewSystemBrowser to here
Claus Gittinger <cg@exept.de>
parents: 6541
diff changeset
  3299
"/                                    type := entry first.
141198d9b865 previousVersions stuff moved from NewSystemBrowser to here
Claus Gittinger <cg@exept.de>
parents: 6541
diff changeset
  3300
"/                                    type == #methodChange ifTrue:[
141198d9b865 previousVersions stuff moved from NewSystemBrowser to here
Claus Gittinger <cg@exept.de>
parents: 6541
diff changeset
  3301
"/                                        old := entry second.
141198d9b865 previousVersions stuff moved from NewSystemBrowser to here
Claus Gittinger <cg@exept.de>
parents: 6541
diff changeset
  3302
"/                                        new := entry third.
141198d9b865 previousVersions stuff moved from NewSystemBrowser to here
Claus Gittinger <cg@exept.de>
parents: 6541
diff changeset
  3303
"/                                        new == self
141198d9b865 previousVersions stuff moved from NewSystemBrowser to here
Claus Gittinger <cg@exept.de>
parents: 6541
diff changeset
  3304
"/                                    ] ifFalse:[
141198d9b865 previousVersions stuff moved from NewSystemBrowser to here
Claus Gittinger <cg@exept.de>
parents: 6541
diff changeset
  3305
"/                                        false
141198d9b865 previousVersions stuff moved from NewSystemBrowser to here
Claus Gittinger <cg@exept.de>
parents: 6541
diff changeset
  3306
"/                                    ]
12854
3a3d3c02c3bd *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 12695
diff changeset
  3307
"/                             ]
6644
141198d9b865 previousVersions stuff moved from NewSystemBrowser to here
Claus Gittinger <cg@exept.de>
parents: 6541
diff changeset
  3308
"/                     ifNone:nil.
141198d9b865 previousVersions stuff moved from NewSystemBrowser to here
Claus Gittinger <cg@exept.de>
parents: 6541
diff changeset
  3309
"/    entry isNil ifTrue:[^nil].
141198d9b865 previousVersions stuff moved from NewSystemBrowser to here
Claus Gittinger <cg@exept.de>
parents: 6541
diff changeset
  3310
"/    ^ entry second.
5339
c922450b57b5 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5324
diff changeset
  3311
"/    ^ history at:self ifAbsent:nil
1923
97b099fef985 optionally keep a history of changed methods
Claus Gittinger <cg@exept.de>
parents: 1873
diff changeset
  3312
14251
c0d549a59039 added: #previousVersions:
Claus Gittinger <cg@exept.de>
parents: 14237
diff changeset
  3313
    "Modified: / 26-07-2012 / 13:16:34 / cg"
1923
97b099fef985 optionally keep a history of changed methods
Claus Gittinger <cg@exept.de>
parents: 1873
diff changeset
  3314
!
97b099fef985 optionally keep a history of changed methods
Claus Gittinger <cg@exept.de>
parents: 1873
diff changeset
  3315
7210
80bb33c02780 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 7085
diff changeset
  3316
previousVersionCode
19449
607eb2e0e46c #DOCUMENTATION
Claus Gittinger <cg@exept.de>
parents: 19025
diff changeset
  3317
    "return the receiver's previous version's source code"
7210
80bb33c02780 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 7085
diff changeset
  3318
80bb33c02780 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 7085
diff changeset
  3319
    |previous|
80bb33c02780 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 7085
diff changeset
  3320
80bb33c02780 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 7085
diff changeset
  3321
    previous := self previousVersion.
80bb33c02780 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 7085
diff changeset
  3322
    previous isNil ifTrue:[ ^ nil ].
80bb33c02780 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 7085
diff changeset
  3323
80bb33c02780 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 7085
diff changeset
  3324
    ^ previous source
80bb33c02780 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 7085
diff changeset
  3325
!
80bb33c02780 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 7085
diff changeset
  3326
6644
141198d9b865 previousVersions stuff moved from NewSystemBrowser to here
Claus Gittinger <cg@exept.de>
parents: 6541
diff changeset
  3327
previousVersions
14251
c0d549a59039 added: #previousVersions:
Claus Gittinger <cg@exept.de>
parents: 14237
diff changeset
  3328
    "return a collection of the receiver's previous versions (sources)"
c0d549a59039 added: #previousVersions:
Claus Gittinger <cg@exept.de>
parents: 14237
diff changeset
  3329
c0d549a59039 added: #previousVersions:
Claus Gittinger <cg@exept.de>
parents: 14237
diff changeset
  3330
    ^ self previousVersions:nil
c0d549a59039 added: #previousVersions:
Claus Gittinger <cg@exept.de>
parents: 14237
diff changeset
  3331
c0d549a59039 added: #previousVersions:
Claus Gittinger <cg@exept.de>
parents: 14237
diff changeset
  3332
    "Modified (comment): / 26-07-2012 / 12:04:15 / cg"
c0d549a59039 added: #previousVersions:
Claus Gittinger <cg@exept.de>
parents: 14237
diff changeset
  3333
!
c0d549a59039 added: #previousVersions:
Claus Gittinger <cg@exept.de>
parents: 14237
diff changeset
  3334
c0d549a59039 added: #previousVersions:
Claus Gittinger <cg@exept.de>
parents: 14237
diff changeset
  3335
previousVersions:count
c0d549a59039 added: #previousVersions:
Claus Gittinger <cg@exept.de>
parents: 14237
diff changeset
  3336
    "return a collection of the receiver's count previous versions (sources).
c0d549a59039 added: #previousVersions:
Claus Gittinger <cg@exept.de>
parents: 14237
diff changeset
  3337
     A nil count will retrieve all versions"
6644
141198d9b865 previousVersions stuff moved from NewSystemBrowser to here
Claus Gittinger <cg@exept.de>
parents: 6541
diff changeset
  3338
7453
48c427d125f4 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 7328
diff changeset
  3339
    |sel cls versions lastChange firstSrc last|
6644
141198d9b865 previousVersions stuff moved from NewSystemBrowser to here
Claus Gittinger <cg@exept.de>
parents: 6541
diff changeset
  3340
141198d9b865 previousVersions stuff moved from NewSystemBrowser to here
Claus Gittinger <cg@exept.de>
parents: 6541
diff changeset
  3341
    sel := self selector.
141198d9b865 previousVersions stuff moved from NewSystemBrowser to here
Claus Gittinger <cg@exept.de>
parents: 6541
diff changeset
  3342
    sel isNil ifTrue:[^ #()].
141198d9b865 previousVersions stuff moved from NewSystemBrowser to here
Claus Gittinger <cg@exept.de>
parents: 6541
diff changeset
  3343
141198d9b865 previousVersions stuff moved from NewSystemBrowser to here
Claus Gittinger <cg@exept.de>
parents: 6541
diff changeset
  3344
    cls := self mclass.
141198d9b865 previousVersions stuff moved from NewSystemBrowser to here
Claus Gittinger <cg@exept.de>
parents: 6541
diff changeset
  3345
    cls isNil ifTrue:[^ #()].
141198d9b865 previousVersions stuff moved from NewSystemBrowser to here
Claus Gittinger <cg@exept.de>
parents: 6541
diff changeset
  3346
141198d9b865 previousVersions stuff moved from NewSystemBrowser to here
Claus Gittinger <cg@exept.de>
parents: 6541
diff changeset
  3347
    versions := OrderedCollection new.
141198d9b865 previousVersions stuff moved from NewSystemBrowser to here
Claus Gittinger <cg@exept.de>
parents: 6541
diff changeset
  3348
12854
3a3d3c02c3bd *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 12695
diff changeset
  3349
    ChangeSet current reverseDo:[:change |
18620
b4e9f25d6ce6 preparations for lined index list in WeakArray
Claus Gittinger <cg@exept.de>
parents: 18462
diff changeset
  3350
	(change isMethodChange
b4e9f25d6ce6 preparations for lined index list in WeakArray
Claus Gittinger <cg@exept.de>
parents: 18462
diff changeset
  3351
	    and:[ (change selector == sel)
b4e9f25d6ce6 preparations for lined index list in WeakArray
Claus Gittinger <cg@exept.de>
parents: 18462
diff changeset
  3352
	    and:[ change changeClass == cls ]])
b4e9f25d6ce6 preparations for lined index list in WeakArray
Claus Gittinger <cg@exept.de>
parents: 18462
diff changeset
  3353
	ifTrue:[
b4e9f25d6ce6 preparations for lined index list in WeakArray
Claus Gittinger <cg@exept.de>
parents: 18462
diff changeset
  3354
	    versions addFirst:change.
b4e9f25d6ce6 preparations for lined index list in WeakArray
Claus Gittinger <cg@exept.de>
parents: 18462
diff changeset
  3355
	    lastChange := change.
b4e9f25d6ce6 preparations for lined index list in WeakArray
Claus Gittinger <cg@exept.de>
parents: 18462
diff changeset
  3356
	    (count notNil and:[versions size == count]) ifTrue:[
b4e9f25d6ce6 preparations for lined index list in WeakArray
Claus Gittinger <cg@exept.de>
parents: 18462
diff changeset
  3357
		^ versions
b4e9f25d6ce6 preparations for lined index list in WeakArray
Claus Gittinger <cg@exept.de>
parents: 18462
diff changeset
  3358
	    ]
b4e9f25d6ce6 preparations for lined index list in WeakArray
Claus Gittinger <cg@exept.de>
parents: 18462
diff changeset
  3359
	]
6644
141198d9b865 previousVersions stuff moved from NewSystemBrowser to here
Claus Gittinger <cg@exept.de>
parents: 6541
diff changeset
  3360
    ].
141198d9b865 previousVersions stuff moved from NewSystemBrowser to here
Claus Gittinger <cg@exept.de>
parents: 6541
diff changeset
  3361
141198d9b865 previousVersions stuff moved from NewSystemBrowser to here
Claus Gittinger <cg@exept.de>
parents: 6541
diff changeset
  3362
    lastChange notNil ifTrue:[
18620
b4e9f25d6ce6 preparations for lined index list in WeakArray
Claus Gittinger <cg@exept.de>
parents: 18462
diff changeset
  3363
	last := lastChange previousVersion.
b4e9f25d6ce6 preparations for lined index list in WeakArray
Claus Gittinger <cg@exept.de>
parents: 18462
diff changeset
  3364
	last notNil ifTrue:[
b4e9f25d6ce6 preparations for lined index list in WeakArray
Claus Gittinger <cg@exept.de>
parents: 18462
diff changeset
  3365
	    firstSrc := last source.
b4e9f25d6ce6 preparations for lined index list in WeakArray
Claus Gittinger <cg@exept.de>
parents: 18462
diff changeset
  3366
	    (firstSrc notEmptyOrNil
b4e9f25d6ce6 preparations for lined index list in WeakArray
Claus Gittinger <cg@exept.de>
parents: 18462
diff changeset
  3367
	    and:[ firstSrc ~= lastChange source]) ifTrue:[
b4e9f25d6ce6 preparations for lined index list in WeakArray
Claus Gittinger <cg@exept.de>
parents: 18462
diff changeset
  3368
		versions addFirst:(MethodDefinitionChange
b4e9f25d6ce6 preparations for lined index list in WeakArray
Claus Gittinger <cg@exept.de>
parents: 18462
diff changeset
  3369
				    className:lastChange className
b4e9f25d6ce6 preparations for lined index list in WeakArray
Claus Gittinger <cg@exept.de>
parents: 18462
diff changeset
  3370
				    selector:lastChange selector
b4e9f25d6ce6 preparations for lined index list in WeakArray
Claus Gittinger <cg@exept.de>
parents: 18462
diff changeset
  3371
				    source:firstSrc
b4e9f25d6ce6 preparations for lined index list in WeakArray
Claus Gittinger <cg@exept.de>
parents: 18462
diff changeset
  3372
				    category:lastChange category).
b4e9f25d6ce6 preparations for lined index list in WeakArray
Claus Gittinger <cg@exept.de>
parents: 18462
diff changeset
  3373
	    ]
b4e9f25d6ce6 preparations for lined index list in WeakArray
Claus Gittinger <cg@exept.de>
parents: 18462
diff changeset
  3374
	]
6644
141198d9b865 previousVersions stuff moved from NewSystemBrowser to here
Claus Gittinger <cg@exept.de>
parents: 6541
diff changeset
  3375
    ].
141198d9b865 previousVersions stuff moved from NewSystemBrowser to here
Claus Gittinger <cg@exept.de>
parents: 6541
diff changeset
  3376
    ^ versions
14251
c0d549a59039 added: #previousVersions:
Claus Gittinger <cg@exept.de>
parents: 14237
diff changeset
  3377
c0d549a59039 added: #previousVersions:
Claus Gittinger <cg@exept.de>
parents: 14237
diff changeset
  3378
    "
c0d549a59039 added: #previousVersions:
Claus Gittinger <cg@exept.de>
parents: 14237
diff changeset
  3379
     (Method compiledMethodAt:#previousVersions:) previousVersions:nil
c0d549a59039 added: #previousVersions:
Claus Gittinger <cg@exept.de>
parents: 14237
diff changeset
  3380
    "
c0d549a59039 added: #previousVersions:
Claus Gittinger <cg@exept.de>
parents: 14237
diff changeset
  3381
c0d549a59039 added: #previousVersions:
Claus Gittinger <cg@exept.de>
parents: 14237
diff changeset
  3382
    "Created: / 26-07-2012 / 11:59:57 / cg"
6644
141198d9b865 previousVersions stuff moved from NewSystemBrowser to here
Claus Gittinger <cg@exept.de>
parents: 6541
diff changeset
  3383
!
141198d9b865 previousVersions stuff moved from NewSystemBrowser to here
Claus Gittinger <cg@exept.de>
parents: 6541
diff changeset
  3384
5564
0f513f04c50f #readsFields: and #writesField: for st80 compatibility
Claus Gittinger <cg@exept.de>
parents: 5562
diff changeset
  3385
readsField:instVarIndex
0f513f04c50f #readsFields: and #writesField: for st80 compatibility
Claus Gittinger <cg@exept.de>
parents: 5562
diff changeset
  3386
    "return true, if the instvar at instVarIndex is read by the receiver.
0f513f04c50f #readsFields: and #writesField: for st80 compatibility
Claus Gittinger <cg@exept.de>
parents: 5562
diff changeset
  3387
     Uses parser (for now); could look at bytecode as well here..."
0f513f04c50f #readsFields: and #writesField: for st80 compatibility
Claus Gittinger <cg@exept.de>
parents: 5562
diff changeset
  3388
14237
Claus Gittinger <cg@exept.de>
parents: 14236
diff changeset
  3389
    |instVarName|
Claus Gittinger <cg@exept.de>
parents: 14236
diff changeset
  3390
Claus Gittinger <cg@exept.de>
parents: 14236
diff changeset
  3391
    instVarName := (self mclass allInstVarNames) at:instVarIndex.
Claus Gittinger <cg@exept.de>
parents: 14236
diff changeset
  3392
    ^ self readsInstVar:instVarName
Claus Gittinger <cg@exept.de>
parents: 14236
diff changeset
  3393
Claus Gittinger <cg@exept.de>
parents: 14236
diff changeset
  3394
    "Modified: / 23-07-2012 / 11:16:08 / cg"
Claus Gittinger <cg@exept.de>
parents: 14236
diff changeset
  3395
!
Claus Gittinger <cg@exept.de>
parents: 14236
diff changeset
  3396
Claus Gittinger <cg@exept.de>
parents: 14236
diff changeset
  3397
readsInstVar:instVarName
Claus Gittinger <cg@exept.de>
parents: 14236
diff changeset
  3398
    "return true, if the named instvar is read by the receiver.
Claus Gittinger <cg@exept.de>
parents: 14236
diff changeset
  3399
     Uses parser (for now); could look at bytecode as well here..."
Claus Gittinger <cg@exept.de>
parents: 14236
diff changeset
  3400
Claus Gittinger <cg@exept.de>
parents: 14236
diff changeset
  3401
    |readInstVars|
Claus Gittinger <cg@exept.de>
parents: 14236
diff changeset
  3402
Claus Gittinger <cg@exept.de>
parents: 14236
diff changeset
  3403
    (self source includesString:instVarName) ifFalse:[^ false].     "/ that's much faster than parsing...
5636
eab6a71fb3d0 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5634
diff changeset
  3404
    readInstVars := self parse:#'parseMethodSilent:in:' with:self mclass  return:#readInstVars or:#().
14237
Claus Gittinger <cg@exept.de>
parents: 14236
diff changeset
  3405
    ^ readInstVars includes:instVarName.
Claus Gittinger <cg@exept.de>
parents: 14236
diff changeset
  3406
Claus Gittinger <cg@exept.de>
parents: 14236
diff changeset
  3407
    "Created: / 23-07-2012 / 11:15:56 / cg"
5564
0f513f04c50f #readsFields: and #writesField: for st80 compatibility
Claus Gittinger <cg@exept.de>
parents: 5562
diff changeset
  3408
!
0f513f04c50f #readsFields: and #writesField: for st80 compatibility
Claus Gittinger <cg@exept.de>
parents: 5562
diff changeset
  3409
14253
Claus Gittinger <cg@exept.de>
parents: 14251
diff changeset
  3410
refersToLiteral: anObject
Claus Gittinger <cg@exept.de>
parents: 14251
diff changeset
  3411
    "redefined to search in annotations"
Claus Gittinger <cg@exept.de>
parents: 14251
diff changeset
  3412
Claus Gittinger <cg@exept.de>
parents: 14251
diff changeset
  3413
    (super refersToLiteral: anObject) ifTrue:[^ true].
Claus Gittinger <cg@exept.de>
parents: 14251
diff changeset
  3414
15387
f8f6247b071f class: Method
Claus Gittinger <cg@exept.de>
parents: 15346
diff changeset
  3415
    self annotationsDo:[:annot |
18620
b4e9f25d6ce6 preparations for lined index list in WeakArray
Claus Gittinger <cg@exept.de>
parents: 18462
diff changeset
  3416
	(annot refersToLiteral: anObject) ifTrue:[
b4e9f25d6ce6 preparations for lined index list in WeakArray
Claus Gittinger <cg@exept.de>
parents: 18462
diff changeset
  3417
	    "/ self halt.
b4e9f25d6ce6 preparations for lined index list in WeakArray
Claus Gittinger <cg@exept.de>
parents: 18462
diff changeset
  3418
	    ^ true
b4e9f25d6ce6 preparations for lined index list in WeakArray
Claus Gittinger <cg@exept.de>
parents: 18462
diff changeset
  3419
	].
14253
Claus Gittinger <cg@exept.de>
parents: 14251
diff changeset
  3420
    ].
Claus Gittinger <cg@exept.de>
parents: 14251
diff changeset
  3421
    ^ false
Claus Gittinger <cg@exept.de>
parents: 14251
diff changeset
  3422
Claus Gittinger <cg@exept.de>
parents: 14251
diff changeset
  3423
    "Created: / 26-07-2012 / 15:51:14 / cg"
Claus Gittinger <cg@exept.de>
parents: 14251
diff changeset
  3424
!
Claus Gittinger <cg@exept.de>
parents: 14251
diff changeset
  3425
Claus Gittinger <cg@exept.de>
parents: 14251
diff changeset
  3426
refersToLiteralMatching: aMatchString
Claus Gittinger <cg@exept.de>
parents: 14251
diff changeset
  3427
    (super refersToLiteralMatching: aMatchString) ifTrue:[^ true].
Claus Gittinger <cg@exept.de>
parents: 14251
diff changeset
  3428
15387
f8f6247b071f class: Method
Claus Gittinger <cg@exept.de>
parents: 15346
diff changeset
  3429
    self annotationsDo:[:annot |
18620
b4e9f25d6ce6 preparations for lined index list in WeakArray
Claus Gittinger <cg@exept.de>
parents: 18462
diff changeset
  3430
	(annot refersToLiteralMatching: aMatchString) ifTrue:[
b4e9f25d6ce6 preparations for lined index list in WeakArray
Claus Gittinger <cg@exept.de>
parents: 18462
diff changeset
  3431
	    "/ self halt.
b4e9f25d6ce6 preparations for lined index list in WeakArray
Claus Gittinger <cg@exept.de>
parents: 18462
diff changeset
  3432
	    ^ true
b4e9f25d6ce6 preparations for lined index list in WeakArray
Claus Gittinger <cg@exept.de>
parents: 18462
diff changeset
  3433
	].
14253
Claus Gittinger <cg@exept.de>
parents: 14251
diff changeset
  3434
    ].
Claus Gittinger <cg@exept.de>
parents: 14251
diff changeset
  3435
    ^ false
Claus Gittinger <cg@exept.de>
parents: 14251
diff changeset
  3436
Claus Gittinger <cg@exept.de>
parents: 14251
diff changeset
  3437
    "Created: / 26-07-2012 / 15:51:36 / cg"
Claus Gittinger <cg@exept.de>
parents: 14251
diff changeset
  3438
!
Claus Gittinger <cg@exept.de>
parents: 14251
diff changeset
  3439
3052
f384e7082ee9 more resource stuff (VW compatibility)
Claus Gittinger <cg@exept.de>
parents: 3030
diff changeset
  3440
resourceType
f384e7082ee9 more resource stuff (VW compatibility)
Claus Gittinger <cg@exept.de>
parents: 3030
diff changeset
  3441
    "ST-80 compatibility:
22372
72db331204d4 #DOCUMENTATION by cg
Claus Gittinger <cg@exept.de>
parents: 22188
diff changeset
  3442
     return the method's first resource specs key.
22527
bc45db485b0d #DOCUMENTATION by cg
Claus Gittinger <cg@exept.de>
parents: 22446
diff changeset
  3443
     Returns either nil, or a single symbol.
bc45db485b0d #DOCUMENTATION by cg
Claus Gittinger <cg@exept.de>
parents: 22446
diff changeset
  3444
     For example, for an image-spec method, the resourceType
bc45db485b0d #DOCUMENTATION by cg
Claus Gittinger <cg@exept.de>
parents: 22446
diff changeset
  3445
     would be #image"
3052
f384e7082ee9 more resource stuff (VW compatibility)
Claus Gittinger <cg@exept.de>
parents: 3030
diff changeset
  3446
3387
dbe1b3cf7b83 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 3372
diff changeset
  3447
    |resources|
dbe1b3cf7b83 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 3372
diff changeset
  3448
dbe1b3cf7b83 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 3372
diff changeset
  3449
    (resources := self resources) notNil ifTrue:[
22372
72db331204d4 #DOCUMENTATION by cg
Claus Gittinger <cg@exept.de>
parents: 22188
diff changeset
  3450
        resources keysAndValuesDo:[:key :val|
72db331204d4 #DOCUMENTATION by cg
Claus Gittinger <cg@exept.de>
parents: 22188
diff changeset
  3451
            ^ key
72db331204d4 #DOCUMENTATION by cg
Claus Gittinger <cg@exept.de>
parents: 22188
diff changeset
  3452
        ].
3341
c5773eb96bd2 resource icons moved to class BrowserView
tz
parents: 3297
diff changeset
  3453
    ].
3387
dbe1b3cf7b83 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 3372
diff changeset
  3454
    ^ nil
22372
72db331204d4 #DOCUMENTATION by cg
Claus Gittinger <cg@exept.de>
parents: 22188
diff changeset
  3455
72db331204d4 #DOCUMENTATION by cg
Claus Gittinger <cg@exept.de>
parents: 22188
diff changeset
  3456
    "Modified (comment): / 21-11-2017 / 13:05:19 / cg"
3052
f384e7082ee9 more resource stuff (VW compatibility)
Claus Gittinger <cg@exept.de>
parents: 3030
diff changeset
  3457
!
f384e7082ee9 more resource stuff (VW compatibility)
Claus Gittinger <cg@exept.de>
parents: 3030
diff changeset
  3458
f384e7082ee9 more resource stuff (VW compatibility)
Claus Gittinger <cg@exept.de>
parents: 3030
diff changeset
  3459
resources
22446
f3eddd51bba2 #DOCUMENTATION by cg
Claus Gittinger <cg@exept.de>
parents: 22443
diff changeset
  3460
    "return the method's resource spec (i.e. resource-annotation); 
f3eddd51bba2 #DOCUMENTATION by cg
Claus Gittinger <cg@exept.de>
parents: 22443
diff changeset
  3461
     either nil or a collection of symbols."
3052
f384e7082ee9 more resource stuff (VW compatibility)
Claus Gittinger <cg@exept.de>
parents: 3030
diff changeset
  3462
13422
b43a8a47037c Jan's changes
vrany
parents: 13390
diff changeset
  3463
    | resources |
13817
7d1e0e8ea364 changed:10 methods
Claus Gittinger <cg@exept.de>
parents: 13805
diff changeset
  3464
3052
f384e7082ee9 more resource stuff (VW compatibility)
Claus Gittinger <cg@exept.de>
parents: 3030
diff changeset
  3465
    self hasResource ifFalse:[^ nil].
13817
7d1e0e8ea364 changed:10 methods
Claus Gittinger <cg@exept.de>
parents: 13805
diff changeset
  3466
    annotations isNil ifTrue:[^ self parseResources].
13422
b43a8a47037c Jan's changes
vrany
parents: 13390
diff changeset
  3467
b43a8a47037c Jan's changes
vrany
parents: 13390
diff changeset
  3468
    resources := IdentityDictionary new.
18753
941d99755164 #BUGFIX
Stefan Vogel <sv@exept.de>
parents: 18620
diff changeset
  3469
    self annotationsAt: #resource: orAt: #resource:values: do:[:annot|
941d99755164 #BUGFIX
Stefan Vogel <sv@exept.de>
parents: 18620
diff changeset
  3470
        resources at: annot type put: annot value ? true
13817
7d1e0e8ea364 changed:10 methods
Claus Gittinger <cg@exept.de>
parents: 13805
diff changeset
  3471
    ].
7d1e0e8ea364 changed:10 methods
Claus Gittinger <cg@exept.de>
parents: 13805
diff changeset
  3472
    ^ resources
13422
b43a8a47037c Jan's changes
vrany
parents: 13390
diff changeset
  3473
b43a8a47037c Jan's changes
vrany
parents: 13390
diff changeset
  3474
    "Modified: / 16-07-2010 / 11:49:27 / Jan Vrany <jan.vrany@fit.cvut.cz>"
13817
7d1e0e8ea364 changed:10 methods
Claus Gittinger <cg@exept.de>
parents: 13805
diff changeset
  3475
    "Modified: / 18-11-2011 / 14:48:41 / cg"
22372
72db331204d4 #DOCUMENTATION by cg
Claus Gittinger <cg@exept.de>
parents: 22188
diff changeset
  3476
    "Modified (comment): / 21-11-2017 / 13:05:22 / cg"
3052
f384e7082ee9 more resource stuff (VW compatibility)
Claus Gittinger <cg@exept.de>
parents: 3030
diff changeset
  3477
!
f384e7082ee9 more resource stuff (VW compatibility)
Claus Gittinger <cg@exept.de>
parents: 3030
diff changeset
  3478
952
d600e08a5936 handle the case where a method has a sourceFileInfo, but the class has not
Claus Gittinger <cg@exept.de>
parents: 934
diff changeset
  3479
selector
d600e08a5936 handle the case where a method has a sourceFileInfo, but the class has not
Claus Gittinger <cg@exept.de>
parents: 934
diff changeset
  3480
    "return the selector under which I am found in my containingClasses
12854
3a3d3c02c3bd *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 12695
diff changeset
  3481
     method-table.
952
d600e08a5936 handle the case where a method has a sourceFileInfo, but the class has not
Claus Gittinger <cg@exept.de>
parents: 934
diff changeset
  3482
     See comment in who."
d600e08a5936 handle the case where a method has a sourceFileInfo, but the class has not
Claus Gittinger <cg@exept.de>
parents: 934
diff changeset
  3483
d600e08a5936 handle the case where a method has a sourceFileInfo, but the class has not
Claus Gittinger <cg@exept.de>
parents: 934
diff changeset
  3484
    "based on who, which has been added for ST-80 compatibility"
d600e08a5936 handle the case where a method has a sourceFileInfo, but the class has not
Claus Gittinger <cg@exept.de>
parents: 934
diff changeset
  3485
1851
4accc9fafd19 change #who to return a proper object
Claus Gittinger <cg@exept.de>
parents: 1813
diff changeset
  3486
    |who|
68
59faa75185ba *** empty log message ***
claus
parents: 56
diff changeset
  3487
1851
4accc9fafd19 change #who to return a proper object
Claus Gittinger <cg@exept.de>
parents: 1813
diff changeset
  3488
    who := self who.
4accc9fafd19 change #who to return a proper object
Claus Gittinger <cg@exept.de>
parents: 1813
diff changeset
  3489
    who notNil ifTrue:[^ who methodSelector].
952
d600e08a5936 handle the case where a method has a sourceFileInfo, but the class has not
Claus Gittinger <cg@exept.de>
parents: 934
diff changeset
  3490
    "
d600e08a5936 handle the case where a method has a sourceFileInfo, but the class has not
Claus Gittinger <cg@exept.de>
parents: 934
diff changeset
  3491
     none found - sorry
d600e08a5936 handle the case where a method has a sourceFileInfo, but the class has not
Claus Gittinger <cg@exept.de>
parents: 934
diff changeset
  3492
    "
d600e08a5936 handle the case where a method has a sourceFileInfo, but the class has not
Claus Gittinger <cg@exept.de>
parents: 934
diff changeset
  3493
    ^ nil
d600e08a5936 handle the case where a method has a sourceFileInfo, but the class has not
Claus Gittinger <cg@exept.de>
parents: 934
diff changeset
  3494
d600e08a5936 handle the case where a method has a sourceFileInfo, but the class has not
Claus Gittinger <cg@exept.de>
parents: 934
diff changeset
  3495
    "
d600e08a5936 handle the case where a method has a sourceFileInfo, but the class has not
Claus Gittinger <cg@exept.de>
parents: 934
diff changeset
  3496
     |m|
d600e08a5936 handle the case where a method has a sourceFileInfo, but the class has not
Claus Gittinger <cg@exept.de>
parents: 934
diff changeset
  3497
     m := Object compiledMethodAt:#at:.
d600e08a5936 handle the case where a method has a sourceFileInfo, but the class has not
Claus Gittinger <cg@exept.de>
parents: 934
diff changeset
  3498
     m selector
d600e08a5936 handle the case where a method has a sourceFileInfo, but the class has not
Claus Gittinger <cg@exept.de>
parents: 934
diff changeset
  3499
    "
1851
4accc9fafd19 change #who to return a proper object
Claus Gittinger <cg@exept.de>
parents: 1813
diff changeset
  3500
4accc9fafd19 change #who to return a proper object
Claus Gittinger <cg@exept.de>
parents: 1813
diff changeset
  3501
    "Modified: 1.11.1996 / 16:25:48 / cg"
952
d600e08a5936 handle the case where a method has a sourceFileInfo, but the class has not
Claus Gittinger <cg@exept.de>
parents: 934
diff changeset
  3502
!
68
59faa75185ba *** empty log message ***
claus
parents: 56
diff changeset
  3503
12363
a7251dc427bd added: #sends:or:
Claus Gittinger <cg@exept.de>
parents: 12324
diff changeset
  3504
sends:selectorSymbol1 or:selectorSymbol2
21341
33a1e462e18a #REFACTORING by cg
Claus Gittinger <cg@exept.de>
parents: 21336
diff changeset
  3505
    <resource: #obsolete>
12363
a7251dc427bd added: #sends:or:
Claus Gittinger <cg@exept.de>
parents: 12324
diff changeset
  3506
    "return true, if this method contains a message-send
13569
82bcca38e855 comment/format in: #sends:or:
Claus Gittinger <cg@exept.de>
parents: 13567
diff changeset
  3507
     to either selectorSymbol1 or selectorSymbol2.
82bcca38e855 comment/format in: #sends:or:
Claus Gittinger <cg@exept.de>
parents: 13567
diff changeset
  3508
     This is a hack, because calling sends: twice parses twice (should cache parse trees)"
12363
a7251dc427bd added: #sends:or:
Claus Gittinger <cg@exept.de>
parents: 12324
diff changeset
  3509
21341
33a1e462e18a #REFACTORING by cg
Claus Gittinger <cg@exept.de>
parents: 21336
diff changeset
  3510
    ^ self sendsAnySelector:{ selectorSymbol1 . selectorSymbol2 }
33a1e462e18a #REFACTORING by cg
Claus Gittinger <cg@exept.de>
parents: 21336
diff changeset
  3511
33a1e462e18a #REFACTORING by cg
Claus Gittinger <cg@exept.de>
parents: 21336
diff changeset
  3512
    "Modified: / 05-02-2017 / 01:28:03 / cg"
12363
a7251dc427bd added: #sends:or:
Claus Gittinger <cg@exept.de>
parents: 12324
diff changeset
  3513
!
a7251dc427bd added: #sends:or:
Claus Gittinger <cg@exept.de>
parents: 12324
diff changeset
  3514
21341
33a1e462e18a #REFACTORING by cg
Claus Gittinger <cg@exept.de>
parents: 21336
diff changeset
  3515
sendsAnySelector:aCollectionOfSelectorSymbols
13570
382db10e848d changed: #parse:with:return:or:
Claus Gittinger <cg@exept.de>
parents: 13569
diff changeset
  3516
    "return true, if this method contains a message-send
382db10e848d changed: #parse:with:return:or:
Claus Gittinger <cg@exept.de>
parents: 13569
diff changeset
  3517
     to any of aCollectionOfSelectorSymbols."
382db10e848d changed: #parse:with:return:or:
Claus Gittinger <cg@exept.de>
parents: 13569
diff changeset
  3518
382db10e848d changed: #parse:with:return:or:
Claus Gittinger <cg@exept.de>
parents: 13569
diff changeset
  3519
    |msgs|
382db10e848d changed: #parse:with:return:or:
Claus Gittinger <cg@exept.de>
parents: 13569
diff changeset
  3520
382db10e848d changed: #parse:with:return:or:
Claus Gittinger <cg@exept.de>
parents: 13569
diff changeset
  3521
    (aCollectionOfSelectorSymbols contains:[:sym | self referencesLiteral:sym]) ifTrue:[
21341
33a1e462e18a #REFACTORING by cg
Claus Gittinger <cg@exept.de>
parents: 21336
diff changeset
  3522
        "/ cg: was temporarily disabled to speed up some searches.
33a1e462e18a #REFACTORING by cg
Claus Gittinger <cg@exept.de>
parents: 21336
diff changeset
  3523
        "/ I think, we have to change the caller's to call referencesLiteral: instead,
33a1e462e18a #REFACTORING by cg
Claus Gittinger <cg@exept.de>
parents: 21336
diff changeset
  3524
        "/ if there is any speed problem there. Not here.
33a1e462e18a #REFACTORING by cg
Claus Gittinger <cg@exept.de>
parents: 21336
diff changeset
  3525
        "/ ^ true.
33a1e462e18a #REFACTORING by cg
Claus Gittinger <cg@exept.de>
parents: 21336
diff changeset
  3526
33a1e462e18a #REFACTORING by cg
Claus Gittinger <cg@exept.de>
parents: 21336
diff changeset
  3527
        msgs := self messagesSent.
33a1e462e18a #REFACTORING by cg
Claus Gittinger <cg@exept.de>
parents: 21336
diff changeset
  3528
        ^ aCollectionOfSelectorSymbols contains:[:sym | msgs includesIdentical:sym]
13570
382db10e848d changed: #parse:with:return:or:
Claus Gittinger <cg@exept.de>
parents: 13569
diff changeset
  3529
    ].
382db10e848d changed: #parse:with:return:or:
Claus Gittinger <cg@exept.de>
parents: 13569
diff changeset
  3530
    ^ false
382db10e848d changed: #parse:with:return:or:
Claus Gittinger <cg@exept.de>
parents: 13569
diff changeset
  3531
21341
33a1e462e18a #REFACTORING by cg
Claus Gittinger <cg@exept.de>
parents: 21336
diff changeset
  3532
    "Modified: / 05-02-2017 / 01:22:03 / cg"
13570
382db10e848d changed: #parse:with:return:or:
Claus Gittinger <cg@exept.de>
parents: 13569
diff changeset
  3533
!
382db10e848d changed: #parse:with:return:or:
Claus Gittinger <cg@exept.de>
parents: 13569
diff changeset
  3534
19739
5f6b9dbd32c6 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 19732
diff changeset
  3535
sendsMessageForWhich:aCheckBlock
5f6b9dbd32c6 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 19732
diff changeset
  3536
    "return true, if this method contains a message-send
5f6b9dbd32c6 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 19732
diff changeset
  3537
     for which aCheckBlock returns true, when given the selector."
5f6b9dbd32c6 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 19732
diff changeset
  3538
5f6b9dbd32c6 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 19732
diff changeset
  3539
    self literalsDo:[:each |
5f6b9dbd32c6 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 19732
diff changeset
  3540
        each isSymbol ifTrue:[
5f6b9dbd32c6 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 19732
diff changeset
  3541
            "/ first check if the selector matches
5f6b9dbd32c6 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 19732
diff changeset
  3542
            (aCheckBlock value:each) ifTrue:[
5f6b9dbd32c6 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 19732
diff changeset
  3543
                "/ then, if this is really a message send
5f6b9dbd32c6 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 19732
diff changeset
  3544
                (self messagesSent includes:each) ifTrue:[^ true].
5f6b9dbd32c6 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 19732
diff changeset
  3545
            ]
5f6b9dbd32c6 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 19732
diff changeset
  3546
        ]
20208
79b24601b7d6 #OTHER by mawalch
mawalch
parents: 20035
diff changeset
  3547
    ].
19739
5f6b9dbd32c6 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 19732
diff changeset
  3548
    ^ false
5f6b9dbd32c6 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 19732
diff changeset
  3549
5f6b9dbd32c6 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 19732
diff changeset
  3550
    "
20208
79b24601b7d6 #OTHER by mawalch
mawalch
parents: 20035
diff changeset
  3551
     (self compiledMethodAt:#sendsAnyForWhich:)
19739
5f6b9dbd32c6 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 19732
diff changeset
  3552
        sendsAnyForWhich:[:sel | sel startsWith:'message']
20208
79b24601b7d6 #OTHER by mawalch
mawalch
parents: 20035
diff changeset
  3553
     (self compiledMethodAt:#sendsAnyForWhich:)
19739
5f6b9dbd32c6 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 19732
diff changeset
  3554
        sendsAnyForWhich:[:sel | sel startsWith:'foo']
5f6b9dbd32c6 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 19732
diff changeset
  3555
    "
5f6b9dbd32c6 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 19732
diff changeset
  3556
!
5f6b9dbd32c6 #FEATURE by cg
Claus Gittinger <cg@exept.de>
parents: 19732
diff changeset
  3557
21341
33a1e462e18a #REFACTORING by cg
Claus Gittinger <cg@exept.de>
parents: 21336
diff changeset
  3558
sendsSelector:aSelectorSymbol
33a1e462e18a #REFACTORING by cg
Claus Gittinger <cg@exept.de>
parents: 21336
diff changeset
  3559
    "return true, if this method contains a message-send
33a1e462e18a #REFACTORING by cg
Claus Gittinger <cg@exept.de>
parents: 21336
diff changeset
  3560
     with aSelectorSymbol as selector."
33a1e462e18a #REFACTORING by cg
Claus Gittinger <cg@exept.de>
parents: 21336
diff changeset
  3561
33a1e462e18a #REFACTORING by cg
Claus Gittinger <cg@exept.de>
parents: 21336
diff changeset
  3562
    (self referencesLiteral:aSelectorSymbol) ifTrue:[
33a1e462e18a #REFACTORING by cg
Claus Gittinger <cg@exept.de>
parents: 21336
diff changeset
  3563
        "/ cg: was temporarily disabled to speed up some searches.
33a1e462e18a #REFACTORING by cg
Claus Gittinger <cg@exept.de>
parents: 21336
diff changeset
  3564
        "/ I think, we have to change the callers to call referencesLiteral: instead,
33a1e462e18a #REFACTORING by cg
Claus Gittinger <cg@exept.de>
parents: 21336
diff changeset
  3565
        "/ if there is any speed problem there. Not here.
33a1e462e18a #REFACTORING by cg
Claus Gittinger <cg@exept.de>
parents: 21336
diff changeset
  3566
        "/ ^ true.
33a1e462e18a #REFACTORING by cg
Claus Gittinger <cg@exept.de>
parents: 21336
diff changeset
  3567
        "/ the self messagesSent does a parse-tree analysis
33a1e462e18a #REFACTORING by cg
Claus Gittinger <cg@exept.de>
parents: 21336
diff changeset
  3568
        ^ self messagesSent includesIdentical:aSelectorSymbol
33a1e462e18a #REFACTORING by cg
Claus Gittinger <cg@exept.de>
parents: 21336
diff changeset
  3569
    ].
33a1e462e18a #REFACTORING by cg
Claus Gittinger <cg@exept.de>
parents: 21336
diff changeset
  3570
    ^ false
33a1e462e18a #REFACTORING by cg
Claus Gittinger <cg@exept.de>
parents: 21336
diff changeset
  3571
33a1e462e18a #REFACTORING by cg
Claus Gittinger <cg@exept.de>
parents: 21336
diff changeset
  3572
    "Modified: / 05-02-2017 / 01:21:09 / cg"
33a1e462e18a #REFACTORING by cg
Claus Gittinger <cg@exept.de>
parents: 21336
diff changeset
  3573
!
33a1e462e18a #REFACTORING by cg
Claus Gittinger <cg@exept.de>
parents: 21336
diff changeset
  3574
16877
d4a452edacb5 Added Method>>shadowedMethod returning shadowed method or nil.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 16847
diff changeset
  3575
shadowedMethod
17562
ee6d827bd625 class: Method
Claus Gittinger <cg@exept.de>
parents: 17547
diff changeset
  3576
    "Return the shadowed method if this method is an extension (i.e. package ~= classes' package)
ee6d827bd625 class: Method
Claus Gittinger <cg@exept.de>
parents: 17547
diff changeset
  3577
     AND it shadows (redefines) an existing method from the method's class.
16877
d4a452edacb5 Added Method>>shadowedMethod returning shadowed method or nil.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 16847
diff changeset
  3578
     If this method does not shadow any other method, return nil."
d4a452edacb5 Added Method>>shadowedMethod returning shadowed method or nil.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 16847
diff changeset
  3579
17562
ee6d827bd625 class: Method
Claus Gittinger <cg@exept.de>
parents: 17547
diff changeset
  3580
    | myClass nonMetaClass myProjectDefinition originalMethod|
16877
d4a452edacb5 Added Method>>shadowedMethod returning shadowed method or nil.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 16847
diff changeset
  3581
d4a452edacb5 Added Method>>shadowedMethod returning shadowed method or nil.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 16847
diff changeset
  3582
    myClass := self mclass.
d4a452edacb5 Added Method>>shadowedMethod returning shadowed method or nil.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 16847
diff changeset
  3583
    myClass isNil ifTrue:[^ nil].
17562
ee6d827bd625 class: Method
Claus Gittinger <cg@exept.de>
parents: 17547
diff changeset
  3584
    nonMetaClass := myClass theNonMetaclass.
ee6d827bd625 class: Method
Claus Gittinger <cg@exept.de>
parents: 17547
diff changeset
  3585
ee6d827bd625 class: Method
Claus Gittinger <cg@exept.de>
parents: 17547
diff changeset
  3586
    (package ~= nonMetaClass package
18620
b4e9f25d6ce6 preparations for lined index list in WeakArray
Claus Gittinger <cg@exept.de>
parents: 18462
diff changeset
  3587
	and:[ package ~= PackageId noProjectID
b4e9f25d6ce6 preparations for lined index list in WeakArray
Claus Gittinger <cg@exept.de>
parents: 18462
diff changeset
  3588
	and:[ (myProjectDefinition := nonMetaClass projectDefinitionClass) notNil ]])
b4e9f25d6ce6 preparations for lined index list in WeakArray
Claus Gittinger <cg@exept.de>
parents: 18462
diff changeset
  3589
    ifTrue:[
b4e9f25d6ce6 preparations for lined index list in WeakArray
Claus Gittinger <cg@exept.de>
parents: 18462
diff changeset
  3590
	originalMethod := myProjectDefinition savedOverwrittenMethodForClass:myClass selector:self selector.
b4e9f25d6ce6 preparations for lined index list in WeakArray
Claus Gittinger <cg@exept.de>
parents: 18462
diff changeset
  3591
b4e9f25d6ce6 preparations for lined index list in WeakArray
Claus Gittinger <cg@exept.de>
parents: 18462
diff changeset
  3592
	"/ mhm - what if it does no make a difference?
b4e9f25d6ce6 preparations for lined index list in WeakArray
Claus Gittinger <cg@exept.de>
parents: 18462
diff changeset
  3593
	"/ (originalMethod notNil and:[originalMethod source = self source]) ifTrue:[
b4e9f25d6ce6 preparations for lined index list in WeakArray
Claus Gittinger <cg@exept.de>
parents: 18462
diff changeset
  3594
	"/    "/ self halt. ^ nil
b4e9f25d6ce6 preparations for lined index list in WeakArray
Claus Gittinger <cg@exept.de>
parents: 18462
diff changeset
  3595
	"/ ].
b4e9f25d6ce6 preparations for lined index list in WeakArray
Claus Gittinger <cg@exept.de>
parents: 18462
diff changeset
  3596
	^ originalMethod
17562
ee6d827bd625 class: Method
Claus Gittinger <cg@exept.de>
parents: 17547
diff changeset
  3597
    ].
16877
d4a452edacb5 Added Method>>shadowedMethod returning shadowed method or nil.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 16847
diff changeset
  3598
    ^ nil
d4a452edacb5 Added Method>>shadowedMethod returning shadowed method or nil.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 16847
diff changeset
  3599
d4a452edacb5 Added Method>>shadowedMethod returning shadowed method or nil.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 16847
diff changeset
  3600
    "Created: / 03-10-2014 / 15:16:08 / Jan Vrany <jan.vrany@fit.cvut.cz>"
d4a452edacb5 Added Method>>shadowedMethod returning shadowed method or nil.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 16847
diff changeset
  3601
!
d4a452edacb5 Added Method>>shadowedMethod returning shadowed method or nil.
Jan Vrany <jan.vrany@fit.cvut.cz>
parents: 16847
diff changeset
  3602
11022
8dd9f699915f +shouldBeSkippedInDebuggersWalkBack
Claus Gittinger <cg@exept.de>
parents: 11016
diff changeset
  3603
shouldBeSkippedInDebuggersWalkBack
8dd9f699915f +shouldBeSkippedInDebuggersWalkBack
Claus Gittinger <cg@exept.de>
parents: 11016
diff changeset
  3604
    "return true, if this method thinks, it should be skipped in a walkback.
17463
9f3633d1b67e class: Method
Claus Gittinger <cg@exept.de>
parents: 17452
diff changeset
  3605
     This is done by looking for a #skipInDebuggersWalkBack flag in the method's resources."
11022
8dd9f699915f +shouldBeSkippedInDebuggersWalkBack
Claus Gittinger <cg@exept.de>
parents: 11016
diff changeset
  3606
8dd9f699915f +shouldBeSkippedInDebuggersWalkBack
Claus Gittinger <cg@exept.de>
parents: 11016
diff changeset
  3607
    |resources|
8dd9f699915f +shouldBeSkippedInDebuggersWalkBack
Claus Gittinger <cg@exept.de>
parents: 11016
diff changeset
  3608
8dd9f699915f +shouldBeSkippedInDebuggersWalkBack
Claus Gittinger <cg@exept.de>
parents: 11016
diff changeset
  3609
    resources := self resources.
20208
79b24601b7d6 #OTHER by mawalch
mawalch
parents: 20035
diff changeset
  3610
    ^ resources notNil
19699
01a9805ec9ab #DOCUMENTATION by cg
Claus Gittinger <cg@exept.de>
parents: 19693
diff changeset
  3611
        and:[ resources includesKey:#skipInDebuggersWalkBack ].
11022
8dd9f699915f +shouldBeSkippedInDebuggersWalkBack
Claus Gittinger <cg@exept.de>
parents: 11016
diff changeset
  3612
!
8dd9f699915f +shouldBeSkippedInDebuggersWalkBack
Claus Gittinger <cg@exept.de>
parents: 11016
diff changeset
  3613
5696
958a0643496d compatibility
Claus Gittinger <cg@exept.de>
parents: 5676
diff changeset
  3614
superMessages
958a0643496d compatibility
Claus Gittinger <cg@exept.de>
parents: 5676
diff changeset
  3615
    "return a collection of message-selectors, sent to super by this method."
958a0643496d compatibility
Claus Gittinger <cg@exept.de>
parents: 5676
diff changeset
  3616
958a0643496d compatibility
Claus Gittinger <cg@exept.de>
parents: 5676
diff changeset
  3617
    ^ self messagesSentToSuper
958a0643496d compatibility
Claus Gittinger <cg@exept.de>
parents: 5676
diff changeset
  3618
!
958a0643496d compatibility
Claus Gittinger <cg@exept.de>
parents: 5676
diff changeset
  3619
5523
86ad12f4afc9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5509
diff changeset
  3620
usedGlobals
86ad12f4afc9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5509
diff changeset
  3621
    "return a collection with the global names referred to by the receiver.
86ad12f4afc9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5509
diff changeset
  3622
     Uses Parser to parse methods source and extract them."
86ad12f4afc9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5509
diff changeset
  3623
12854
3a3d3c02c3bd *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 12695
diff changeset
  3624
    ^ self parse:#'parseMethodSilent:in:' with:self mclass return:#usedGlobals or:#()
5523
86ad12f4afc9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5509
diff changeset
  3625
86ad12f4afc9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5509
diff changeset
  3626
    "
12854
3a3d3c02c3bd *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 12695
diff changeset
  3627
     (Method compiledMethodAt:#resources) usedGlobals
5523
86ad12f4afc9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5509
diff changeset
  3628
    "
86ad12f4afc9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5509
diff changeset
  3629
!
86ad12f4afc9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5509
diff changeset
  3630
5509
c0277123fe4a added #usedSymbols query
Claus Gittinger <cg@exept.de>
parents: 5500
diff changeset
  3631
usedSymbols
c0277123fe4a added #usedSymbols query
Claus Gittinger <cg@exept.de>
parents: 5500
diff changeset
  3632
    "return a collection with the symbols referred to by the receiver.
c0277123fe4a added #usedSymbols query
Claus Gittinger <cg@exept.de>
parents: 5500
diff changeset
  3633
     Uses Parser to parse methods source and extract them.
12854
3a3d3c02c3bd *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 12695
diff changeset
  3634
     This collection only includes implicit symbols references
8895
81e4e78ef244 comment
Claus Gittinger <cg@exept.de>
parents: 8854
diff changeset
  3635
     (i.e. not messages sent)"
5509
c0277123fe4a added #usedSymbols query
Claus Gittinger <cg@exept.de>
parents: 5500
diff changeset
  3636
12854
3a3d3c02c3bd *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 12695
diff changeset
  3637
    ^ self parse:#'parseMethodSilent:in:' with:self mclass return:#usedSymbols or:#()
5509
c0277123fe4a added #usedSymbols query
Claus Gittinger <cg@exept.de>
parents: 5500
diff changeset
  3638
c0277123fe4a added #usedSymbols query
Claus Gittinger <cg@exept.de>
parents: 5500
diff changeset
  3639
    "
12854
3a3d3c02c3bd *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 12695
diff changeset
  3640
     (Method compiledMethodAt:#usedSymbols) usedSymbols
3a3d3c02c3bd *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 12695
diff changeset
  3641
     (Method compiledMethodAt:#usedSymbols) messagesSent
5509
c0277123fe4a added #usedSymbols query
Claus Gittinger <cg@exept.de>
parents: 5500
diff changeset
  3642
    "
c0277123fe4a added #usedSymbols query
Claus Gittinger <cg@exept.de>
parents: 5500
diff changeset
  3643
!
c0277123fe4a added #usedSymbols query
Claus Gittinger <cg@exept.de>
parents: 5500
diff changeset
  3644
952
d600e08a5936 handle the case where a method has a sourceFileInfo, but the class has not
Claus Gittinger <cg@exept.de>
parents: 934
diff changeset
  3645
who
1851
4accc9fafd19 change #who to return a proper object
Claus Gittinger <cg@exept.de>
parents: 1813
diff changeset
  3646
    "return the class and selector of where I am defined in;
4accc9fafd19 change #who to return a proper object
Claus Gittinger <cg@exept.de>
parents: 1813
diff changeset
  3647
     nil is returned for unbound methods.
4accc9fafd19 change #who to return a proper object
Claus Gittinger <cg@exept.de>
parents: 1813
diff changeset
  3648
12854
3a3d3c02c3bd *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 12695
diff changeset
  3649
     ST/X special notice:
18620
b4e9f25d6ce6 preparations for lined index list in WeakArray
Claus Gittinger <cg@exept.de>
parents: 18462
diff changeset
  3650
	returns an instance of MethodWhoInfo, which
b4e9f25d6ce6 preparations for lined index list in WeakArray
Claus Gittinger <cg@exept.de>
parents: 18462
diff changeset
  3651
	responds to #methodClass and #methodSelector query messages.
b4e9f25d6ce6 preparations for lined index list in WeakArray
Claus Gittinger <cg@exept.de>
parents: 18462
diff changeset
  3652
	For backward- (& ST-80) compatibility, the returned object also
b4e9f25d6ce6 preparations for lined index list in WeakArray
Claus Gittinger <cg@exept.de>
parents: 18462
diff changeset
  3653
	responds to #at:1 and #at:2 messages.
1851
4accc9fafd19 change #who to return a proper object
Claus Gittinger <cg@exept.de>
parents: 1813
diff changeset
  3654
4accc9fafd19 change #who to return a proper object
Claus Gittinger <cg@exept.de>
parents: 1813
diff changeset
  3655
     Implementation notice:
18620
b4e9f25d6ce6 preparations for lined index list in WeakArray
Claus Gittinger <cg@exept.de>
parents: 18462
diff changeset
  3656
	To avoid an expensive search, the once valid containing class is kept and remembered
b4e9f25d6ce6 preparations for lined index list in WeakArray
Claus Gittinger <cg@exept.de>
parents: 18462
diff changeset
  3657
	in the mclass slot. However, if a method gets recompiled or wrapped, the mclass field is
b4e9f25d6ce6 preparations for lined index list in WeakArray
Claus Gittinger <cg@exept.de>
parents: 18462
diff changeset
  3658
	no longer valid and who on the old method returns nil (because the method is actually no longer
b4e9f25d6ce6 preparations for lined index list in WeakArray
Claus Gittinger <cg@exept.de>
parents: 18462
diff changeset
  3659
	contained in that class). However, to allow easier unwrapping (and gathering of the corresponding
b4e9f25d6ce6 preparations for lined index list in WeakArray
Claus Gittinger <cg@exept.de>
parents: 18462
diff changeset
  3660
	wrapper), the mclass field is never nilled. I.e. it still refers to the original class.
b4e9f25d6ce6 preparations for lined index list in WeakArray
Claus Gittinger <cg@exept.de>
parents: 18462
diff changeset
  3661
	Therefore, a validation of the mclass slot is done here."
952
d600e08a5936 handle the case where a method has a sourceFileInfo, but the class has not
Claus Gittinger <cg@exept.de>
parents: 934
diff changeset
  3662
17250
a0d78c57d994 class: Method
Claus Gittinger <cg@exept.de>
parents: 17175
diff changeset
  3663
    |cls sel fn clsName checkBlock|
a0d78c57d994 class: Method
Claus Gittinger <cg@exept.de>
parents: 17175
diff changeset
  3664
5324
5c9959ce98af make use of mclass
Claus Gittinger <cg@exept.de>
parents: 5322
diff changeset
  3665
    mclass notNil ifTrue:[
18620
b4e9f25d6ce6 preparations for lined index list in WeakArray
Claus Gittinger <cg@exept.de>
parents: 18462
diff changeset
  3666
	"/ check if this (cached) info is still valid...
b4e9f25d6ce6 preparations for lined index list in WeakArray
Claus Gittinger <cg@exept.de>
parents: 18462
diff changeset
  3667
	sel := mclass selectorAtMethod:self.
b4e9f25d6ce6 preparations for lined index list in WeakArray
Claus Gittinger <cg@exept.de>
parents: 18462
diff changeset
  3668
	sel notNil ifTrue:[
b4e9f25d6ce6 preparations for lined index list in WeakArray
Claus Gittinger <cg@exept.de>
parents: 18462
diff changeset
  3669
	    ^ MethodWhoInfo class:mclass selector:sel
b4e9f25d6ce6 preparations for lined index list in WeakArray
Claus Gittinger <cg@exept.de>
parents: 18462
diff changeset
  3670
	].
b4e9f25d6ce6 preparations for lined index list in WeakArray
Claus Gittinger <cg@exept.de>
parents: 18462
diff changeset
  3671
	^ nil.
5324
5c9959ce98af make use of mclass
Claus Gittinger <cg@exept.de>
parents: 5322
diff changeset
  3672
    ].
5c9959ce98af make use of mclass
Claus Gittinger <cg@exept.de>
parents: 5322
diff changeset
  3673
18620
b4e9f25d6ce6 preparations for lined index list in WeakArray
Claus Gittinger <cg@exept.de>
parents: 18462
diff changeset
  3674
    checkBlock :=
b4e9f25d6ce6 preparations for lined index list in WeakArray
Claus Gittinger <cg@exept.de>
parents: 18462
diff changeset
  3675
	[:cls |
b4e9f25d6ce6 preparations for lined index list in WeakArray
Claus Gittinger <cg@exept.de>
parents: 18462
diff changeset
  3676
	    |sel|
b4e9f25d6ce6 preparations for lined index list in WeakArray
Claus Gittinger <cg@exept.de>
parents: 18462
diff changeset
  3677
b4e9f25d6ce6 preparations for lined index list in WeakArray
Claus Gittinger <cg@exept.de>
parents: 18462
diff changeset
  3678
	    sel := cls selectorAtMethod:self.
b4e9f25d6ce6 preparations for lined index list in WeakArray
Claus Gittinger <cg@exept.de>
parents: 18462
diff changeset
  3679
	    sel notNil ifTrue:[
b4e9f25d6ce6 preparations for lined index list in WeakArray
Claus Gittinger <cg@exept.de>
parents: 18462
diff changeset
  3680
		LastWhoClass := cls theNonMetaclass name.
b4e9f25d6ce6 preparations for lined index list in WeakArray
Claus Gittinger <cg@exept.de>
parents: 18462
diff changeset
  3681
		mclass := cls.
b4e9f25d6ce6 preparations for lined index list in WeakArray
Claus Gittinger <cg@exept.de>
parents: 18462
diff changeset
  3682
		^ MethodWhoInfo class:cls selector:sel
b4e9f25d6ce6 preparations for lined index list in WeakArray
Claus Gittinger <cg@exept.de>
parents: 18462
diff changeset
  3683
	    ].
b4e9f25d6ce6 preparations for lined index list in WeakArray
Claus Gittinger <cg@exept.de>
parents: 18462
diff changeset
  3684
	].
17250
a0d78c57d994 class: Method
Claus Gittinger <cg@exept.de>
parents: 17175
diff changeset
  3685
a0d78c57d994 class: Method
Claus Gittinger <cg@exept.de>
parents: 17175
diff changeset
  3686
    "
a0d78c57d994 class: Method
Claus Gittinger <cg@exept.de>
parents: 17175
diff changeset
  3687
     first, look in the class we found something the last time
a0d78c57d994 class: Method
Claus Gittinger <cg@exept.de>
parents: 17175
diff changeset
  3688
     this may often give a hit, when asking who repeatingly for
a0d78c57d994 class: Method
Claus Gittinger <cg@exept.de>
parents: 17175
diff changeset
  3689
     a context chain. (keep last by its name, to not keep classes from
a0d78c57d994 class: Method
Claus Gittinger <cg@exept.de>
parents: 17175
diff changeset
  3690
     being garbage collected)
a0d78c57d994 class: Method
Claus Gittinger <cg@exept.de>
parents: 17175
diff changeset
  3691
    "
a0d78c57d994 class: Method
Claus Gittinger <cg@exept.de>
parents: 17175
diff changeset
  3692
    LastWhoClass notNil ifTrue:[
18620
b4e9f25d6ce6 preparations for lined index list in WeakArray
Claus Gittinger <cg@exept.de>
parents: 18462
diff changeset
  3693
	cls := Smalltalk at:LastWhoClass ifAbsent:nil.
b4e9f25d6ce6 preparations for lined index list in WeakArray
Claus Gittinger <cg@exept.de>
parents: 18462
diff changeset
  3694
	cls notNil ifTrue:[
b4e9f25d6ce6 preparations for lined index list in WeakArray
Claus Gittinger <cg@exept.de>
parents: 18462
diff changeset
  3695
	    checkBlock value:cls theNonMetaclass.
b4e9f25d6ce6 preparations for lined index list in WeakArray
Claus Gittinger <cg@exept.de>
parents: 18462
diff changeset
  3696
	    checkBlock value:cls theMetaclass.
b4e9f25d6ce6 preparations for lined index list in WeakArray
Claus Gittinger <cg@exept.de>
parents: 18462
diff changeset
  3697
	]
6420
ba05391a71af *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6397
diff changeset
  3698
    ].
ba05391a71af *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6397
diff changeset
  3699
952
d600e08a5936 handle the case where a method has a sourceFileInfo, but the class has not
Claus Gittinger <cg@exept.de>
parents: 934
diff changeset
  3700
    "
5294
f2d689cf7be4 speedup #who (guess className from sourceFileName)
Claus Gittinger <cg@exept.de>
parents: 5284
diff changeset
  3701
     speedup kludge: if my sourceFileName is valid,
f2d689cf7be4 speedup #who (guess className from sourceFileName)
Claus Gittinger <cg@exept.de>
parents: 5284
diff changeset
  3702
     extract the className from it and try that class first.
f2d689cf7be4 speedup #who (guess className from sourceFileName)
Claus Gittinger <cg@exept.de>
parents: 5284
diff changeset
  3703
    "
f2d689cf7be4 speedup #who (guess className from sourceFileName)
Claus Gittinger <cg@exept.de>
parents: 5284
diff changeset
  3704
    (fn := self sourceFilename) notNil ifTrue:[
18620
b4e9f25d6ce6 preparations for lined index list in WeakArray
Claus Gittinger <cg@exept.de>
parents: 18462
diff changeset
  3705
	clsName := fn asFilename nameWithoutSuffix.
b4e9f25d6ce6 preparations for lined index list in WeakArray
Claus Gittinger <cg@exept.de>
parents: 18462
diff changeset
  3706
	clsName := clsName asSymbolIfInterned.
b4e9f25d6ce6 preparations for lined index list in WeakArray
Claus Gittinger <cg@exept.de>
parents: 18462
diff changeset
  3707
	clsName notNil ifTrue:[
b4e9f25d6ce6 preparations for lined index list in WeakArray
Claus Gittinger <cg@exept.de>
parents: 18462
diff changeset
  3708
	    cls := Smalltalk at:clsName ifAbsent:nil.
b4e9f25d6ce6 preparations for lined index list in WeakArray
Claus Gittinger <cg@exept.de>
parents: 18462
diff changeset
  3709
	    cls notNil ifTrue:[
b4e9f25d6ce6 preparations for lined index list in WeakArray
Claus Gittinger <cg@exept.de>
parents: 18462
diff changeset
  3710
		checkBlock value:cls theNonMetaclass.
b4e9f25d6ce6 preparations for lined index list in WeakArray
Claus Gittinger <cg@exept.de>
parents: 18462
diff changeset
  3711
		checkBlock value:cls theMetaclass.
b4e9f25d6ce6 preparations for lined index list in WeakArray
Claus Gittinger <cg@exept.de>
parents: 18462
diff changeset
  3712
	    ]
b4e9f25d6ce6 preparations for lined index list in WeakArray
Claus Gittinger <cg@exept.de>
parents: 18462
diff changeset
  3713
	].
5294
f2d689cf7be4 speedup #who (guess className from sourceFileName)
Claus Gittinger <cg@exept.de>
parents: 5284
diff changeset
  3714
    ].
f2d689cf7be4 speedup #who (guess className from sourceFileName)
Claus Gittinger <cg@exept.de>
parents: 5284
diff changeset
  3715
f2d689cf7be4 speedup #who (guess className from sourceFileName)
Claus Gittinger <cg@exept.de>
parents: 5284
diff changeset
  3716
    "
17250
a0d78c57d994 class: Method
Claus Gittinger <cg@exept.de>
parents: 17175
diff changeset
  3717
     limit the search to global classes only -
952
d600e08a5936 handle the case where a method has a sourceFileInfo, but the class has not
Claus Gittinger <cg@exept.de>
parents: 934
diff changeset
  3718
     since probability is high, that the receiver is found in there ...
d600e08a5936 handle the case where a method has a sourceFileInfo, but the class has not
Claus Gittinger <cg@exept.de>
parents: 934
diff changeset
  3719
    "
17250
a0d78c57d994 class: Method
Claus Gittinger <cg@exept.de>
parents: 17175
diff changeset
  3720
    Smalltalk allClassesDo:[:cls |
18620
b4e9f25d6ce6 preparations for lined index list in WeakArray
Claus Gittinger <cg@exept.de>
parents: 18462
diff changeset
  3721
	checkBlock value:cls theNonMetaclass.
b4e9f25d6ce6 preparations for lined index list in WeakArray
Claus Gittinger <cg@exept.de>
parents: 18462
diff changeset
  3722
	checkBlock value:cls theMetaclass.
142
c7844287bddf *** empty log message ***
claus
parents: 109
diff changeset
  3723
    ].
952
d600e08a5936 handle the case where a method has a sourceFileInfo, but the class has not
Claus Gittinger <cg@exept.de>
parents: 934
diff changeset
  3724
d600e08a5936 handle the case where a method has a sourceFileInfo, but the class has not
Claus Gittinger <cg@exept.de>
parents: 934
diff changeset
  3725
    LastWhoClass := nil.
6397
311358bdeed6 do not search for anonymous classes in #who
Claus Gittinger <cg@exept.de>
parents: 6365
diff changeset
  3726
"/    "
311358bdeed6 do not search for anonymous classes in #who
Claus Gittinger <cg@exept.de>
parents: 6365
diff changeset
  3727
"/     mhmh - must be a method of some anonymous class (i.e. one not
311358bdeed6 do not search for anonymous classes in #who
Claus Gittinger <cg@exept.de>
parents: 6365
diff changeset
  3728
"/     in the Smalltalk dictionary). Search all instances of Behavior
311358bdeed6 do not search for anonymous classes in #who
Claus Gittinger <cg@exept.de>
parents: 6365
diff changeset
  3729
"/    "
6420
ba05391a71af *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6397
diff changeset
  3730
"/    Behavior allSubInstancesDo:[:someClassLikeThingy |
ba05391a71af *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6397
diff changeset
  3731
"/        (classes includes:someClassLikeThingy) ifFalse:[
ba05391a71af *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6397
diff changeset
  3732
"/            checkBlock value:someClassLikeThingy.
6397
311358bdeed6 do not search for anonymous classes in #who
Claus Gittinger <cg@exept.de>
parents: 6365
diff changeset
  3733
"/        ]
311358bdeed6 do not search for anonymous classes in #who
Claus Gittinger <cg@exept.de>
parents: 6365
diff changeset
  3734
"/    ].
952
d600e08a5936 handle the case where a method has a sourceFileInfo, but the class has not
Claus Gittinger <cg@exept.de>
parents: 934
diff changeset
  3735
    "
d600e08a5936 handle the case where a method has a sourceFileInfo, but the class has not
Claus Gittinger <cg@exept.de>
parents: 934
diff changeset
  3736
     none found - sorry
d600e08a5936 handle the case where a method has a sourceFileInfo, but the class has not
Claus Gittinger <cg@exept.de>
parents: 934
diff changeset
  3737
    "
d600e08a5936 handle the case where a method has a sourceFileInfo, but the class has not
Claus Gittinger <cg@exept.de>
parents: 934
diff changeset
  3738
    ^ nil
444
071b4f32272c *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 443
diff changeset
  3739
952
d600e08a5936 handle the case where a method has a sourceFileInfo, but the class has not
Claus Gittinger <cg@exept.de>
parents: 934
diff changeset
  3740
    "typical situation: some well-known class"
d600e08a5936 handle the case where a method has a sourceFileInfo, but the class has not
Claus Gittinger <cg@exept.de>
parents: 934
diff changeset
  3741
    "
d600e08a5936 handle the case where a method has a sourceFileInfo, but the class has not
Claus Gittinger <cg@exept.de>
parents: 934
diff changeset
  3742
     |m|
d600e08a5936 handle the case where a method has a sourceFileInfo, but the class has not
Claus Gittinger <cg@exept.de>
parents: 934
diff changeset
  3743
     m := Object compiledMethodAt:#copy.
d600e08a5936 handle the case where a method has a sourceFileInfo, but the class has not
Claus Gittinger <cg@exept.de>
parents: 934
diff changeset
  3744
     m who
d600e08a5936 handle the case where a method has a sourceFileInfo, but the class has not
Claus Gittinger <cg@exept.de>
parents: 934
diff changeset
  3745
    "
d600e08a5936 handle the case where a method has a sourceFileInfo, but the class has not
Claus Gittinger <cg@exept.de>
parents: 934
diff changeset
  3746
d600e08a5936 handle the case where a method has a sourceFileInfo, but the class has not
Claus Gittinger <cg@exept.de>
parents: 934
diff changeset
  3747
    "untypical situation: an anonymous class"
d600e08a5936 handle the case where a method has a sourceFileInfo, but the class has not
Claus Gittinger <cg@exept.de>
parents: 934
diff changeset
  3748
    "
d600e08a5936 handle the case where a method has a sourceFileInfo, but the class has not
Claus Gittinger <cg@exept.de>
parents: 934
diff changeset
  3749
     |m cls|
444
071b4f32272c *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 443
diff changeset
  3750
12854
3a3d3c02c3bd *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 12695
diff changeset
  3751
     Object
18620
b4e9f25d6ce6 preparations for lined index list in WeakArray
Claus Gittinger <cg@exept.de>
parents: 18462
diff changeset
  3752
	subclass:#FunnyClass
b4e9f25d6ce6 preparations for lined index list in WeakArray
Claus Gittinger <cg@exept.de>
parents: 18462
diff changeset
  3753
	instanceVariableNames:'foo'
b4e9f25d6ce6 preparations for lined index list in WeakArray
Claus Gittinger <cg@exept.de>
parents: 18462
diff changeset
  3754
	classVariableNames:''
b4e9f25d6ce6 preparations for lined index list in WeakArray
Claus Gittinger <cg@exept.de>
parents: 18462
diff changeset
  3755
	poolDictionaries:''
b4e9f25d6ce6 preparations for lined index list in WeakArray
Claus Gittinger <cg@exept.de>
parents: 18462
diff changeset
  3756
	category:'testing'.
952
d600e08a5936 handle the case where a method has a sourceFileInfo, but the class has not
Claus Gittinger <cg@exept.de>
parents: 934
diff changeset
  3757
     cls := Smalltalk at:#FunnyClass.
d600e08a5936 handle the case where a method has a sourceFileInfo, but the class has not
Claus Gittinger <cg@exept.de>
parents: 934
diff changeset
  3758
     Smalltalk removeClass:cls.
444
071b4f32272c *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 443
diff changeset
  3759
952
d600e08a5936 handle the case where a method has a sourceFileInfo, but the class has not
Claus Gittinger <cg@exept.de>
parents: 934
diff changeset
  3760
     cls compile:'testMethod1:arg foo:=arg'.
d600e08a5936 handle the case where a method has a sourceFileInfo, but the class has not
Claus Gittinger <cg@exept.de>
parents: 934
diff changeset
  3761
     cls compile:'testMethod2 ^ foo'.
d600e08a5936 handle the case where a method has a sourceFileInfo, but the class has not
Claus Gittinger <cg@exept.de>
parents: 934
diff changeset
  3762
     m := cls compiledMethodAt:#testMethod1:.
d600e08a5936 handle the case where a method has a sourceFileInfo, but the class has not
Claus Gittinger <cg@exept.de>
parents: 934
diff changeset
  3763
d600e08a5936 handle the case where a method has a sourceFileInfo, but the class has not
Claus Gittinger <cg@exept.de>
parents: 934
diff changeset
  3764
     m who
d600e08a5936 handle the case where a method has a sourceFileInfo, but the class has not
Claus Gittinger <cg@exept.de>
parents: 934
diff changeset
  3765
    "
1851
4accc9fafd19 change #who to return a proper object
Claus Gittinger <cg@exept.de>
parents: 1813
diff changeset
  3766
10156
d35f30a7fde5 changed #who
Claus Gittinger <cg@exept.de>
parents: 10083
diff changeset
  3767
    "Modified: / 07-11-2006 / 13:58:50 / cg"
68
59faa75185ba *** empty log message ***
claus
parents: 56
diff changeset
  3768
!
59faa75185ba *** empty log message ***
claus
parents: 56
diff changeset
  3769
952
d600e08a5936 handle the case where a method has a sourceFileInfo, but the class has not
Claus Gittinger <cg@exept.de>
parents: 934
diff changeset
  3770
wrapper
d600e08a5936 handle the case where a method has a sourceFileInfo, but the class has not
Claus Gittinger <cg@exept.de>
parents: 934
diff changeset
  3771
    "only for wrapped methods: return the wrapper.
14419
eef0be88cb60 comment/format in: #wrapper
Claus Gittinger <cg@exept.de>
parents: 14402
diff changeset
  3772
     That's the WrapperMethod which contains myself."
159
514c749165c3 *** empty log message ***
claus
parents: 142
diff changeset
  3773
13847
c1552e51c27a changed: #wrapper
Claus Gittinger <cg@exept.de>
parents: 13817
diff changeset
  3774
    WrappedMethod notNil ifTrue:[
18620
b4e9f25d6ce6 preparations for lined index list in WeakArray
Claus Gittinger <cg@exept.de>
parents: 18462
diff changeset
  3775
	WrappedMethod allInstancesDo:[:m |
b4e9f25d6ce6 preparations for lined index list in WeakArray
Claus Gittinger <cg@exept.de>
parents: 18462
diff changeset
  3776
	    m originalMethod == self ifTrue:[^ m].
b4e9f25d6ce6 preparations for lined index list in WeakArray
Claus Gittinger <cg@exept.de>
parents: 18462
diff changeset
  3777
	].
952
d600e08a5936 handle the case where a method has a sourceFileInfo, but the class has not
Claus Gittinger <cg@exept.de>
parents: 934
diff changeset
  3778
    ].
d600e08a5936 handle the case where a method has a sourceFileInfo, but the class has not
Claus Gittinger <cg@exept.de>
parents: 934
diff changeset
  3779
    ^ nil
13847
c1552e51c27a changed: #wrapper
Claus Gittinger <cg@exept.de>
parents: 13817
diff changeset
  3780
c1552e51c27a changed: #wrapper
Claus Gittinger <cg@exept.de>
parents: 13817
diff changeset
  3781
    "Modified: / 05-12-2011 / 11:15:26 / cg"
5564
0f513f04c50f #readsFields: and #writesField: for st80 compatibility
Claus Gittinger <cg@exept.de>
parents: 5562
diff changeset
  3782
!
0f513f04c50f #readsFields: and #writesField: for st80 compatibility
Claus Gittinger <cg@exept.de>
parents: 5562
diff changeset
  3783
0f513f04c50f #readsFields: and #writesField: for st80 compatibility
Claus Gittinger <cg@exept.de>
parents: 5562
diff changeset
  3784
writesField:instVarIndex
0f513f04c50f #readsFields: and #writesField: for st80 compatibility
Claus Gittinger <cg@exept.de>
parents: 5562
diff changeset
  3785
    "return true, if the instvar at instVarIndex is written (modified) by the receiver.
0f513f04c50f #readsFields: and #writesField: for st80 compatibility
Claus Gittinger <cg@exept.de>
parents: 5562
diff changeset
  3786
     Uses parser (for now); could look at bytecode as well here..."
0f513f04c50f #readsFields: and #writesField: for st80 compatibility
Claus Gittinger <cg@exept.de>
parents: 5562
diff changeset
  3787
14237
Claus Gittinger <cg@exept.de>
parents: 14236
diff changeset
  3788
    |instVarName|
Claus Gittinger <cg@exept.de>
parents: 14236
diff changeset
  3789
Claus Gittinger <cg@exept.de>
parents: 14236
diff changeset
  3790
    instVarName := (self mclass allInstVarNames) at:instVarIndex.
Claus Gittinger <cg@exept.de>
parents: 14236
diff changeset
  3791
    ^ self writesInstVar:instVarName
Claus Gittinger <cg@exept.de>
parents: 14236
diff changeset
  3792
Claus Gittinger <cg@exept.de>
parents: 14236
diff changeset
  3793
    "Modified: / 23-07-2012 / 11:16:51 / cg"
Claus Gittinger <cg@exept.de>
parents: 14236
diff changeset
  3794
!
Claus Gittinger <cg@exept.de>
parents: 14236
diff changeset
  3795
Claus Gittinger <cg@exept.de>
parents: 14236
diff changeset
  3796
writesInstVar:instVarName
Claus Gittinger <cg@exept.de>
parents: 14236
diff changeset
  3797
    "return true, if the named instvar is written (modified) by the receiver.
Claus Gittinger <cg@exept.de>
parents: 14236
diff changeset
  3798
     Uses parser (for now); could look at bytecode as well here..."
Claus Gittinger <cg@exept.de>
parents: 14236
diff changeset
  3799
Claus Gittinger <cg@exept.de>
parents: 14236
diff changeset
  3800
    |modifiedInstVars|
Claus Gittinger <cg@exept.de>
parents: 14236
diff changeset
  3801
Claus Gittinger <cg@exept.de>
parents: 14236
diff changeset
  3802
    (self source includesString:instVarName) ifFalse:[^ false].     "/ that's much faster than parsing...
5636
eab6a71fb3d0 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5634
diff changeset
  3803
    modifiedInstVars := self parse:#'parseMethodSilent:in:' with:self mclass return:#modifiedInstVars or:#().
14237
Claus Gittinger <cg@exept.de>
parents: 14236
diff changeset
  3804
    ^ modifiedInstVars includes:instVarName.
Claus Gittinger <cg@exept.de>
parents: 14236
diff changeset
  3805
Claus Gittinger <cg@exept.de>
parents: 14236
diff changeset
  3806
    "Created: / 23-07-2012 / 11:16:36 / cg"
952
d600e08a5936 handle the case where a method has a sourceFileInfo, but the class has not
Claus Gittinger <cg@exept.de>
parents: 934
diff changeset
  3807
! !
13
62303f84ff5f *** empty log message ***
claus
parents: 10
diff changeset
  3808
14863
49e50305f097 class: Method
Claus Gittinger <cg@exept.de>
parents: 14595
diff changeset
  3809
!Method methodsFor:'source management'!
49e50305f097 class: Method
Claus Gittinger <cg@exept.de>
parents: 14595
diff changeset
  3810
49e50305f097 class: Method
Claus Gittinger <cg@exept.de>
parents: 14595
diff changeset
  3811
revisionInfo
17402
821369b223e8 class: Method
Claus Gittinger <cg@exept.de>
parents: 17361
diff changeset
  3812
    "cg: is this correct for extensions? (shouldn't this be the revisionInfo from the extensions container?)"
14863
49e50305f097 class: Method
Claus Gittinger <cg@exept.de>
parents: 14595
diff changeset
  3813
49e50305f097 class: Method
Claus Gittinger <cg@exept.de>
parents: 14595
diff changeset
  3814
    ^self containingClass theNonMetaclass revisionInfo
49e50305f097 class: Method
Claus Gittinger <cg@exept.de>
parents: 14595
diff changeset
  3815
49e50305f097 class: Method
Claus Gittinger <cg@exept.de>
parents: 14595
diff changeset
  3816
    "Created: / 28-08-2010 / 22:43:57 / Jan Vrany <jan.vrany@fit.cvut.cz>"
49e50305f097 class: Method
Claus Gittinger <cg@exept.de>
parents: 14595
diff changeset
  3817
    "Modified: / 12-09-2010 / 16:38:55 / Jan Vrany <jan.vrany@fit.cvut.cz>"
49e50305f097 class: Method
Claus Gittinger <cg@exept.de>
parents: 14595
diff changeset
  3818
! !
49e50305f097 class: Method
Claus Gittinger <cg@exept.de>
parents: 14595
diff changeset
  3819
23742
8c13145174f2 #DOCUMENTATION by cg
Claus Gittinger <cg@exept.de>
parents: 23316
diff changeset
  3820
!Method methodsFor:'testing'!
8c13145174f2 #DOCUMENTATION by cg
Claus Gittinger <cg@exept.de>
parents: 23316
diff changeset
  3821
8c13145174f2 #DOCUMENTATION by cg
Claus Gittinger <cg@exept.de>
parents: 23316
diff changeset
  3822
isMethodWithBreakpoints
8c13145174f2 #DOCUMENTATION by cg
Claus Gittinger <cg@exept.de>
parents: 23316
diff changeset
  3823
    "only redefined in MethodWithBreakpoints"
8c13145174f2 #DOCUMENTATION by cg
Claus Gittinger <cg@exept.de>
parents: 23316
diff changeset
  3824
8c13145174f2 #DOCUMENTATION by cg
Claus Gittinger <cg@exept.de>
parents: 23316
diff changeset
  3825
    ^ false
8c13145174f2 #DOCUMENTATION by cg
Claus Gittinger <cg@exept.de>
parents: 23316
diff changeset
  3826
8c13145174f2 #DOCUMENTATION by cg
Claus Gittinger <cg@exept.de>
parents: 23316
diff changeset
  3827
    "Created: / 01-08-2012 / 17:26:43 / cg"
8c13145174f2 #DOCUMENTATION by cg
Claus Gittinger <cg@exept.de>
parents: 23316
diff changeset
  3828
! !
8c13145174f2 #DOCUMENTATION by cg
Claus Gittinger <cg@exept.de>
parents: 23316
diff changeset
  3829
952
d600e08a5936 handle the case where a method has a sourceFileInfo, but the class has not
Claus Gittinger <cg@exept.de>
parents: 934
diff changeset
  3830
!Method methodsFor:'trap methods'!
13
62303f84ff5f *** empty log message ***
claus
parents: 10
diff changeset
  3831
952
d600e08a5936 handle the case where a method has a sourceFileInfo, but the class has not
Claus Gittinger <cg@exept.de>
parents: 934
diff changeset
  3832
makeInvalid
d600e08a5936 handle the case where a method has a sourceFileInfo, but the class has not
Claus Gittinger <cg@exept.de>
parents: 934
diff changeset
  3833
    "make the receiver an invalid method, which raises an invalidCodeObject
d600e08a5936 handle the case where a method has a sourceFileInfo, but the class has not
Claus Gittinger <cg@exept.de>
parents: 934
diff changeset
  3834
     signal when executed. This is not for public use - it is required for
d600e08a5936 handle the case where a method has a sourceFileInfo, but the class has not
Claus Gittinger <cg@exept.de>
parents: 934
diff changeset
  3835
     the objectFileLoader to invalidate methods whose code is unloaded."
1
a27a279701f8 Initial revision
claus
parents:
diff changeset
  3836
952
d600e08a5936 handle the case where a method has a sourceFileInfo, but the class has not
Claus Gittinger <cg@exept.de>
parents: 934
diff changeset
  3837
    |invldMethod|
159
514c749165c3 *** empty log message ***
claus
parents: 142
diff changeset
  3838
18438
0655839a70f8 class: Method
Stefan Vogel <sv@exept.de>
parents: 18431
diff changeset
  3839
    invldMethod := self trapMethodForNumArgs:(self argumentCount).
952
d600e08a5936 handle the case where a method has a sourceFileInfo, but the class has not
Claus Gittinger <cg@exept.de>
parents: 934
diff changeset
  3840
    self code:invldMethod code.
1873
3544a4a94a2a checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1870
diff changeset
  3841
    self byteCode:nil.
952
d600e08a5936 handle the case where a method has a sourceFileInfo, but the class has not
Claus Gittinger <cg@exept.de>
parents: 934
diff changeset
  3842
d600e08a5936 handle the case where a method has a sourceFileInfo, but the class has not
Claus Gittinger <cg@exept.de>
parents: 934
diff changeset
  3843
    "Created: 17.9.1995 / 15:00:52 / claus"
1873
3544a4a94a2a checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1870
diff changeset
  3844
    "Modified: 4.11.1996 / 23:04:34 / cg"
1
a27a279701f8 Initial revision
claus
parents:
diff changeset
  3845
!
a27a279701f8 Initial revision
claus
parents:
diff changeset
  3846
952
d600e08a5936 handle the case where a method has a sourceFileInfo, but the class has not
Claus Gittinger <cg@exept.de>
parents: 934
diff changeset
  3847
makeUncompiled
d600e08a5936 handle the case where a method has a sourceFileInfo, but the class has not
Claus Gittinger <cg@exept.de>
parents: 934
diff changeset
  3848
    "make the receiver an uncompiled method, which raises an invalidCodeObject
d600e08a5936 handle the case where a method has a sourceFileInfo, but the class has not
Claus Gittinger <cg@exept.de>
parents: 934
diff changeset
  3849
     signal when executed. This is not for public use - it is required for
d600e08a5936 handle the case where a method has a sourceFileInfo, but the class has not
Claus Gittinger <cg@exept.de>
parents: 934
diff changeset
  3850
     the compiler to invalidate methods which cannot be compiled due to errors
d600e08a5936 handle the case where a method has a sourceFileInfo, but the class has not
Claus Gittinger <cg@exept.de>
parents: 934
diff changeset
  3851
     after a class definition change (for example: instvars are no longer there)."
1
a27a279701f8 Initial revision
claus
parents:
diff changeset
  3852
952
d600e08a5936 handle the case where a method has a sourceFileInfo, but the class has not
Claus Gittinger <cg@exept.de>
parents: 934
diff changeset
  3853
    |invldMethod|
872
af04035b443d binary class storage support
Claus Gittinger <cg@exept.de>
parents: 829
diff changeset
  3854
21692
8d846eeca979 #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 21581
diff changeset
  3855
    invldMethod := Method compiledMethodAt:#uncompiledCodeObject.
952
d600e08a5936 handle the case where a method has a sourceFileInfo, but the class has not
Claus Gittinger <cg@exept.de>
parents: 934
diff changeset
  3856
    self code:invldMethod code.
1873
3544a4a94a2a checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1870
diff changeset
  3857
    self byteCode:nil.
952
d600e08a5936 handle the case where a method has a sourceFileInfo, but the class has not
Claus Gittinger <cg@exept.de>
parents: 934
diff changeset
  3858
21692
8d846eeca979 #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 21581
diff changeset
  3859
    "Created: / 17-09-1995 / 15:01:14 / claus"
8d846eeca979 #BUGFIX by cg
Claus Gittinger <cg@exept.de>
parents: 21581
diff changeset
  3860
    "Modified: / 10-04-2017 / 22:50:21 / cg"
1873
3544a4a94a2a checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1870
diff changeset
  3861
!
3544a4a94a2a checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1870
diff changeset
  3862
3544a4a94a2a checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1870
diff changeset
  3863
makeUnloaded
3544a4a94a2a checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1870
diff changeset
  3864
    "make the receiver an unloaded method, which raises an invalidCodeObject
3544a4a94a2a checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1870
diff changeset
  3865
     signal when executed. This is not for public use - it is required for
3544a4a94a2a checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1870
diff changeset
  3866
     the objectFileLoader to invalidate methods for which a shared library has
3544a4a94a2a checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1870
diff changeset
  3867
     been removed."
3544a4a94a2a checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1870
diff changeset
  3868
3544a4a94a2a checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1870
diff changeset
  3869
    |invldMethod|
3544a4a94a2a checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1870
diff changeset
  3870
3544a4a94a2a checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1870
diff changeset
  3871
    invldMethod := self class compiledMethodAt:#unloadedCodeObject.
3544a4a94a2a checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1870
diff changeset
  3872
    self code:invldMethod code.
3544a4a94a2a checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1870
diff changeset
  3873
    self byteCode:nil.
3544a4a94a2a checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1870
diff changeset
  3874
3544a4a94a2a checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1870
diff changeset
  3875
    "Created: 4.11.1996 / 22:59:21 / cg"
3544a4a94a2a checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1870
diff changeset
  3876
    "Modified: 4.11.1996 / 23:04:52 / cg"
1870
2623b60c27e1 lifted numVars; added access for invalidCodeObject-trappers
Claus Gittinger <cg@exept.de>
parents: 1855
diff changeset
  3877
!
2623b60c27e1 lifted numVars; added access for invalidCodeObject-trappers
Claus Gittinger <cg@exept.de>
parents: 1855
diff changeset
  3878
2623b60c27e1 lifted numVars; added access for invalidCodeObject-trappers
Claus Gittinger <cg@exept.de>
parents: 1855
diff changeset
  3879
trapMethodForNumArgs:numArgs
13657
206c6696707b added: #trapMethodForNumArgs:
Claus Gittinger <cg@exept.de>
parents: 13651
diff changeset
  3880
    ^ self class trapMethodForNumArgs:numArgs
206c6696707b added: #trapMethodForNumArgs:
Claus Gittinger <cg@exept.de>
parents: 13651
diff changeset
  3881
206c6696707b added: #trapMethodForNumArgs:
Claus Gittinger <cg@exept.de>
parents: 13651
diff changeset
  3882
    "Created: / 04-11-1996 / 21:58:58 / cg"
206c6696707b added: #trapMethodForNumArgs:
Claus Gittinger <cg@exept.de>
parents: 13651
diff changeset
  3883
    "Modified: / 08-09-2011 / 05:35:48 / cg"
952
d600e08a5936 handle the case where a method has a sourceFileInfo, but the class has not
Claus Gittinger <cg@exept.de>
parents: 934
diff changeset
  3884
! !
872
af04035b443d binary class storage support
Claus Gittinger <cg@exept.de>
parents: 829
diff changeset
  3885
2022
24529e2b7cee commentary for MethodWhoInfo
Claus Gittinger <cg@exept.de>
parents: 1995
diff changeset
  3886
!Method::MethodWhoInfo class methodsFor:'documentation'!
24529e2b7cee commentary for MethodWhoInfo
Claus Gittinger <cg@exept.de>
parents: 1995
diff changeset
  3887
24529e2b7cee commentary for MethodWhoInfo
Claus Gittinger <cg@exept.de>
parents: 1995
diff changeset
  3888
documentation
24529e2b7cee commentary for MethodWhoInfo
Claus Gittinger <cg@exept.de>
parents: 1995
diff changeset
  3889
"
24529e2b7cee commentary for MethodWhoInfo
Claus Gittinger <cg@exept.de>
parents: 1995
diff changeset
  3890
    In earlier times, Method>>who returned an array filled
22372
72db331204d4 #DOCUMENTATION by cg
Claus Gittinger <cg@exept.de>
parents: 22188
diff changeset
  3891
    with the method's class and selector.
2022
24529e2b7cee commentary for MethodWhoInfo
Claus Gittinger <cg@exept.de>
parents: 1995
diff changeset
  3892
    This was done, since a smalltalk method cannot return multiple
24529e2b7cee commentary for MethodWhoInfo
Claus Gittinger <cg@exept.de>
parents: 1995
diff changeset
  3893
    values, but 2 values had to be returned from that method.
24529e2b7cee commentary for MethodWhoInfo
Claus Gittinger <cg@exept.de>
parents: 1995
diff changeset
  3894
    Thus, the who-interface was used as:
22372
72db331204d4 #DOCUMENTATION by cg
Claus Gittinger <cg@exept.de>
parents: 22188
diff changeset
  3895
        info := <someMethod> who.
72db331204d4 #DOCUMENTATION by cg
Claus Gittinger <cg@exept.de>
parents: 22188
diff changeset
  3896
        class := info at:1.
72db331204d4 #DOCUMENTATION by cg
Claus Gittinger <cg@exept.de>
parents: 22188
diff changeset
  3897
        sel := info at:2.
2022
24529e2b7cee commentary for MethodWhoInfo
Claus Gittinger <cg@exept.de>
parents: 1995
diff changeset
  3898
24529e2b7cee commentary for MethodWhoInfo
Claus Gittinger <cg@exept.de>
parents: 1995
diff changeset
  3899
    Sure, this is ugly coding style, and the system has been changed to return
24529e2b7cee commentary for MethodWhoInfo
Claus Gittinger <cg@exept.de>
parents: 1995
diff changeset
  3900
    an object (an instance of MethodWhoInfo) which responds to the two
24529e2b7cee commentary for MethodWhoInfo
Claus Gittinger <cg@exept.de>
parents: 1995
diff changeset
  3901
    messages: #methodClass and #methodSelector.
24529e2b7cee commentary for MethodWhoInfo
Claus Gittinger <cg@exept.de>
parents: 1995
diff changeset
  3902
    This allows to write things much more intuitive:
22372
72db331204d4 #DOCUMENTATION by cg
Claus Gittinger <cg@exept.de>
parents: 22188
diff changeset
  3903
        info := <someMethod> who.
72db331204d4 #DOCUMENTATION by cg
Claus Gittinger <cg@exept.de>
parents: 22188
diff changeset
  3904
        class := info methodClass.
72db331204d4 #DOCUMENTATION by cg
Claus Gittinger <cg@exept.de>
parents: 22188
diff changeset
  3905
        sel := info methodSelector.
2022
24529e2b7cee commentary for MethodWhoInfo
Claus Gittinger <cg@exept.de>
parents: 1995
diff changeset
  3906
24529e2b7cee commentary for MethodWhoInfo
Claus Gittinger <cg@exept.de>
parents: 1995
diff changeset
  3907
    However, to be backward compatible, the returned object still responds to
24529e2b7cee commentary for MethodWhoInfo
Claus Gittinger <cg@exept.de>
parents: 1995
diff changeset
  3908
    the #at: message, but only allows inices of 1 and 2 to be used.
24529e2b7cee commentary for MethodWhoInfo
Claus Gittinger <cg@exept.de>
parents: 1995
diff changeset
  3909
24529e2b7cee commentary for MethodWhoInfo
Claus Gittinger <cg@exept.de>
parents: 1995
diff changeset
  3910
    The MethodWhoInfo class is private to Method - its not visible to other
24529e2b7cee commentary for MethodWhoInfo
Claus Gittinger <cg@exept.de>
parents: 1995
diff changeset
  3911
    classes.
2242
5037033b8002 commentary
Claus Gittinger <cg@exept.de>
parents: 2218
diff changeset
  3912
5037033b8002 commentary
Claus Gittinger <cg@exept.de>
parents: 2218
diff changeset
  3913
    [author:]
22372
72db331204d4 #DOCUMENTATION by cg
Claus Gittinger <cg@exept.de>
parents: 22188
diff changeset
  3914
        Claus Gittinger
2242
5037033b8002 commentary
Claus Gittinger <cg@exept.de>
parents: 2218
diff changeset
  3915
5037033b8002 commentary
Claus Gittinger <cg@exept.de>
parents: 2218
diff changeset
  3916
    [see also:]
22372
72db331204d4 #DOCUMENTATION by cg
Claus Gittinger <cg@exept.de>
parents: 22188
diff changeset
  3917
        Method
2022
24529e2b7cee commentary for MethodWhoInfo
Claus Gittinger <cg@exept.de>
parents: 1995
diff changeset
  3918
"
24529e2b7cee commentary for MethodWhoInfo
Claus Gittinger <cg@exept.de>
parents: 1995
diff changeset
  3919
! !
24529e2b7cee commentary for MethodWhoInfo
Claus Gittinger <cg@exept.de>
parents: 1995
diff changeset
  3920
1851
4accc9fafd19 change #who to return a proper object
Claus Gittinger <cg@exept.de>
parents: 1813
diff changeset
  3921
!Method::MethodWhoInfo class methodsFor:'instance creation'!
4accc9fafd19 change #who to return a proper object
Claus Gittinger <cg@exept.de>
parents: 1813
diff changeset
  3922
4accc9fafd19 change #who to return a proper object
Claus Gittinger <cg@exept.de>
parents: 1813
diff changeset
  3923
class:cls selector:sel
2023
4c6416d1a54d checkin from browser
Claus Gittinger <cg@exept.de>
parents: 2022
diff changeset
  3924
    "return a new MethodWhoInfo object;
4c6416d1a54d checkin from browser
Claus Gittinger <cg@exept.de>
parents: 2022
diff changeset
  3925
     this is a private interface for Method"
4c6416d1a54d checkin from browser
Claus Gittinger <cg@exept.de>
parents: 2022
diff changeset
  3926
1851
4accc9fafd19 change #who to return a proper object
Claus Gittinger <cg@exept.de>
parents: 1813
diff changeset
  3927
    ^ self basicNew class:cls selector:sel
2023
4c6416d1a54d checkin from browser
Claus Gittinger <cg@exept.de>
parents: 2022
diff changeset
  3928
4c6416d1a54d checkin from browser
Claus Gittinger <cg@exept.de>
parents: 2022
diff changeset
  3929
    "Modified: 2.1.1997 / 15:27:59 / cg"
1851
4accc9fafd19 change #who to return a proper object
Claus Gittinger <cg@exept.de>
parents: 1813
diff changeset
  3930
! !
4accc9fafd19 change #who to return a proper object
Claus Gittinger <cg@exept.de>
parents: 1813
diff changeset
  3931
4accc9fafd19 change #who to return a proper object
Claus Gittinger <cg@exept.de>
parents: 1813
diff changeset
  3932
!Method::MethodWhoInfo methodsFor:'accessing'!
4accc9fafd19 change #who to return a proper object
Claus Gittinger <cg@exept.de>
parents: 1813
diff changeset
  3933
4669
828addb1c376 source code access - care for package different from my classes
Claus Gittinger <cg@exept.de>
parents: 4595
diff changeset
  3934
method
828addb1c376 source code access - care for package different from my classes
Claus Gittinger <cg@exept.de>
parents: 4595
diff changeset
  3935
    ^ myClass compiledMethodAt:mySelector
828addb1c376 source code access - care for package different from my classes
Claus Gittinger <cg@exept.de>
parents: 4595
diff changeset
  3936
!
828addb1c376 source code access - care for package different from my classes
Claus Gittinger <cg@exept.de>
parents: 4595
diff changeset
  3937
1851
4accc9fafd19 change #who to return a proper object
Claus Gittinger <cg@exept.de>
parents: 1813
diff changeset
  3938
methodClass
2022
24529e2b7cee commentary for MethodWhoInfo
Claus Gittinger <cg@exept.de>
parents: 1995
diff changeset
  3939
    "return the class which contains the method represented by myself"
24529e2b7cee commentary for MethodWhoInfo
Claus Gittinger <cg@exept.de>
parents: 1995
diff changeset
  3940
1851
4accc9fafd19 change #who to return a proper object
Claus Gittinger <cg@exept.de>
parents: 1813
diff changeset
  3941
    ^ myClass
2022
24529e2b7cee commentary for MethodWhoInfo
Claus Gittinger <cg@exept.de>
parents: 1995
diff changeset
  3942
24529e2b7cee commentary for MethodWhoInfo
Claus Gittinger <cg@exept.de>
parents: 1995
diff changeset
  3943
    "
24529e2b7cee commentary for MethodWhoInfo
Claus Gittinger <cg@exept.de>
parents: 1995
diff changeset
  3944
     (Method compiledMethodAt:#who) who methodClass
24529e2b7cee commentary for MethodWhoInfo
Claus Gittinger <cg@exept.de>
parents: 1995
diff changeset
  3945
     (Method::MethodWhoInfo compiledMethodAt:#methodClass) who methodClass
24529e2b7cee commentary for MethodWhoInfo
Claus Gittinger <cg@exept.de>
parents: 1995
diff changeset
  3946
    "
24529e2b7cee commentary for MethodWhoInfo
Claus Gittinger <cg@exept.de>
parents: 1995
diff changeset
  3947
24529e2b7cee commentary for MethodWhoInfo
Claus Gittinger <cg@exept.de>
parents: 1995
diff changeset
  3948
    "Modified: 2.1.1997 / 14:59:02 / cg"
1851
4accc9fafd19 change #who to return a proper object
Claus Gittinger <cg@exept.de>
parents: 1813
diff changeset
  3949
!
4accc9fafd19 change #who to return a proper object
Claus Gittinger <cg@exept.de>
parents: 1813
diff changeset
  3950
4accc9fafd19 change #who to return a proper object
Claus Gittinger <cg@exept.de>
parents: 1813
diff changeset
  3951
methodSelector
2022
24529e2b7cee commentary for MethodWhoInfo
Claus Gittinger <cg@exept.de>
parents: 1995
diff changeset
  3952
    "return the selector under which the the method represented by myself
24529e2b7cee commentary for MethodWhoInfo
Claus Gittinger <cg@exept.de>
parents: 1995
diff changeset
  3953
     is found in the class"
24529e2b7cee commentary for MethodWhoInfo
Claus Gittinger <cg@exept.de>
parents: 1995
diff changeset
  3954
1851
4accc9fafd19 change #who to return a proper object
Claus Gittinger <cg@exept.de>
parents: 1813
diff changeset
  3955
    ^ mySelector
2022
24529e2b7cee commentary for MethodWhoInfo
Claus Gittinger <cg@exept.de>
parents: 1995
diff changeset
  3956
24529e2b7cee commentary for MethodWhoInfo
Claus Gittinger <cg@exept.de>
parents: 1995
diff changeset
  3957
    "Modified: 2.1.1997 / 14:59:24 / cg"
1851
4accc9fafd19 change #who to return a proper object
Claus Gittinger <cg@exept.de>
parents: 1813
diff changeset
  3958
! !
4accc9fafd19 change #who to return a proper object
Claus Gittinger <cg@exept.de>
parents: 1813
diff changeset
  3959
4accc9fafd19 change #who to return a proper object
Claus Gittinger <cg@exept.de>
parents: 1813
diff changeset
  3960
!Method::MethodWhoInfo methodsFor:'compatibility'!
4accc9fafd19 change #who to return a proper object
Claus Gittinger <cg@exept.de>
parents: 1813
diff changeset
  3961
4accc9fafd19 change #who to return a proper object
Claus Gittinger <cg@exept.de>
parents: 1813
diff changeset
  3962
at:index
4accc9fafd19 change #who to return a proper object
Claus Gittinger <cg@exept.de>
parents: 1813
diff changeset
  3963
    "simulate the old behavior (when Method>>who returned an array)"
4accc9fafd19 change #who to return a proper object
Claus Gittinger <cg@exept.de>
parents: 1813
diff changeset
  3964
4accc9fafd19 change #who to return a proper object
Claus Gittinger <cg@exept.de>
parents: 1813
diff changeset
  3965
    index == 1 ifTrue:[
18620
b4e9f25d6ce6 preparations for lined index list in WeakArray
Claus Gittinger <cg@exept.de>
parents: 18462
diff changeset
  3966
	^ myClass
1851
4accc9fafd19 change #who to return a proper object
Claus Gittinger <cg@exept.de>
parents: 1813
diff changeset
  3967
    ].
4accc9fafd19 change #who to return a proper object
Claus Gittinger <cg@exept.de>
parents: 1813
diff changeset
  3968
    index == 2 ifTrue:[
18620
b4e9f25d6ce6 preparations for lined index list in WeakArray
Claus Gittinger <cg@exept.de>
parents: 18462
diff changeset
  3969
	^ mySelector
1851
4accc9fafd19 change #who to return a proper object
Claus Gittinger <cg@exept.de>
parents: 1813
diff changeset
  3970
    ].
4accc9fafd19 change #who to return a proper object
Claus Gittinger <cg@exept.de>
parents: 1813
diff changeset
  3971
4accc9fafd19 change #who to return a proper object
Claus Gittinger <cg@exept.de>
parents: 1813
diff changeset
  3972
    "/ sigh - full compatibility ?
7219
7c7b9d76af21 subscriptBoundsError -> subscriptBoundsError:
Claus Gittinger <cg@exept.de>
parents: 7210
diff changeset
  3973
    ^ self indexNotIntegerOrOutOfBounds:index
1851
4accc9fafd19 change #who to return a proper object
Claus Gittinger <cg@exept.de>
parents: 1813
diff changeset
  3974
! !
4accc9fafd19 change #who to return a proper object
Claus Gittinger <cg@exept.de>
parents: 1813
diff changeset
  3975
7258
9ccdbee7d1ad method category rename
Claus Gittinger <cg@exept.de>
parents: 7219
diff changeset
  3976
!Method::MethodWhoInfo methodsFor:'private-accessing'!
1851
4accc9fafd19 change #who to return a proper object
Claus Gittinger <cg@exept.de>
parents: 1813
diff changeset
  3977
4accc9fafd19 change #who to return a proper object
Claus Gittinger <cg@exept.de>
parents: 1813
diff changeset
  3978
class:cls selector:sel
4accc9fafd19 change #who to return a proper object
Claus Gittinger <cg@exept.de>
parents: 1813
diff changeset
  3979
    myClass := cls.
4accc9fafd19 change #who to return a proper object
Claus Gittinger <cg@exept.de>
parents: 1813
diff changeset
  3980
    mySelector := sel
4accc9fafd19 change #who to return a proper object
Claus Gittinger <cg@exept.de>
parents: 1813
diff changeset
  3981
4accc9fafd19 change #who to return a proper object
Claus Gittinger <cg@exept.de>
parents: 1813
diff changeset
  3982
4accc9fafd19 change #who to return a proper object
Claus Gittinger <cg@exept.de>
parents: 1813
diff changeset
  3983
! !
4accc9fafd19 change #who to return a proper object
Claus Gittinger <cg@exept.de>
parents: 1813
diff changeset
  3984
13570
382db10e848d changed: #parse:with:return:or:
Claus Gittinger <cg@exept.de>
parents: 13569
diff changeset
  3985
!Method::ParseTreeCacheEntry methodsFor:'accessing'!
382db10e848d changed: #parse:with:return:or:
Claus Gittinger <cg@exept.de>
parents: 13569
diff changeset
  3986
382db10e848d changed: #parse:with:return:or:
Claus Gittinger <cg@exept.de>
parents: 13569
diff changeset
  3987
method
382db10e848d changed: #parse:with:return:or:
Claus Gittinger <cg@exept.de>
parents: 13569
diff changeset
  3988
    ^ method
382db10e848d changed: #parse:with:return:or:
Claus Gittinger <cg@exept.de>
parents: 13569
diff changeset
  3989
!
382db10e848d changed: #parse:with:return:or:
Claus Gittinger <cg@exept.de>
parents: 13569
diff changeset
  3990
382db10e848d changed: #parse:with:return:or:
Claus Gittinger <cg@exept.de>
parents: 13569
diff changeset
  3991
method:something
382db10e848d changed: #parse:with:return:or:
Claus Gittinger <cg@exept.de>
parents: 13569
diff changeset
  3992
    method := something.
382db10e848d changed: #parse:with:return:or:
Claus Gittinger <cg@exept.de>
parents: 13569
diff changeset
  3993
!
382db10e848d changed: #parse:with:return:or:
Claus Gittinger <cg@exept.de>
parents: 13569
diff changeset
  3994
382db10e848d changed: #parse:with:return:or:
Claus Gittinger <cg@exept.de>
parents: 13569
diff changeset
  3995
parser
382db10e848d changed: #parse:with:return:or:
Claus Gittinger <cg@exept.de>
parents: 13569
diff changeset
  3996
    ^ parser
382db10e848d changed: #parse:with:return:or:
Claus Gittinger <cg@exept.de>
parents: 13569
diff changeset
  3997
!
382db10e848d changed: #parse:with:return:or:
Claus Gittinger <cg@exept.de>
parents: 13569
diff changeset
  3998
382db10e848d changed: #parse:with:return:or:
Claus Gittinger <cg@exept.de>
parents: 13569
diff changeset
  3999
parser:something
382db10e848d changed: #parse:with:return:or:
Claus Gittinger <cg@exept.de>
parents: 13569
diff changeset
  4000
    parser := something.
382db10e848d changed: #parse:with:return:or:
Claus Gittinger <cg@exept.de>
parents: 13569
diff changeset
  4001
!
382db10e848d changed: #parse:with:return:or:
Claus Gittinger <cg@exept.de>
parents: 13569
diff changeset
  4002
382db10e848d changed: #parse:with:return:or:
Claus Gittinger <cg@exept.de>
parents: 13569
diff changeset
  4003
parserClass
382db10e848d changed: #parse:with:return:or:
Claus Gittinger <cg@exept.de>
parents: 13569
diff changeset
  4004
    ^ parserClass
382db10e848d changed: #parse:with:return:or:
Claus Gittinger <cg@exept.de>
parents: 13569
diff changeset
  4005
!
382db10e848d changed: #parse:with:return:or:
Claus Gittinger <cg@exept.de>
parents: 13569
diff changeset
  4006
382db10e848d changed: #parse:with:return:or:
Claus Gittinger <cg@exept.de>
parents: 13569
diff changeset
  4007
parserClass:something
382db10e848d changed: #parse:with:return:or:
Claus Gittinger <cg@exept.de>
parents: 13569
diff changeset
  4008
    parserClass := something.
382db10e848d changed: #parse:with:return:or:
Claus Gittinger <cg@exept.de>
parents: 13569
diff changeset
  4009
!
382db10e848d changed: #parse:with:return:or:
Claus Gittinger <cg@exept.de>
parents: 13569
diff changeset
  4010
13660
Claus Gittinger <cg@exept.de>
parents: 13659
diff changeset
  4011
parserClass:parserClassArg method:methodArg
13570
382db10e848d changed: #parse:with:return:or:
Claus Gittinger <cg@exept.de>
parents: 13569
diff changeset
  4012
    parserClass := parserClassArg.
382db10e848d changed: #parse:with:return:or:
Claus Gittinger <cg@exept.de>
parents: 13569
diff changeset
  4013
    method := methodArg.
382db10e848d changed: #parse:with:return:or:
Claus Gittinger <cg@exept.de>
parents: 13569
diff changeset
  4014
!
382db10e848d changed: #parse:with:return:or:
Claus Gittinger <cg@exept.de>
parents: 13569
diff changeset
  4015
13660
Claus Gittinger <cg@exept.de>
parents: 13659
diff changeset
  4016
parserClass:parserClassArg method:methodArg parser:parserArg
13570
382db10e848d changed: #parse:with:return:or:
Claus Gittinger <cg@exept.de>
parents: 13569
diff changeset
  4017
    parserClass := parserClassArg.
382db10e848d changed: #parse:with:return:or:
Claus Gittinger <cg@exept.de>
parents: 13569
diff changeset
  4018
    method := methodArg.
382db10e848d changed: #parse:with:return:or:
Claus Gittinger <cg@exept.de>
parents: 13569
diff changeset
  4019
    parser := parserArg.
382db10e848d changed: #parse:with:return:or:
Claus Gittinger <cg@exept.de>
parents: 13569
diff changeset
  4020
382db10e848d changed: #parse:with:return:or:
Claus Gittinger <cg@exept.de>
parents: 13569
diff changeset
  4021
    "Created: / 08-08-2011 / 19:05:02 / cg"
382db10e848d changed: #parse:with:return:or:
Claus Gittinger <cg@exept.de>
parents: 13569
diff changeset
  4022
! !
382db10e848d changed: #parse:with:return:or:
Claus Gittinger <cg@exept.de>
parents: 13569
diff changeset
  4023
382db10e848d changed: #parse:with:return:or:
Claus Gittinger <cg@exept.de>
parents: 13569
diff changeset
  4024
!Method::ParserCacheEntry methodsFor:'accessing'!
382db10e848d changed: #parse:with:return:or:
Claus Gittinger <cg@exept.de>
parents: 13569
diff changeset
  4025
382db10e848d changed: #parse:with:return:or:
Claus Gittinger <cg@exept.de>
parents: 13569
diff changeset
  4026
method
382db10e848d changed: #parse:with:return:or:
Claus Gittinger <cg@exept.de>
parents: 13569
diff changeset
  4027
    ^ method
382db10e848d changed: #parse:with:return:or:
Claus Gittinger <cg@exept.de>
parents: 13569
diff changeset
  4028
!
382db10e848d changed: #parse:with:return:or:
Claus Gittinger <cg@exept.de>
parents: 13569
diff changeset
  4029
382db10e848d changed: #parse:with:return:or:
Claus Gittinger <cg@exept.de>
parents: 13569
diff changeset
  4030
method:something
382db10e848d changed: #parse:with:return:or:
Claus Gittinger <cg@exept.de>
parents: 13569
diff changeset
  4031
    method := something.
382db10e848d changed: #parse:with:return:or:
Claus Gittinger <cg@exept.de>
parents: 13569
diff changeset
  4032
!
382db10e848d changed: #parse:with:return:or:
Claus Gittinger <cg@exept.de>
parents: 13569
diff changeset
  4033
19716
34387335cbba #REFACTORING by cg
Claus Gittinger <cg@exept.de>
parents: 19699
diff changeset
  4034
method:methodArg parser:parserArg
34387335cbba #REFACTORING by cg
Claus Gittinger <cg@exept.de>
parents: 19699
diff changeset
  4035
    method := methodArg.
34387335cbba #REFACTORING by cg
Claus Gittinger <cg@exept.de>
parents: 19699
diff changeset
  4036
    parser := parserArg.
34387335cbba #REFACTORING by cg
Claus Gittinger <cg@exept.de>
parents: 19699
diff changeset
  4037
34387335cbba #REFACTORING by cg
Claus Gittinger <cg@exept.de>
parents: 19699
diff changeset
  4038
    "Created: / 08-08-2011 / 19:05:02 / cg"
34387335cbba #REFACTORING by cg
Claus Gittinger <cg@exept.de>
parents: 19699
diff changeset
  4039
!
34387335cbba #REFACTORING by cg
Claus Gittinger <cg@exept.de>
parents: 19699
diff changeset
  4040
13570
382db10e848d changed: #parse:with:return:or:
Claus Gittinger <cg@exept.de>
parents: 13569
diff changeset
  4041
parser
382db10e848d changed: #parse:with:return:or:
Claus Gittinger <cg@exept.de>
parents: 13569
diff changeset
  4042
    ^ parser
382db10e848d changed: #parse:with:return:or:
Claus Gittinger <cg@exept.de>
parents: 13569
diff changeset
  4043
!
382db10e848d changed: #parse:with:return:or:
Claus Gittinger <cg@exept.de>
parents: 13569
diff changeset
  4044
382db10e848d changed: #parse:with:return:or:
Claus Gittinger <cg@exept.de>
parents: 13569
diff changeset
  4045
parser:something
382db10e848d changed: #parse:with:return:or:
Claus Gittinger <cg@exept.de>
parents: 13569
diff changeset
  4046
    parser := something.
382db10e848d changed: #parse:with:return:or:
Claus Gittinger <cg@exept.de>
parents: 13569
diff changeset
  4047
! !
382db10e848d changed: #parse:with:return:or:
Claus Gittinger <cg@exept.de>
parents: 13569
diff changeset
  4048
1775
6892b91ddc0b F_CALLED flag is no longer present
Claus Gittinger <cg@exept.de>
parents: 1692
diff changeset
  4049
!Method class methodsFor:'documentation'!
872
af04035b443d binary class storage support
Claus Gittinger <cg@exept.de>
parents: 829
diff changeset
  4050
13569
82bcca38e855 comment/format in: #sends:or:
Claus Gittinger <cg@exept.de>
parents: 13567
diff changeset
  4051
version
18620
b4e9f25d6ce6 preparations for lined index list in WeakArray
Claus Gittinger <cg@exept.de>
parents: 18462
diff changeset
  4052
    ^ '$Header$'
13569
82bcca38e855 comment/format in: #sends:or:
Claus Gittinger <cg@exept.de>
parents: 13567
diff changeset
  4053
!
82bcca38e855 comment/format in: #sends:or:
Claus Gittinger <cg@exept.de>
parents: 13567
diff changeset
  4054
13422
b43a8a47037c Jan's changes
vrany
parents: 13390
diff changeset
  4055
version_CVS
18620
b4e9f25d6ce6 preparations for lined index list in WeakArray
Claus Gittinger <cg@exept.de>
parents: 18462
diff changeset
  4056
    ^ '$Header$'
12159
1768c0019100 compiler interface
fm
parents: 12017
diff changeset
  4057
!
1768c0019100 compiler interface
fm
parents: 12017
diff changeset
  4058
13422
b43a8a47037c Jan's changes
vrany
parents: 13390
diff changeset
  4059
version_SVN
15245
84fe46f42c9f class: Method
Claus Gittinger <cg@exept.de>
parents: 15109
diff changeset
  4060
    ^ '$ Id: Method.st 10648 2011-06-23 15:55:10Z vranyj1 $'
1
a27a279701f8 Initial revision
claus
parents:
diff changeset
  4061
! !
6956
23f0066163ff oops - EOL comments were handled wrong
Claus Gittinger <cg@exept.de>
parents: 6725
diff changeset
  4062
14863
49e50305f097 class: Method
Claus Gittinger <cg@exept.de>
parents: 14595
diff changeset
  4063
952
d600e08a5936 handle the case where a method has a sourceFileInfo, but the class has not
Claus Gittinger <cg@exept.de>
parents: 934
diff changeset
  4064
Method initialize!