Method.st
author Claus Gittinger <cg@exept.de>
Tue, 22 Apr 2014 17:56:44 +0200
changeset 16384 f36e185cbc66
parent 16271 0a4f1d60a5f2
child 16737 0d213799e299
permissions -rw-r--r--
class: Method changed: #source care for nil UserPrefs (non-GUI apps)
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
1
a27a279701f8 Initial revision
claus
parents:
diff changeset
     1
"
5
67342904af11 *** empty log message ***
claus
parents: 3
diff changeset
     2
 COPYRIGHT (c) 1989 by Claus Gittinger
13662
7d7ae1e5f589 changed: #annotationAtIndex:
Claus Gittinger <cg@exept.de>
parents: 13660
diff changeset
     3
              All Rights Reserved
1
a27a279701f8 Initial revision
claus
parents:
diff changeset
     4
a27a279701f8 Initial revision
claus
parents:
diff changeset
     5
 This software is furnished under a license and may be used
a27a279701f8 Initial revision
claus
parents:
diff changeset
     6
 only in accordance with the terms of that license and with the
a27a279701f8 Initial revision
claus
parents:
diff changeset
     7
 inclusion of the above copyright notice.   This software may not
a27a279701f8 Initial revision
claus
parents:
diff changeset
     8
 be provided or otherwise made available to, or used by, any
a27a279701f8 Initial revision
claus
parents:
diff changeset
     9
 other person.  No title to or ownership of the software is
a27a279701f8 Initial revision
claus
parents:
diff changeset
    10
 hereby transferred.
a27a279701f8 Initial revision
claus
parents:
diff changeset
    11
"
5385
7637332d7b38 care for nil package
Claus Gittinger <cg@exept.de>
parents: 5339
diff changeset
    12
"{ Package: 'stx:libbasic' }"
7637332d7b38 care for nil package
Claus Gittinger <cg@exept.de>
parents: 5339
diff changeset
    13
3934
a8c6075f9988 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 3845
diff changeset
    14
CompiledCode variableSubclass:#Method
16261
52a0604a7b95 class: Method
Stefan Vogel <sv@exept.de>
parents: 16221
diff changeset
    15
	instanceVariableNames:'source sourcePosition category package mclass lookupObject
52a0604a7b95 class: Method
Stefan Vogel <sv@exept.de>
parents: 16221
diff changeset
    16
		annotations'
52a0604a7b95 class: Method
Stefan Vogel <sv@exept.de>
parents: 16221
diff changeset
    17
	classVariableNames:'PrivateMethodSignal LastFileReference LastSourceFileName
52a0604a7b95 class: Method
Stefan Vogel <sv@exept.de>
parents: 16221
diff changeset
    18
		LastWhoClass LastFileLock LastMethodSources LastMethodSourcesLock
52a0604a7b95 class: Method
Stefan Vogel <sv@exept.de>
parents: 16221
diff changeset
    19
		CompilationLock Overrides LastParseTreeCache'
52a0604a7b95 class: Method
Stefan Vogel <sv@exept.de>
parents: 16221
diff changeset
    20
	poolDictionaries:''
52a0604a7b95 class: Method
Stefan Vogel <sv@exept.de>
parents: 16221
diff changeset
    21
	category:'Kernel-Methods'
1
a27a279701f8 Initial revision
claus
parents:
diff changeset
    22
!
a27a279701f8 Initial revision
claus
parents:
diff changeset
    23
1851
4accc9fafd19 change #who to return a proper object
Claus Gittinger <cg@exept.de>
parents: 1813
diff changeset
    24
Object subclass:#MethodWhoInfo
16261
52a0604a7b95 class: Method
Stefan Vogel <sv@exept.de>
parents: 16221
diff changeset
    25
	instanceVariableNames:'myClass mySelector'
52a0604a7b95 class: Method
Stefan Vogel <sv@exept.de>
parents: 16221
diff changeset
    26
	classVariableNames:''
52a0604a7b95 class: Method
Stefan Vogel <sv@exept.de>
parents: 16221
diff changeset
    27
	poolDictionaries:''
52a0604a7b95 class: Method
Stefan Vogel <sv@exept.de>
parents: 16221
diff changeset
    28
	privateIn:Method
1851
4accc9fafd19 change #who to return a proper object
Claus Gittinger <cg@exept.de>
parents: 1813
diff changeset
    29
!
4accc9fafd19 change #who to return a proper object
Claus Gittinger <cg@exept.de>
parents: 1813
diff changeset
    30
13570
382db10e848d changed: #parse:with:return:or:
Claus Gittinger <cg@exept.de>
parents: 13569
diff changeset
    31
Object subclass:#ParseTreeCacheEntry
16261
52a0604a7b95 class: Method
Stefan Vogel <sv@exept.de>
parents: 16221
diff changeset
    32
	instanceVariableNames:'parserClass method parser'
52a0604a7b95 class: Method
Stefan Vogel <sv@exept.de>
parents: 16221
diff changeset
    33
	classVariableNames:''
52a0604a7b95 class: Method
Stefan Vogel <sv@exept.de>
parents: 16221
diff changeset
    34
	poolDictionaries:''
52a0604a7b95 class: Method
Stefan Vogel <sv@exept.de>
parents: 16221
diff changeset
    35
	privateIn:Method
13570
382db10e848d changed: #parse:with:return:or:
Claus Gittinger <cg@exept.de>
parents: 13569
diff changeset
    36
!
382db10e848d changed: #parse:with:return:or:
Claus Gittinger <cg@exept.de>
parents: 13569
diff changeset
    37
382db10e848d changed: #parse:with:return:or:
Claus Gittinger <cg@exept.de>
parents: 13569
diff changeset
    38
Object subclass:#ParserCacheEntry
16261
52a0604a7b95 class: Method
Stefan Vogel <sv@exept.de>
parents: 16221
diff changeset
    39
	instanceVariableNames:'parserClass method parser'
52a0604a7b95 class: Method
Stefan Vogel <sv@exept.de>
parents: 16221
diff changeset
    40
	classVariableNames:''
52a0604a7b95 class: Method
Stefan Vogel <sv@exept.de>
parents: 16221
diff changeset
    41
	poolDictionaries:''
52a0604a7b95 class: Method
Stefan Vogel <sv@exept.de>
parents: 16221
diff changeset
    42
	privateIn:Method
13570
382db10e848d changed: #parse:with:return:or:
Claus Gittinger <cg@exept.de>
parents: 13569
diff changeset
    43
!
382db10e848d changed: #parse:with:return:or:
Claus Gittinger <cg@exept.de>
parents: 13569
diff changeset
    44
1775
6892b91ddc0b F_CALLED flag is no longer present
Claus Gittinger <cg@exept.de>
parents: 1692
diff changeset
    45
!Method class methodsFor:'documentation'!
42
e33491f6f260 *** empty log message ***
claus
parents: 39
diff changeset
    46
88
81dacba7a63a *** empty log message ***
claus
parents: 85
diff changeset
    47
copyright
81dacba7a63a *** empty log message ***
claus
parents: 85
diff changeset
    48
"
81dacba7a63a *** empty log message ***
claus
parents: 85
diff changeset
    49
 COPYRIGHT (c) 1989 by Claus Gittinger
13662
7d7ae1e5f589 changed: #annotationAtIndex:
Claus Gittinger <cg@exept.de>
parents: 13660
diff changeset
    50
              All Rights Reserved
88
81dacba7a63a *** empty log message ***
claus
parents: 85
diff changeset
    51
81dacba7a63a *** empty log message ***
claus
parents: 85
diff changeset
    52
 This software is furnished under a license and may be used
81dacba7a63a *** empty log message ***
claus
parents: 85
diff changeset
    53
 only in accordance with the terms of that license and with the
81dacba7a63a *** empty log message ***
claus
parents: 85
diff changeset
    54
 inclusion of the above copyright notice.   This software may not
81dacba7a63a *** empty log message ***
claus
parents: 85
diff changeset
    55
 be provided or otherwise made available to, or used by, any
81dacba7a63a *** empty log message ***
claus
parents: 85
diff changeset
    56
 other person.  No title to or ownership of the software is
81dacba7a63a *** empty log message ***
claus
parents: 85
diff changeset
    57
 hereby transferred.
81dacba7a63a *** empty log message ***
claus
parents: 85
diff changeset
    58
"
81dacba7a63a *** empty log message ***
claus
parents: 85
diff changeset
    59
!
81dacba7a63a *** empty log message ***
claus
parents: 85
diff changeset
    60
42
e33491f6f260 *** empty log message ***
claus
parents: 39
diff changeset
    61
documentation
e33491f6f260 *** empty log message ***
claus
parents: 39
diff changeset
    62
"
68
59faa75185ba *** empty log message ***
claus
parents: 56
diff changeset
    63
    this class defines protocol for executable methods;
59faa75185ba *** empty log message ***
claus
parents: 56
diff changeset
    64
    both compiled and interpreted methods are represented by this class.
59faa75185ba *** empty log message ***
claus
parents: 56
diff changeset
    65
    Compiled methods have a non-nil code field, while interpreted methods have
59faa75185ba *** empty log message ***
claus
parents: 56
diff changeset
    66
    a nil code field and non-nil byteCode field.
88
81dacba7a63a *** empty log message ***
claus
parents: 85
diff changeset
    67
    If there are both non-nil code and bytecode fields, the VM will execute
227
23b1c4de3402 package & cleanup
claus
parents: 216
diff changeset
    68
    the machine-code of a method. If both are nil when executed, a noByteCode
23b1c4de3402 package & cleanup
claus
parents: 216
diff changeset
    69
    message is sent by the VM to the method where a signal is raised.
1
a27a279701f8 Initial revision
claus
parents:
diff changeset
    70
227
23b1c4de3402 package & cleanup
claus
parents: 216
diff changeset
    71
    The methods sourcecode is represented by source and sourcePosition:
23b1c4de3402 package & cleanup
claus
parents: 216
diff changeset
    72
    - if sourcePosition is a Number, the source-field is the fileName and
23b1c4de3402 package & cleanup
claus
parents: 216
diff changeset
    73
      sourcePosition is the character offset of the source-chunk in this source file.
23b1c4de3402 package & cleanup
claus
parents: 216
diff changeset
    74
    - If sourcePosition is nil, the source is the string in the source field.
23b1c4de3402 package & cleanup
claus
parents: 216
diff changeset
    75
    (an old version used ExternalString instances here, but that lead to
23b1c4de3402 package & cleanup
claus
parents: 216
diff changeset
    76
     10000 additional little objects ...)
1
a27a279701f8 Initial revision
claus
parents:
diff changeset
    77
68
59faa75185ba *** empty log message ***
claus
parents: 56
diff changeset
    78
    The flags field defines things like the number of method-locals,
227
23b1c4de3402 package & cleanup
claus
parents: 216
diff changeset
    79
    method arguments and stack requirements (for interpreted methods).
68
59faa75185ba *** empty log message ***
claus
parents: 56
diff changeset
    80
    Do not depend on any value in the flags field - it may change without
59faa75185ba *** empty log message ***
claus
parents: 56
diff changeset
    81
    notice.
1
a27a279701f8 Initial revision
claus
parents:
diff changeset
    82
438
claus
parents: 423
diff changeset
    83
    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
    84
    identified not by being an instance of Block or Method, but instead by
438
claus
parents: 423
diff changeset
    85
    having the executable flag bit set in the class. The VM can execute anything
claus
parents: 423
diff changeset
    86
    which is identified as executable (assuming that the first instance variable
claus
parents: 423
diff changeset
    87
    is the machine-code address) - this allows for easy future extension.
claus
parents: 423
diff changeset
    88
1293
02fb05148c98 documentation
Claus Gittinger <cg@exept.de>
parents: 1264
diff changeset
    89
    [Instance variables:]
93
e31220cb391f *** empty log message ***
claus
parents: 88
diff changeset
    90
13662
7d7ae1e5f589 changed: #annotationAtIndex:
Claus Gittinger <cg@exept.de>
parents: 13660
diff changeset
    91
        source          <String>        the source itself (if sourcePosition isNil)
7d7ae1e5f589 changed: #annotationAtIndex:
Claus Gittinger <cg@exept.de>
parents: 13660
diff changeset
    92
                                        or the fileName where the source is found
7d7ae1e5f589 changed: #annotationAtIndex:
Claus Gittinger <cg@exept.de>
parents: 13660
diff changeset
    93
7d7ae1e5f589 changed: #annotationAtIndex:
Claus Gittinger <cg@exept.de>
parents: 13660
diff changeset
    94
        sourcePosition  <Integer>       the position of the methods chunk in the file
7d7ae1e5f589 changed: #annotationAtIndex:
Claus Gittinger <cg@exept.de>
parents: 13660
diff changeset
    95
7d7ae1e5f589 changed: #annotationAtIndex:
Claus Gittinger <cg@exept.de>
parents: 13660
diff changeset
    96
        category        <Symbol>        the methods category
7d7ae1e5f589 changed: #annotationAtIndex:
Claus Gittinger <cg@exept.de>
parents: 13660
diff changeset
    97
        package         <Symbol>        the package, in which the methods was defined
7d7ae1e5f589 changed: #annotationAtIndex:
Claus Gittinger <cg@exept.de>
parents: 13660
diff changeset
    98
        mclass          <Class>         the class in which I am defined
7d7ae1e5f589 changed: #annotationAtIndex:
Claus Gittinger <cg@exept.de>
parents: 13660
diff changeset
    99
        indexed slots                   literals
227
23b1c4de3402 package & cleanup
claus
parents: 216
diff changeset
   100
1293
02fb05148c98 documentation
Claus Gittinger <cg@exept.de>
parents: 1264
diff changeset
   101
    [Class variables:]
227
23b1c4de3402 package & cleanup
claus
parents: 216
diff changeset
   102
13662
7d7ae1e5f589 changed: #annotationAtIndex:
Claus Gittinger <cg@exept.de>
parents: 13660
diff changeset
   103
        PrivateMethodSignal             raised on privacy violation (see docu)
7d7ae1e5f589 changed: #annotationAtIndex:
Claus Gittinger <cg@exept.de>
parents: 13660
diff changeset
   104
7d7ae1e5f589 changed: #annotationAtIndex:
Claus Gittinger <cg@exept.de>
parents: 13660
diff changeset
   105
        LastFileReference               weak reference to the last sourceFile
7d7ae1e5f589 changed: #annotationAtIndex:
Claus Gittinger <cg@exept.de>
parents: 13660
diff changeset
   106
        LastSourceFileName              to speedup source access via NFS
93
e31220cb391f *** empty log message ***
claus
parents: 88
diff changeset
   107
68
59faa75185ba *** empty log message ***
claus
parents: 56
diff changeset
   108
    WARNING: layout known by compiler and runtime system - dont change
1293
02fb05148c98 documentation
Claus Gittinger <cg@exept.de>
parents: 1264
diff changeset
   109
02fb05148c98 documentation
Claus Gittinger <cg@exept.de>
parents: 1264
diff changeset
   110
    [author:]
13662
7d7ae1e5f589 changed: #annotationAtIndex:
Claus Gittinger <cg@exept.de>
parents: 13660
diff changeset
   111
        Claus Gittinger
42
e33491f6f260 *** empty log message ***
claus
parents: 39
diff changeset
   112
"
176
48061f8659aa more queries
claus
parents: 159
diff changeset
   113
!
48061f8659aa more queries
claus
parents: 159
diff changeset
   114
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
   115
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
   116
"
5277
d457937a69e5 comments & code-cleanup in #who
Claus Gittinger <cg@exept.de>
parents: 5241
diff changeset
   117
    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
   118
    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
   119
    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
   120
    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
   121
    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
   122
    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
   123
    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
   124
    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
   125
d457937a69e5 comments & code-cleanup in #who
Claus Gittinger <cg@exept.de>
parents: 5241
diff changeset
   126
    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
   127
    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
   128
    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
   129
    which is compiled by the machines native C-compiler.
d457937a69e5 comments & code-cleanup in #who
Claus Gittinger <cg@exept.de>
parents: 5241
diff changeset
   130
    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
   131
"
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
!
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
12854
3a3d3c02c3bd *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 12695
diff changeset
   134
privacy
176
48061f8659aa more queries
claus
parents: 159
diff changeset
   135
"
48061f8659aa more queries
claus
parents: 159
diff changeset
   136
    ST/X includes an EXPERIMENTAL implementation of method privacy.
48061f8659aa more queries
claus
parents: 159
diff changeset
   137
    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
   138
    privacy:#private and privacy:#protected messages. Also, categories may be
202
40ca7cc6fb9c *** empty log message ***
claus
parents: 192
diff changeset
   139
    filedIn as a whole as private using #privateMethodsFor: or as
40ca7cc6fb9c *** empty log message ***
claus
parents: 192
diff changeset
   140
    protected using #protectedMethodsFor: instead of the well known #methodsFor:.
40ca7cc6fb9c *** empty log message ***
claus
parents: 192
diff changeset
   141
176
48061f8659aa more queries
claus
parents: 159
diff changeset
   142
    The additional #publicMethodsFor: is for documentation purposes, and
227
23b1c4de3402 package & cleanup
claus
parents: 216
diff changeset
   143
    is equivalent to #methodsFor: (also to support fileIn of ENVY methods).
176
48061f8659aa more queries
claus
parents: 159
diff changeset
   144
8518
7dc3f9909640 Interchanged the meaning of method privacy -
Stefan Vogel <sv@exept.de>
parents: 8465
diff changeset
   145
    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
   146
    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
   147
    class itself or subclasses.
12854
3a3d3c02c3bd *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 12695
diff changeset
   148
    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
   149
    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
   150
    (i.e. protected methods are less private than private ones)
176
48061f8659aa more queries
claus
parents: 159
diff changeset
   151
48061f8659aa more queries
claus
parents: 159
diff changeset
   152
    When such a situation arises, the VM (runtime system) will raise the
48061f8659aa more queries
claus
parents: 159
diff changeset
   153
    PrivateMethodSignal exception (if nonNil), which usually brings you into the
48061f8659aa more queries
claus
parents: 159
diff changeset
   154
    debugger.
48061f8659aa more queries
claus
parents: 159
diff changeset
   155
227
23b1c4de3402 package & cleanup
claus
parents: 216
diff changeset
   156
    If PrivateMethodSignal is nil, the VM will not check for this, and
176
48061f8659aa more queries
claus
parents: 159
diff changeset
   157
    execution is as usual. (you may want to nil-it for production code,
48061f8659aa more queries
claus
parents: 159
diff changeset
   158
    and leave it non nil during development).
48061f8659aa more queries
claus
parents: 159
diff changeset
   159
48061f8659aa more queries
claus
parents: 159
diff changeset
   160
    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
   161
    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
   162
    (from what can be deduced by reading PD code).
d457937a69e5 comments & code-cleanup in #who
Claus Gittinger <cg@exept.de>
parents: 5241
diff changeset
   163
176
48061f8659aa more queries
claus
parents: 159
diff changeset
   164
    Also, the usability of privacy is still to be tested.
415
claus
parents: 414
diff changeset
   165
    This interface, the implementation and the rules for when a privacy violation
claus
parents: 414
diff changeset
   166
    may change (in case of some ANSI standard being defined).
227
23b1c4de3402 package & cleanup
claus
parents: 216
diff changeset
   167
    Be warned and send me suggestions & critics (constructive ;-)
5277
d457937a69e5 comments & code-cleanup in #who
Claus Gittinger <cg@exept.de>
parents: 5241
diff changeset
   168
d457937a69e5 comments & code-cleanup in #who
Claus Gittinger <cg@exept.de>
parents: 5241
diff changeset
   169
    Late note (Feb 2000):
13662
7d7ae1e5f589 changed: #annotationAtIndex:
Claus Gittinger <cg@exept.de>
parents: 13660
diff changeset
   170
        the privacy feature has new been in ST/X for some years and was NOT heavily
7d7ae1e5f589 changed: #annotationAtIndex:
Claus Gittinger <cg@exept.de>
parents: 13660
diff changeset
   171
        used - neither at eXept, nor by customers.
7d7ae1e5f589 changed: #annotationAtIndex:
Claus Gittinger <cg@exept.de>
parents: 13660
diff changeset
   172
        In Smalltalk, it seems to be a very questionable feature, actually limiting
7d7ae1e5f589 changed: #annotationAtIndex:
Claus Gittinger <cg@exept.de>
parents: 13660
diff changeset
   173
        code reusability.
7d7ae1e5f589 changed: #annotationAtIndex:
Claus Gittinger <cg@exept.de>
parents: 13660
diff changeset
   174
        The privacy features are left in the system to demonstrate that it can be
7d7ae1e5f589 changed: #annotationAtIndex:
Claus Gittinger <cg@exept.de>
parents: 13660
diff changeset
   175
        done in Smalltalk (for religious C++ fans ... to avoid useless discussions)
7d7ae1e5f589 changed: #annotationAtIndex:
Claus Gittinger <cg@exept.de>
parents: 13660
diff changeset
   176
        (the check is not expensive, w.r.t. the VM runtime behavior).
176
48061f8659aa more queries
claus
parents: 159
diff changeset
   177
"
42
e33491f6f260 *** empty log message ***
claus
parents: 39
diff changeset
   178
! !
1
a27a279701f8 Initial revision
claus
parents:
diff changeset
   179
1775
6892b91ddc0b F_CALLED flag is no longer present
Claus Gittinger <cg@exept.de>
parents: 1692
diff changeset
   180
!Method class methodsFor:'initialization'!
109
1fae65190b17 errors raise signals; check arg-count in valueWith...
claus
parents: 93
diff changeset
   181
1fae65190b17 errors raise signals; check arg-count in valueWith...
claus
parents: 93
diff changeset
   182
initialize
1254
48c2748b5197 commentary
Claus Gittinger <cg@exept.de>
parents: 1236
diff changeset
   183
    "create signals"
48c2748b5197 commentary
Claus Gittinger <cg@exept.de>
parents: 1236
diff changeset
   184
109
1fae65190b17 errors raise signals; check arg-count in valueWith...
claus
parents: 93
diff changeset
   185
    PrivateMethodSignal isNil ifTrue:[
13662
7d7ae1e5f589 changed: #annotationAtIndex:
Claus Gittinger <cg@exept.de>
parents: 13660
diff changeset
   186
        "EXPERIMENTAL"
7d7ae1e5f589 changed: #annotationAtIndex:
Claus Gittinger <cg@exept.de>
parents: 13660
diff changeset
   187
        PrivateMethodSignal := ExecutionError newSignalMayProceed:true.
7d7ae1e5f589 changed: #annotationAtIndex:
Claus Gittinger <cg@exept.de>
parents: 13660
diff changeset
   188
        PrivateMethodSignal nameClass:self message:#privateMethodSignal.
7d7ae1e5f589 changed: #annotationAtIndex:
Claus Gittinger <cg@exept.de>
parents: 13660
diff changeset
   189
        PrivateMethodSignal notifierString:'attempt to execute private/protected method'.
2079
bcf84ab30304 Make cached sourcefile thread-protected.
Stefan Vogel <sv@exept.de>
parents: 2066
diff changeset
   190
    ].
bcf84ab30304 Make cached sourcefile thread-protected.
Stefan Vogel <sv@exept.de>
parents: 2066
diff changeset
   191
bcf84ab30304 Make cached sourcefile thread-protected.
Stefan Vogel <sv@exept.de>
parents: 2066
diff changeset
   192
    LastFileLock isNil ifTrue:[
13662
7d7ae1e5f589 changed: #annotationAtIndex:
Claus Gittinger <cg@exept.de>
parents: 13660
diff changeset
   193
        LastFileLock := RecursionLock new name:'Method-LastFile'.
7d7ae1e5f589 changed: #annotationAtIndex:
Claus Gittinger <cg@exept.de>
parents: 13660
diff changeset
   194
        LastMethodSourcesLock := RecursionLock new name:'Method-LastMethodSources'.
7d7ae1e5f589 changed: #annotationAtIndex:
Claus Gittinger <cg@exept.de>
parents: 13660
diff changeset
   195
14231
a61fd41fe0d6 variable renamed in: #initialize
Claus Gittinger <cg@exept.de>
parents: 14161
diff changeset
   196
        LastFileReference := WeakArray new:1.
13662
7d7ae1e5f589 changed: #annotationAtIndex:
Claus Gittinger <cg@exept.de>
parents: 13660
diff changeset
   197
        LastFileReference at:1 put:nil.
2079
bcf84ab30304 Make cached sourcefile thread-protected.
Stefan Vogel <sv@exept.de>
parents: 2066
diff changeset
   198
    ].
1254
48c2748b5197 commentary
Claus Gittinger <cg@exept.de>
parents: 1236
diff changeset
   199
5387
f855cf3b2f67 need a recursionLock as compilationLock
Claus Gittinger <cg@exept.de>
parents: 5386
diff changeset
   200
    CompilationLock := RecursionLock new name:'MethodCompilation'.
4290
5e43473d7a35 moved recompilation semaphore from LazyMethod to Method
Claus Gittinger <cg@exept.de>
parents: 4015
diff changeset
   201
14231
a61fd41fe0d6 variable renamed in: #initialize
Claus Gittinger <cg@exept.de>
parents: 14161
diff changeset
   202
    "Modified: / 03-01-1997 / 16:58:16 / stefan"
a61fd41fe0d6 variable renamed in: #initialize
Claus Gittinger <cg@exept.de>
parents: 14161
diff changeset
   203
    "Modified (comment): / 20-07-2012 / 18:41:11 / cg"
10375
b1558b2e851d care for source access BEFORE being initialized.
ca
parents: 10207
diff changeset
   204
!
b1558b2e851d care for source access BEFORE being initialized.
ca
parents: 10207
diff changeset
   205
b1558b2e851d care for source access BEFORE being initialized.
ca
parents: 10207
diff changeset
   206
lastMethodSourcesLock
b1558b2e851d care for source access BEFORE being initialized.
ca
parents: 10207
diff changeset
   207
    LastMethodSourcesLock isNil ifTrue:[
13662
7d7ae1e5f589 changed: #annotationAtIndex:
Claus Gittinger <cg@exept.de>
parents: 13660
diff changeset
   208
        self initialize
10375
b1558b2e851d care for source access BEFORE being initialized.
ca
parents: 10207
diff changeset
   209
    ].
b1558b2e851d care for source access BEFORE being initialized.
ca
parents: 10207
diff changeset
   210
    ^ LastMethodSourcesLock
109
1fae65190b17 errors raise signals; check arg-count in valueWith...
claus
parents: 93
diff changeset
   211
! !
1fae65190b17 errors raise signals; check arg-count in valueWith...
claus
parents: 93
diff changeset
   212
1775
6892b91ddc0b F_CALLED flag is no longer present
Claus Gittinger <cg@exept.de>
parents: 1692
diff changeset
   213
!Method class methodsFor:'Signal constants'!
159
514c749165c3 *** empty log message ***
claus
parents: 142
diff changeset
   214
514c749165c3 *** empty log message ***
claus
parents: 142
diff changeset
   215
privateMethodSignal
176
48061f8659aa more queries
claus
parents: 159
diff changeset
   216
    "return the signal raised when a private/protected method is called
48061f8659aa more queries
claus
parents: 159
diff changeset
   217
     by some other object (i.e. not a self- or super send)"
48061f8659aa more queries
claus
parents: 159
diff changeset
   218
159
514c749165c3 *** empty log message ***
claus
parents: 142
diff changeset
   219
    ^ PrivateMethodSignal
514c749165c3 *** empty log message ***
claus
parents: 142
diff changeset
   220
! !
514c749165c3 *** empty log message ***
claus
parents: 142
diff changeset
   221
11022
8dd9f699915f +shouldBeSkippedInDebuggersWalkBack
Claus Gittinger <cg@exept.de>
parents: 11016
diff changeset
   222
13570
382db10e848d changed: #parse:with:return:or:
Claus Gittinger <cg@exept.de>
parents: 13569
diff changeset
   223
!Method class methodsFor:'cleanup'!
382db10e848d changed: #parse:with:return:or:
Claus Gittinger <cg@exept.de>
parents: 13569
diff changeset
   224
382db10e848d changed: #parse:with:return:or:
Claus Gittinger <cg@exept.de>
parents: 13569
diff changeset
   225
lowSpaceCleanup
382db10e848d changed: #parse:with:return:or:
Claus Gittinger <cg@exept.de>
parents: 13569
diff changeset
   226
    LastParseTreeCache := nil.
13572
c81aeb055fd3 changed: #lowSpaceCleanup
Claus Gittinger <cg@exept.de>
parents: 13571
diff changeset
   227
    LastSourceFileName := LastWhoClass := nil.
14236
d383e9f70795 changed: #lowSpaceCleanup
Claus Gittinger <cg@exept.de>
parents: 14231
diff changeset
   228
    self flushSourceStreamCache.
13570
382db10e848d changed: #parse:with:return:or:
Claus Gittinger <cg@exept.de>
parents: 13569
diff changeset
   229
382db10e848d changed: #parse:with:return:or:
Claus Gittinger <cg@exept.de>
parents: 13569
diff changeset
   230
    "Created: / 08-08-2011 / 19:11:23 / cg"
382db10e848d changed: #parse:with:return:or:
Claus Gittinger <cg@exept.de>
parents: 13569
diff changeset
   231
! !
382db10e848d changed: #parse:with:return:or:
Claus Gittinger <cg@exept.de>
parents: 13569
diff changeset
   232
1775
6892b91ddc0b F_CALLED flag is no longer present
Claus Gittinger <cg@exept.de>
parents: 1692
diff changeset
   233
!Method class methodsFor:'queries'!
3
24d81bf47225 *** empty log message ***
claus
parents: 2
diff changeset
   234
24d81bf47225 *** empty log message ***
claus
parents: 2
diff changeset
   235
isBuiltInClass
1264
8d916aa63bce commentary
Claus Gittinger <cg@exept.de>
parents: 1260
diff changeset
   236
    "return true if this class is known by the run-time-system.
8d916aa63bce commentary
Claus Gittinger <cg@exept.de>
parents: 1260
diff changeset
   237
     Here, true is returned for myself, false for subclasses."
3
24d81bf47225 *** empty log message ***
claus
parents: 2
diff changeset
   238
24d81bf47225 *** empty log message ***
claus
parents: 2
diff changeset
   239
    ^ self == Method
1264
8d916aa63bce commentary
Claus Gittinger <cg@exept.de>
parents: 1260
diff changeset
   240
8d916aa63bce commentary
Claus Gittinger <cg@exept.de>
parents: 1260
diff changeset
   241
    "Modified: 23.4.1996 / 15:59:50 / cg"
44
b262907c93ea *** empty log message ***
claus
parents: 42
diff changeset
   242
!
b262907c93ea *** empty log message ***
claus
parents: 42
diff changeset
   243
6089
a3710756f360 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6071
diff changeset
   244
methodDefinitionTemplateForSelector:aSelector
a3710756f360 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6071
diff changeset
   245
    "given a selector, return a prototype definition string"
a3710756f360 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6071
diff changeset
   246
14375
aa9b2d741a7b changed:
Claus Gittinger <cg@exept.de>
parents: 14357
diff changeset
   247
    ^ self programmingLanguage 
13662
7d7ae1e5f589 changed: #annotationAtIndex:
Claus Gittinger <cg@exept.de>
parents: 13660
diff changeset
   248
        methodDefinitionTemplateForSelector:aSelector
6090
77dfb33df61a *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6089
diff changeset
   249
77dfb33df61a *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6089
diff changeset
   250
    "
12854
3a3d3c02c3bd *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 12695
diff changeset
   251
     Method methodDefinitionTemplateForSelector:#foo
3a3d3c02c3bd *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 12695
diff changeset
   252
     Method methodDefinitionTemplateForSelector:#+
3a3d3c02c3bd *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 12695
diff changeset
   253
     Method methodDefinitionTemplateForSelector:#foo:bar:baz:
6090
77dfb33df61a *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6089
diff changeset
   254
    "
77dfb33df61a *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6089
diff changeset
   255
!
77dfb33df61a *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6089
diff changeset
   256
77dfb33df61a *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6089
diff changeset
   257
methodDefinitionTemplateForSelector:aSelector andArgumentNames:argNames
77dfb33df61a *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6089
diff changeset
   258
    "given a selector, return a prototype definition string"
77dfb33df61a *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6089
diff changeset
   259
14375
aa9b2d741a7b changed:
Claus Gittinger <cg@exept.de>
parents: 14357
diff changeset
   260
    ^ self programmingLanguage 
aa9b2d741a7b changed:
Claus Gittinger <cg@exept.de>
parents: 14357
diff changeset
   261
        methodDefinitionTemplateForSelector:aSelector andArgumentNames:argNames
6089
a3710756f360 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6071
diff changeset
   262
a3710756f360 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6071
diff changeset
   263
    "
14375
aa9b2d741a7b changed:
Claus Gittinger <cg@exept.de>
parents: 14357
diff changeset
   264
     Method methodDefinitionTemplateForSelector:#foo          andArgumentNames:#() 
12854
3a3d3c02c3bd *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 12695
diff changeset
   265
     Method methodDefinitionTemplateForSelector:#+            andArgumentNames:#('aNumber')
3a3d3c02c3bd *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 12695
diff changeset
   266
     Method methodDefinitionTemplateForSelector:#foo:bar:baz: andArgumentNames:#('fooArg' 'barArg' 'bazArg')
6089
a3710756f360 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6071
diff changeset
   267
    "
a3710756f360 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6071
diff changeset
   268
!
a3710756f360 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6071
diff changeset
   269
747
ea3b6f7fd7ce added ignoredMethods
Claus Gittinger <cg@exept.de>
parents: 737
diff changeset
   270
methodPrivacySupported
ea3b6f7fd7ce added ignoredMethods
Claus Gittinger <cg@exept.de>
parents: 737
diff changeset
   271
    "return true, if the system was compiled to support methodPrivacy.
ea3b6f7fd7ce added ignoredMethods
Claus Gittinger <cg@exept.de>
parents: 737
diff changeset
   272
     You should not depend on that feature being available."
ea3b6f7fd7ce added ignoredMethods
Claus Gittinger <cg@exept.de>
parents: 737
diff changeset
   273
ea3b6f7fd7ce added ignoredMethods
Claus Gittinger <cg@exept.de>
parents: 737
diff changeset
   274
%{  /* NOCONTEXT */
ea3b6f7fd7ce added ignoredMethods
Claus Gittinger <cg@exept.de>
parents: 737
diff changeset
   275
#if defined(F_PRIVATE) || defined(F_CLASSPRIVATE)
ea3b6f7fd7ce added ignoredMethods
Claus Gittinger <cg@exept.de>
parents: 737
diff changeset
   276
    RETURN (true);
ea3b6f7fd7ce added ignoredMethods
Claus Gittinger <cg@exept.de>
parents: 737
diff changeset
   277
#else
ea3b6f7fd7ce added ignoredMethods
Claus Gittinger <cg@exept.de>
parents: 737
diff changeset
   278
    RETURN (false);
ea3b6f7fd7ce added ignoredMethods
Claus Gittinger <cg@exept.de>
parents: 737
diff changeset
   279
#endif
ea3b6f7fd7ce added ignoredMethods
Claus Gittinger <cg@exept.de>
parents: 737
diff changeset
   280
%}
3342
8bcf0fc80a21 class method #resourceTypes re-added
tz
parents: 3341
diff changeset
   281
!
8bcf0fc80a21 class method #resourceTypes re-added
tz
parents: 3341
diff changeset
   282
8bcf0fc80a21 class method #resourceTypes re-added
tz
parents: 3341
diff changeset
   283
resourceTypes
8bcf0fc80a21 class method #resourceTypes re-added
tz
parents: 3341
diff changeset
   284
    "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
   285
8526
326e7dcb212a *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 8518
diff changeset
   286
    ^ #(canvas menu image fileImage help hierarchicalList tabList tableColumns)
3
24d81bf47225 *** empty log message ***
claus
parents: 2
diff changeset
   287
! !
24d81bf47225 *** empty log message ***
claus
parents: 2
diff changeset
   288
1775
6892b91ddc0b F_CALLED flag is no longer present
Claus Gittinger <cg@exept.de>
parents: 1692
diff changeset
   289
!Method class methodsFor:'special'!
957
b405ae99d437 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 952
diff changeset
   290
14039
30251b45156a added: #flushParseTreeCache
Claus Gittinger <cg@exept.de>
parents: 13847
diff changeset
   291
flushParseTreeCache
30251b45156a added: #flushParseTreeCache
Claus Gittinger <cg@exept.de>
parents: 13847
diff changeset
   292
    "used by lint and the compiler"
30251b45156a added: #flushParseTreeCache
Claus Gittinger <cg@exept.de>
parents: 13847
diff changeset
   293
30251b45156a added: #flushParseTreeCache
Claus Gittinger <cg@exept.de>
parents: 13847
diff changeset
   294
    LastParseTreeCache := nil
30251b45156a added: #flushParseTreeCache
Claus Gittinger <cg@exept.de>
parents: 13847
diff changeset
   295
30251b45156a added: #flushParseTreeCache
Claus Gittinger <cg@exept.de>
parents: 13847
diff changeset
   296
    "
30251b45156a added: #flushParseTreeCache
Claus Gittinger <cg@exept.de>
parents: 13847
diff changeset
   297
     Method flushParseTreeCache
30251b45156a added: #flushParseTreeCache
Claus Gittinger <cg@exept.de>
parents: 13847
diff changeset
   298
    "
30251b45156a added: #flushParseTreeCache
Claus Gittinger <cg@exept.de>
parents: 13847
diff changeset
   299
30251b45156a added: #flushParseTreeCache
Claus Gittinger <cg@exept.de>
parents: 13847
diff changeset
   300
    "Created: / 01-03-2012 / 16:45:34 / cg"
30251b45156a added: #flushParseTreeCache
Claus Gittinger <cg@exept.de>
parents: 13847
diff changeset
   301
!
30251b45156a added: #flushParseTreeCache
Claus Gittinger <cg@exept.de>
parents: 13847
diff changeset
   302
957
b405ae99d437 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 952
diff changeset
   303
flushSourceStreamCache
11663
6ef3b25bd306 changed #sourceStream - honor lock
Stefan Vogel <sv@exept.de>
parents: 11428
diff changeset
   304
    LastFileLock critical:[
13662
7d7ae1e5f589 changed: #annotationAtIndex:
Claus Gittinger <cg@exept.de>
parents: 13660
diff changeset
   305
        LastSourceFileName := LastMethodSources := nil.
7d7ae1e5f589 changed: #annotationAtIndex:
Claus Gittinger <cg@exept.de>
parents: 13660
diff changeset
   306
        LastFileReference at:1 put:0.
11663
6ef3b25bd306 changed #sourceStream - honor lock
Stefan Vogel <sv@exept.de>
parents: 11428
diff changeset
   307
    ].
957
b405ae99d437 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 952
diff changeset
   308
7830
a19d3746255f comment
Claus Gittinger <cg@exept.de>
parents: 7771
diff changeset
   309
    "
a19d3746255f comment
Claus Gittinger <cg@exept.de>
parents: 7771
diff changeset
   310
     Method flushSourceStreamCache
a19d3746255f comment
Claus Gittinger <cg@exept.de>
parents: 7771
diff changeset
   311
    "
a19d3746255f comment
Claus Gittinger <cg@exept.de>
parents: 7771
diff changeset
   312
957
b405ae99d437 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 952
diff changeset
   313
    "Created: 9.2.1996 / 19:05:28 / cg"
b405ae99d437 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 952
diff changeset
   314
! !
b405ae99d437 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 952
diff changeset
   315
13657
206c6696707b added: #trapMethodForNumArgs:
Claus Gittinger <cg@exept.de>
parents: 13651
diff changeset
   316
!Method class methodsFor:'trap methods'!
206c6696707b added: #trapMethodForNumArgs:
Claus Gittinger <cg@exept.de>
parents: 13651
diff changeset
   317
206c6696707b added: #trapMethodForNumArgs:
Claus Gittinger <cg@exept.de>
parents: 13651
diff changeset
   318
trapMethodForNumArgs:numArgs
13805
dec466a100bc changed: #trapMethodForNumArgs:
Claus Gittinger <cg@exept.de>
parents: 13693
diff changeset
   319
    "return a method which will raise an invalid code object exception.
dec466a100bc changed: #trapMethodForNumArgs:
Claus Gittinger <cg@exept.de>
parents: 13693
diff changeset
   320
     Before recompiling methods (due to changed variable scopes, for example),
dec466a100bc changed: #trapMethodForNumArgs:
Claus Gittinger <cg@exept.de>
parents: 13693
diff changeset
   321
     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
   322
     remains in the method to make it trap, whenever executed later.
dec466a100bc changed: #trapMethodForNumArgs:
Claus Gittinger <cg@exept.de>
parents: 13693
diff changeset
   323
     Otherwise, if recompilation succeeeds, that code will vanish after the compile"
dec466a100bc changed: #trapMethodForNumArgs:
Claus Gittinger <cg@exept.de>
parents: 13693
diff changeset
   324
dec466a100bc changed: #trapMethodForNumArgs:
Claus Gittinger <cg@exept.de>
parents: 13693
diff changeset
   325
    |trapSel trapMethod|
13657
206c6696707b added: #trapMethodForNumArgs:
Claus Gittinger <cg@exept.de>
parents: 13651
diff changeset
   326
206c6696707b added: #trapMethodForNumArgs:
Claus Gittinger <cg@exept.de>
parents: 13651
diff changeset
   327
    trapSel := #(
16261
52a0604a7b95 class: Method
Stefan Vogel <sv@exept.de>
parents: 16221
diff changeset
   328
                   invalidCodeObject
52a0604a7b95 class: Method
Stefan Vogel <sv@exept.de>
parents: 16221
diff changeset
   329
                   invalidCodeObjectWith: 
52a0604a7b95 class: Method
Stefan Vogel <sv@exept.de>
parents: 16221
diff changeset
   330
                   invalidCodeObjectWith:with: 
52a0604a7b95 class: Method
Stefan Vogel <sv@exept.de>
parents: 16221
diff changeset
   331
                   invalidCodeObjectWith:with:with: 
52a0604a7b95 class: Method
Stefan Vogel <sv@exept.de>
parents: 16221
diff changeset
   332
                   invalidCodeObjectWith:with:with:with: 
52a0604a7b95 class: Method
Stefan Vogel <sv@exept.de>
parents: 16221
diff changeset
   333
                   invalidCodeObjectWith:with:with:with:with: 
52a0604a7b95 class: Method
Stefan Vogel <sv@exept.de>
parents: 16221
diff changeset
   334
                   invalidCodeObjectWith:with:with:with:with:with: 
52a0604a7b95 class: Method
Stefan Vogel <sv@exept.de>
parents: 16221
diff changeset
   335
                   invalidCodeObjectWith:with:with:with:with:with:with: 
52a0604a7b95 class: Method
Stefan Vogel <sv@exept.de>
parents: 16221
diff changeset
   336
                   invalidCodeObjectWith:with:with:with:with:with:with:with: 
52a0604a7b95 class: Method
Stefan Vogel <sv@exept.de>
parents: 16221
diff changeset
   337
                   invalidCodeObjectWith:with:with:with:with:with:with:with:with: 
52a0604a7b95 class: Method
Stefan Vogel <sv@exept.de>
parents: 16221
diff changeset
   338
                   invalidCodeObjectWith:with:with:with:with:with:with:with:with:with: 
52a0604a7b95 class: Method
Stefan Vogel <sv@exept.de>
parents: 16221
diff changeset
   339
                   invalidCodeObjectWith:with:with:with:with:with:with:with:with:with:with: 
52a0604a7b95 class: Method
Stefan Vogel <sv@exept.de>
parents: 16221
diff changeset
   340
                   invalidCodeObjectWith:with:with:with:with:with:with:with:with:with:with:with: 
52a0604a7b95 class: Method
Stefan Vogel <sv@exept.de>
parents: 16221
diff changeset
   341
                   invalidCodeObjectWith:with:with:with:with:with:with:with:with:with:with:with:with: 
52a0604a7b95 class: Method
Stefan Vogel <sv@exept.de>
parents: 16221
diff changeset
   342
                   invalidCodeObjectWith:with:with:with:with:with:with:with:with:with:with:with:with:with: 
52a0604a7b95 class: Method
Stefan Vogel <sv@exept.de>
parents: 16221
diff changeset
   343
                   invalidCodeObjectWith:with:with:with:with:with:with:with:with:with:with:with:with:with:with: 
13662
7d7ae1e5f589 changed: #annotationAtIndex:
Claus Gittinger <cg@exept.de>
parents: 13660
diff changeset
   344
                ) at:(numArgs + 1).
13657
206c6696707b added: #trapMethodForNumArgs:
Claus Gittinger <cg@exept.de>
parents: 13651
diff changeset
   345
13805
dec466a100bc changed: #trapMethodForNumArgs:
Claus Gittinger <cg@exept.de>
parents: 13693
diff changeset
   346
    (trapMethod := self compiledMethodAt:trapSel) isNil ifTrue:[
dec466a100bc changed: #trapMethodForNumArgs:
Claus Gittinger <cg@exept.de>
parents: 13693
diff changeset
   347
        trapMethod := Method compiledMethodAt:trapSel.
dec466a100bc changed: #trapMethodForNumArgs:
Claus Gittinger <cg@exept.de>
parents: 13693
diff changeset
   348
    ].
dec466a100bc changed: #trapMethodForNumArgs:
Claus Gittinger <cg@exept.de>
parents: 13693
diff changeset
   349
    ^ trapMethod.
13657
206c6696707b added: #trapMethodForNumArgs:
Claus Gittinger <cg@exept.de>
parents: 13651
diff changeset
   350
16261
52a0604a7b95 class: Method
Stefan Vogel <sv@exept.de>
parents: 16221
diff changeset
   351
    "
52a0604a7b95 class: Method
Stefan Vogel <sv@exept.de>
parents: 16221
diff changeset
   352
        self trapMethodForNumArgs:2
52a0604a7b95 class: Method
Stefan Vogel <sv@exept.de>
parents: 16221
diff changeset
   353
    "
52a0604a7b95 class: Method
Stefan Vogel <sv@exept.de>
parents: 16221
diff changeset
   354
13657
206c6696707b added: #trapMethodForNumArgs:
Claus Gittinger <cg@exept.de>
parents: 13651
diff changeset
   355
    "Created: / 04-11-1996 / 21:58:58 / cg"
13693
16c890248840 added: #invalidCodeObjectWith:
sr
parents: 13683
diff changeset
   356
    "Modified: / 14-09-2011 / 11:23:09 / sr"
13805
dec466a100bc changed: #trapMethodForNumArgs:
Claus Gittinger <cg@exept.de>
parents: 13693
diff changeset
   357
    "Modified (comment): / 30-10-2011 / 11:04:24 / cg"
13657
206c6696707b added: #trapMethodForNumArgs:
Claus Gittinger <cg@exept.de>
parents: 13651
diff changeset
   358
! !
206c6696707b added: #trapMethodForNumArgs:
Claus Gittinger <cg@exept.de>
parents: 13651
diff changeset
   359
13634
40d6d6b5d9f0 added: #pragmas
Claus Gittinger <cg@exept.de>
parents: 13629
diff changeset
   360
!Method methodsFor:'Compatibility-Squeak'!
40d6d6b5d9f0 added: #pragmas
Claus Gittinger <cg@exept.de>
parents: 13629
diff changeset
   361
14161
3b44e4394070 added: #isCompiledMethod
Claus Gittinger <cg@exept.de>
parents: 14152
diff changeset
   362
isCompiledMethod
3b44e4394070 added: #isCompiledMethod
Claus Gittinger <cg@exept.de>
parents: 14152
diff changeset
   363
    ^ true
3b44e4394070 added: #isCompiledMethod
Claus Gittinger <cg@exept.de>
parents: 14152
diff changeset
   364
3b44e4394070 added: #isCompiledMethod
Claus Gittinger <cg@exept.de>
parents: 14152
diff changeset
   365
    "Created: / 13-06-2012 / 14:51:19 / cg"
3b44e4394070 added: #isCompiledMethod
Claus Gittinger <cg@exept.de>
parents: 14152
diff changeset
   366
!
3b44e4394070 added: #isCompiledMethod
Claus Gittinger <cg@exept.de>
parents: 14152
diff changeset
   367
13676
a45e94212639 added: #pragmaAt:
Claus Gittinger <cg@exept.de>
parents: 13662
diff changeset
   368
pragmaAt:aKey
a45e94212639 added: #pragmaAt:
Claus Gittinger <cg@exept.de>
parents: 13662
diff changeset
   369
    ^ self annotationAt:aKey
a45e94212639 added: #pragmaAt:
Claus Gittinger <cg@exept.de>
parents: 13662
diff changeset
   370
a45e94212639 added: #pragmaAt:
Claus Gittinger <cg@exept.de>
parents: 13662
diff changeset
   371
    "Created: / 11-09-2011 / 18:09:05 / cg"
a45e94212639 added: #pragmaAt:
Claus Gittinger <cg@exept.de>
parents: 13662
diff changeset
   372
!
a45e94212639 added: #pragmaAt:
Claus Gittinger <cg@exept.de>
parents: 13662
diff changeset
   373
13634
40d6d6b5d9f0 added: #pragmas
Claus Gittinger <cg@exept.de>
parents: 13629
diff changeset
   374
pragmas
16193
004fe3b584a7 class: Method
Claus Gittinger <cg@exept.de>
parents: 16130
diff changeset
   375
    "for squeak compatibility, we only present real pragmas"
004fe3b584a7 class: Method
Claus Gittinger <cg@exept.de>
parents: 16130
diff changeset
   376
004fe3b584a7 class: Method
Claus Gittinger <cg@exept.de>
parents: 16130
diff changeset
   377
    ^ (self annotations ? #()) select:[:a | a isArray not and:[ a isResource not ] ]
13679
3fd763ff0911 added: #propertyValueAt:
Claus Gittinger <cg@exept.de>
parents: 13676
diff changeset
   378
!
3fd763ff0911 added: #propertyValueAt:
Claus Gittinger <cg@exept.de>
parents: 13676
diff changeset
   379
3fd763ff0911 added: #propertyValueAt:
Claus Gittinger <cg@exept.de>
parents: 13676
diff changeset
   380
propertyValueAt:aKey
3fd763ff0911 added: #propertyValueAt:
Claus Gittinger <cg@exept.de>
parents: 13676
diff changeset
   381
    "for now - no properties"
3fd763ff0911 added: #propertyValueAt:
Claus Gittinger <cg@exept.de>
parents: 13676
diff changeset
   382
3fd763ff0911 added: #propertyValueAt:
Claus Gittinger <cg@exept.de>
parents: 13676
diff changeset
   383
    ^ nil
3fd763ff0911 added: #propertyValueAt:
Claus Gittinger <cg@exept.de>
parents: 13676
diff changeset
   384
3fd763ff0911 added: #propertyValueAt:
Claus Gittinger <cg@exept.de>
parents: 13676
diff changeset
   385
    "Created: / 12-09-2011 / 08:42:02 / cg"
13634
40d6d6b5d9f0 added: #pragmas
Claus Gittinger <cg@exept.de>
parents: 13629
diff changeset
   386
! !
13422
b43a8a47037c Jan's changes
vrany
parents: 13390
diff changeset
   387
7261
f35fc9cee675 method category rename
Claus Gittinger <cg@exept.de>
parents: 7258
diff changeset
   388
!Method methodsFor:'Compatibility-VW'!
5967
ab762bb4f64f added #sendsSelector:
Claus Gittinger <cg@exept.de>
parents: 5959
diff changeset
   389
11146
553e658691d2 +classIsMeta
Claus Gittinger <cg@exept.de>
parents: 11066
diff changeset
   390
classIsMeta
553e658691d2 +classIsMeta
Claus Gittinger <cg@exept.de>
parents: 11066
diff changeset
   391
    "return true, if this method is a class method"
553e658691d2 +classIsMeta
Claus Gittinger <cg@exept.de>
parents: 11066
diff changeset
   392
12854
3a3d3c02c3bd *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 12695
diff changeset
   393
    ^ self mclass isMeta
11146
553e658691d2 +classIsMeta
Claus Gittinger <cg@exept.de>
parents: 11066
diff changeset
   394
!
553e658691d2 +classIsMeta
Claus Gittinger <cg@exept.de>
parents: 11066
diff changeset
   395
5967
ab762bb4f64f added #sendsSelector:
Claus Gittinger <cg@exept.de>
parents: 5959
diff changeset
   396
sendsSelector:aSelectorSymbol
ab762bb4f64f added #sendsSelector:
Claus Gittinger <cg@exept.de>
parents: 5959
diff changeset
   397
    "return true, if this method contains a message-send
ab762bb4f64f added #sendsSelector:
Claus Gittinger <cg@exept.de>
parents: 5959
diff changeset
   398
     with aSelectorSymbol as selector."
ab762bb4f64f added #sendsSelector:
Claus Gittinger <cg@exept.de>
parents: 5959
diff changeset
   399
ab762bb4f64f added #sendsSelector:
Claus Gittinger <cg@exept.de>
parents: 5959
diff changeset
   400
    ^ self sends:aSelectorSymbol
ab762bb4f64f added #sendsSelector:
Claus Gittinger <cg@exept.de>
parents: 5959
diff changeset
   401
! !
ab762bb4f64f added #sendsSelector:
Claus Gittinger <cg@exept.de>
parents: 5959
diff changeset
   402
9096
84df3b129718 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9075
diff changeset
   403
1
a27a279701f8 Initial revision
claus
parents:
diff changeset
   404
!Method methodsFor:'accessing'!
a27a279701f8 Initial revision
claus
parents:
diff changeset
   405
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
   406
category
d600e08a5936 handle the case where a method has a sourceFileInfo, but the class has not
Claus Gittinger <cg@exept.de>
parents: 934
diff changeset
   407
    "return the methods category or nil"
737
4ed893ad3f0f try more to find source of obsolete methods
Claus Gittinger <cg@exept.de>
parents: 690
diff changeset
   408
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
   409
    ^ category
1
a27a279701f8 Initial revision
claus
parents:
diff changeset
   410
!
a27a279701f8 Initial revision
claus
parents:
diff changeset
   411
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
   412
category:aStringOrSymbol
d600e08a5936 handle the case where a method has a sourceFileInfo, but the class has not
Claus Gittinger <cg@exept.de>
parents: 934
diff changeset
   413
    "set the methods category"
1
a27a279701f8 Initial revision
claus
parents:
diff changeset
   414
5724
96c2a5cf4217 category: and package: now send change notifications.
Claus Gittinger <cg@exept.de>
parents: 5721
diff changeset
   415
    |newCategory oldCategory cls|
5721
5f97733ff519 methods now send change-notifications when the category changes
Claus Gittinger <cg@exept.de>
parents: 5704
diff changeset
   416
3934
a8c6075f9988 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 3845
diff changeset
   417
    aStringOrSymbol notNil ifTrue:[
13662
7d7ae1e5f589 changed: #annotationAtIndex:
Claus Gittinger <cg@exept.de>
parents: 13660
diff changeset
   418
        newCategory := aStringOrSymbol.
7d7ae1e5f589 changed: #annotationAtIndex:
Claus Gittinger <cg@exept.de>
parents: 13660
diff changeset
   419
        newCategory ~= (oldCategory := category) ifTrue:[
7d7ae1e5f589 changed: #annotationAtIndex:
Claus Gittinger <cg@exept.de>
parents: 13660
diff changeset
   420
            self setCategory:newCategory.
7d7ae1e5f589 changed: #annotationAtIndex:
Claus Gittinger <cg@exept.de>
parents: 13660
diff changeset
   421
7d7ae1e5f589 changed: #annotationAtIndex:
Claus Gittinger <cg@exept.de>
parents: 13660
diff changeset
   422
            cls := self mclass.
7d7ae1e5f589 changed: #annotationAtIndex:
Claus Gittinger <cg@exept.de>
parents: 13660
diff changeset
   423
            cls notNil ifTrue:[
7d7ae1e5f589 changed: #annotationAtIndex:
Claus Gittinger <cg@exept.de>
parents: 13660
diff changeset
   424
                cls addChangeRecordForMethodCategory:self category:newCategory.
7d7ae1e5f589 changed: #annotationAtIndex:
Claus Gittinger <cg@exept.de>
parents: 13660
diff changeset
   425
                self changed:#category with:oldCategory.            "/ will vanish
7d7ae1e5f589 changed: #annotationAtIndex:
Claus Gittinger <cg@exept.de>
parents: 13660
diff changeset
   426
                cls changed:#organization with:self selector.       "/ will vanish
7d7ae1e5f589 changed: #annotationAtIndex:
Claus Gittinger <cg@exept.de>
parents: 13660
diff changeset
   427
                Smalltalk changed:#methodCategory with:(Array with:cls with:self with:oldCategory).
7d7ae1e5f589 changed: #annotationAtIndex:
Claus Gittinger <cg@exept.de>
parents: 13660
diff changeset
   428
            ]
7d7ae1e5f589 changed: #annotationAtIndex:
Claus Gittinger <cg@exept.de>
parents: 13660
diff changeset
   429
        ]
3934
a8c6075f9988 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 3845
diff changeset
   430
    ]
a8c6075f9988 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 3845
diff changeset
   431
10729
16fea9f03635 changed #category:
Claus Gittinger <cg@exept.de>
parents: 10673
diff changeset
   432
    "Modified: / 25-09-2007 / 16:15:24 / cg"
1
a27a279701f8 Initial revision
claus
parents:
diff changeset
   433
!
a27a279701f8 Initial revision
claus
parents:
diff changeset
   434
39
bcf183a31bbb *** empty log message ***
claus
parents: 13
diff changeset
   435
comment
bcf183a31bbb *** empty log message ***
claus
parents: 13
diff changeset
   436
    "return the methods comment.
68
59faa75185ba *** empty log message ***
claus
parents: 56
diff changeset
   437
     This is done by searching for and returning the first comment
12854
3a3d3c02c3bd *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 12695
diff changeset
   438
     from the methods source (excluding any double-quotes).
68
59faa75185ba *** empty log message ***
claus
parents: 56
diff changeset
   439
     Returns nil if there is no comment (or source is not available)."
39
bcf183a31bbb *** empty log message ***
claus
parents: 13
diff changeset
   440
14152
4b6500ff4bec changed: #comment
Claus Gittinger <cg@exept.de>
parents: 14090
diff changeset
   441
    |src parserClass|
39
bcf183a31bbb *** empty log message ***
claus
parents: 13
diff changeset
   442
159
514c749165c3 *** empty log message ***
claus
parents: 142
diff changeset
   443
    src := self source.
514c749165c3 *** empty log message ***
claus
parents: 142
diff changeset
   444
    src isNil ifTrue:[^ nil].
14152
4b6500ff4bec changed: #comment
Claus Gittinger <cg@exept.de>
parents: 14090
diff changeset
   445
    (parserClass := self programmingLanguage parserClass) isNil ifTrue:[^ nil].
4b6500ff4bec changed: #comment
Claus Gittinger <cg@exept.de>
parents: 14090
diff changeset
   446
    ^ parserClass methodCommentFromSource:src
93
e31220cb391f *** empty log message ***
claus
parents: 88
diff changeset
   447
e31220cb391f *** empty log message ***
claus
parents: 88
diff changeset
   448
    "
13463
7c98583d98c8 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 13422
diff changeset
   449
     (Method compiledMethodAt:#comment) comment
12854
3a3d3c02c3bd *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 12695
diff changeset
   450
     (Object class compiledMethodAt:#infoPrinting:) comment
93
e31220cb391f *** empty log message ***
claus
parents: 88
diff changeset
   451
    "
1236
5c9bc68e3c71 use new scanner feature to extract comment
Claus Gittinger <cg@exept.de>
parents: 1194
diff changeset
   452
12948
f238e8b26110 changed: #comment
Claus Gittinger <cg@exept.de>
parents: 12913
diff changeset
   453
    "Modified: / 23-02-1998 / 10:26:08 / stefan"
14152
4b6500ff4bec changed: #comment
Claus Gittinger <cg@exept.de>
parents: 14090
diff changeset
   454
    "Modified: / 01-06-2012 / 23:03:57 / cg"
39
bcf183a31bbb *** empty log message ***
claus
parents: 13
diff changeset
   455
!
bcf183a31bbb *** empty log message ***
claus
parents: 13
diff changeset
   456
14595
5c27c812055b class: Method
Claus Gittinger <cg@exept.de>
parents: 14573
diff changeset
   457
getMclass
5c27c812055b class: Method
Claus Gittinger <cg@exept.de>
parents: 14573
diff changeset
   458
    ^ mclass 
5c27c812055b class: Method
Claus Gittinger <cg@exept.de>
parents: 14573
diff changeset
   459
!
5c27c812055b class: Method
Claus Gittinger <cg@exept.de>
parents: 14573
diff changeset
   460
9702
468675f92260 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9692
diff changeset
   461
getPackage
468675f92260 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9692
diff changeset
   462
    "return the package-ID of the method"
468675f92260 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9692
diff changeset
   463
468675f92260 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9692
diff changeset
   464
    ^ package
468675f92260 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9692
diff changeset
   465
!
468675f92260 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9692
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
getSource
3160
db5c1aa38fda comment
Claus Gittinger <cg@exept.de>
parents: 3144
diff changeset
   468
    "low-level access to the source instance-variable.
4751
174a92d4ba3f checkin from browser
Claus Gittinger <cg@exept.de>
parents: 4669
diff changeset
   469
     For internal (compiler) use only.
3160
db5c1aa38fda comment
Claus Gittinger <cg@exept.de>
parents: 3144
diff changeset
   470
     This is NOT always the methods source string"
db5c1aa38fda comment
Claus Gittinger <cg@exept.de>
parents: 3144
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
    ^ source
414
claus
parents: 400
diff changeset
   473
!
claus
parents: 400
diff changeset
   474
4751
174a92d4ba3f checkin from browser
Claus Gittinger <cg@exept.de>
parents: 4669
diff changeset
   475
getSourcePosition
174a92d4ba3f checkin from browser
Claus Gittinger <cg@exept.de>
parents: 4669
diff changeset
   476
    "low-level access to the sourcePosition instance-variable.
174a92d4ba3f checkin from browser
Claus Gittinger <cg@exept.de>
parents: 4669
diff changeset
   477
     For internal (compiler) use only.
174a92d4ba3f checkin from browser
Claus Gittinger <cg@exept.de>
parents: 4669
diff changeset
   478
     This is NOT always the methods sourcePosition"
174a92d4ba3f checkin from browser
Claus Gittinger <cg@exept.de>
parents: 4669
diff changeset
   479
174a92d4ba3f checkin from browser
Claus Gittinger <cg@exept.de>
parents: 4669
diff changeset
   480
    ^ sourcePosition
174a92d4ba3f checkin from browser
Claus Gittinger <cg@exept.de>
parents: 4669
diff changeset
   481
!
174a92d4ba3f checkin from browser
Claus Gittinger <cg@exept.de>
parents: 4669
diff changeset
   482
2176
1a24b0cef25a when compressing sources, make certain to avoid later
Claus Gittinger <cg@exept.de>
parents: 2171
diff changeset
   483
localSourceFilename:aFileName position:aNumber
15346
c8f751f80e5b class: Method
Claus Gittinger <cg@exept.de>
parents: 15245
diff changeset
   484
    "set the method's sourcefile/position indicating, that
c8f751f80e5b class: Method
Claus Gittinger <cg@exept.de>
parents: 15245
diff changeset
   485
     this is a local file (i.e. the 'st.src' file).
c8f751f80e5b class: Method
Claus Gittinger <cg@exept.de>
parents: 15245
diff changeset
   486
     The indicator for this is a negative source position."
c8f751f80e5b class: Method
Claus Gittinger <cg@exept.de>
parents: 15245
diff changeset
   487
c8f751f80e5b class: Method
Claus Gittinger <cg@exept.de>
parents: 15245
diff changeset
   488
    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
   489
    source := aFileName.
1a24b0cef25a when compressing sources, make certain to avoid later
Claus Gittinger <cg@exept.de>
parents: 2171
diff changeset
   490
    sourcePosition := aNumber negated
1a24b0cef25a when compressing sources, make certain to avoid later
Claus Gittinger <cg@exept.de>
parents: 2171
diff changeset
   491
1a24b0cef25a when compressing sources, make certain to avoid later
Claus Gittinger <cg@exept.de>
parents: 2171
diff changeset
   492
    "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
   493
!
1a24b0cef25a when compressing sources, make certain to avoid later
Claus Gittinger <cg@exept.de>
parents: 2171
diff changeset
   494
13422
b43a8a47037c Jan's changes
vrany
parents: 13390
diff changeset
   495
lookupObject
b43a8a47037c Jan's changes
vrany
parents: 13390
diff changeset
   496
13817
7d1e0e8ea364 changed:10 methods
Claus Gittinger <cg@exept.de>
parents: 13805
diff changeset
   497
    ^lookupObject isNil ifTrue:[Lookup builtin].
13422
b43a8a47037c Jan's changes
vrany
parents: 13390
diff changeset
   498
b43a8a47037c Jan's changes
vrany
parents: 13390
diff changeset
   499
    "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
   500
    "Modified: / 18-11-2011 / 14:47:12 / cg"
13422
b43a8a47037c Jan's changes
vrany
parents: 13390
diff changeset
   501
!
b43a8a47037c Jan's changes
vrany
parents: 13390
diff changeset
   502
b43a8a47037c Jan's changes
vrany
parents: 13390
diff changeset
   503
lookupObject: anObject
b43a8a47037c Jan's changes
vrany
parents: 13390
diff changeset
   504
b43a8a47037c Jan's changes
vrany
parents: 13390
diff changeset
   505
    self setLookupObject: anObject.
b43a8a47037c Jan's changes
vrany
parents: 13390
diff changeset
   506
b43a8a47037c Jan's changes
vrany
parents: 13390
diff changeset
   507
    "Created: / 28-04-2010 / 18:36:07 / Jan Vrany <jan.vrany@fit.cvut.cz>"
b43a8a47037c Jan's changes
vrany
parents: 13390
diff changeset
   508
    "Modified: / 11-07-2010 / 19:32:28 / Jan Vrany <jan.vrany@fit.cvut.cz>"
b43a8a47037c Jan's changes
vrany
parents: 13390
diff changeset
   509
!
b43a8a47037c Jan's changes
vrany
parents: 13390
diff changeset
   510
5152
2aacfb3976d4 when changing the package, make certain that the source
Claus Gittinger <cg@exept.de>
parents: 5115
diff changeset
   511
makeLocalStringSource
2aacfb3976d4 when changing the package, make certain that the source
Claus Gittinger <cg@exept.de>
parents: 5115
diff changeset
   512
    "assure that the methods source code is stored locally as a string
2aacfb3976d4 when changing the package, make certain that the source
Claus Gittinger <cg@exept.de>
parents: 5115
diff changeset
   513
     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
   514
     by reading the source code file).
15346
c8f751f80e5b class: Method
Claus Gittinger <cg@exept.de>
parents: 15245
diff changeset
   515
     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
   516
     sourceCode is not lost."
2aacfb3976d4 when changing the package, make certain that the source
Claus Gittinger <cg@exept.de>
parents: 5115
diff changeset
   517
2aacfb3976d4 when changing the package, make certain that the source
Claus Gittinger <cg@exept.de>
parents: 5115
diff changeset
   518
    source notNil ifTrue:[
13662
7d7ae1e5f589 changed: #annotationAtIndex:
Claus Gittinger <cg@exept.de>
parents: 13660
diff changeset
   519
        sourcePosition notNil ifTrue:[
7d7ae1e5f589 changed: #annotationAtIndex:
Claus Gittinger <cg@exept.de>
parents: 13660
diff changeset
   520
            "/ this looks wierd - but (self source) will retrieve the external source
7d7ae1e5f589 changed: #annotationAtIndex:
Claus Gittinger <cg@exept.de>
parents: 13660
diff changeset
   521
            "/ (from the file) and store it. So afterwards, we will have the string and
7d7ae1e5f589 changed: #annotationAtIndex:
Claus Gittinger <cg@exept.de>
parents: 13660
diff changeset
   522
            "/ sourcePosition will be nil
7d7ae1e5f589 changed: #annotationAtIndex:
Claus Gittinger <cg@exept.de>
parents: 13660
diff changeset
   523
            self source:(self source)
7d7ae1e5f589 changed: #annotationAtIndex:
Claus Gittinger <cg@exept.de>
parents: 13660
diff changeset
   524
        ]
5152
2aacfb3976d4 when changing the package, make certain that the source
Claus Gittinger <cg@exept.de>
parents: 5115
diff changeset
   525
    ].
2aacfb3976d4 when changing the package, make certain that the source
Claus Gittinger <cg@exept.de>
parents: 5115
diff changeset
   526
!
2aacfb3976d4 when changing the package, make certain that the source
Claus Gittinger <cg@exept.de>
parents: 5115
diff changeset
   527
5324
5c9959ce98af make use of mclass
Claus Gittinger <cg@exept.de>
parents: 5322
diff changeset
   528
mclass:aClass
14508
859dca6352f8 class: Method
Claus Gittinger <cg@exept.de>
parents: 14505
diff changeset
   529
    "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
   530
     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
   531
     possibly be invalidated when mclass is asked for."
859dca6352f8 class: Method
Claus Gittinger <cg@exept.de>
parents: 14505
diff changeset
   532
859dca6352f8 class: Method
Claus Gittinger <cg@exept.de>
parents: 14505
diff changeset
   533
"/    mclass == aClass ifTrue:[ ^ self ].
859dca6352f8 class: Method
Claus Gittinger <cg@exept.de>
parents: 14505
diff changeset
   534
"/
12323
973c8740503b changed: #mclass:
Claus Gittinger <cg@exept.de>
parents: 12283
diff changeset
   535
"/     (mclass notNil and:[aClass notNil]) ifTrue:[
973c8740503b changed: #mclass:
Claus Gittinger <cg@exept.de>
parents: 12283
diff changeset
   536
"/         'Method [warning]: mclass already set' errorPrintCR.
973c8740503b changed: #mclass:
Claus Gittinger <cg@exept.de>
parents: 12283
diff changeset
   537
"/     ].
5696
958a0643496d compatibility
Claus Gittinger <cg@exept.de>
parents: 5676
diff changeset
   538
    mclass := aClass.
10207
b5ca553d15ad localSourceFirst for extensions.
Claus Gittinger <cg@exept.de>
parents: 10201
diff changeset
   539
b5ca553d15ad localSourceFirst for extensions.
Claus Gittinger <cg@exept.de>
parents: 10201
diff changeset
   540
    "Modified: / 28-11-2006 / 12:12:27 / cg"
5696
958a0643496d compatibility
Claus Gittinger <cg@exept.de>
parents: 5676
diff changeset
   541
!
5324
5c9959ce98af make use of mclass
Claus Gittinger <cg@exept.de>
parents: 5322
diff changeset
   542
13422
b43a8a47037c Jan's changes
vrany
parents: 13390
diff changeset
   543
nameSpace
b43a8a47037c Jan's changes
vrany
parents: 13390
diff changeset
   544
    "Returns my namespace or nil. If no explicit method namespace
b43a8a47037c Jan's changes
vrany
parents: 13390
diff changeset
   545
     is set, my programmming language is used as default namespace
b43a8a47037c Jan's changes
vrany
parents: 13390
diff changeset
   546
     (for compatibility reasons, for smalltalk methods nil is returned,
b43a8a47037c Jan's changes
vrany
parents: 13390
diff changeset
   547
     which means that the method is not namespaced).
b43a8a47037c Jan's changes
vrany
parents: 13390
diff changeset
   548
    "
b43a8a47037c Jan's changes
vrany
parents: 13390
diff changeset
   549
14552
3ab1c7006ba1 class: Method
Claus Gittinger <cg@exept.de>
parents: 14536
diff changeset
   550
    | nsA prefix |
14264
fd05137bd3c3 comment/format in: #nameSpace
Claus Gittinger <cg@exept.de>
parents: 14261
diff changeset
   551
13422
b43a8a47037c Jan's changes
vrany
parents: 13390
diff changeset
   552
    nsA := self annotationAt: #namespace:.
14552
3ab1c7006ba1 class: Method
Claus Gittinger <cg@exept.de>
parents: 14536
diff changeset
   553
    nsA notNil ifTrue:[^nsA nameSpace].
3ab1c7006ba1 class: Method
Claus Gittinger <cg@exept.de>
parents: 14536
diff changeset
   554
3ab1c7006ba1 class: Method
Claus Gittinger <cg@exept.de>
parents: 14536
diff changeset
   555
    prefix := self programmingLanguage defaultSelectorNameSpacePrefix.
3ab1c7006ba1 class: Method
Claus Gittinger <cg@exept.de>
parents: 14536
diff changeset
   556
    (prefix isNil or:[prefix = 'Smalltalk']) ifTrue:[ ^ nil].
15045
00763bf986f0 class: Method
Claus Gittinger <cg@exept.de>
parents: 14864
diff changeset
   557
    ^ NameSpace name:prefix
13422
b43a8a47037c Jan's changes
vrany
parents: 13390
diff changeset
   558
b43a8a47037c Jan's changes
vrany
parents: 13390
diff changeset
   559
    "
15045
00763bf986f0 class: Method
Claus Gittinger <cg@exept.de>
parents: 14864
diff changeset
   560
     (Method >> #nameSpace) nameSpace
00763bf986f0 class: Method
Claus Gittinger <cg@exept.de>
parents: 14864
diff changeset
   561
     (Object >> #yourself) nameSpace
13422
b43a8a47037c Jan's changes
vrany
parents: 13390
diff changeset
   562
    "
b43a8a47037c Jan's changes
vrany
parents: 13390
diff changeset
   563
b43a8a47037c Jan's changes
vrany
parents: 13390
diff changeset
   564
    "Created: / 26-04-2010 / 16:30:43 / Jan Vrany <jan.vrany@fit.cvut.cz>"
b43a8a47037c Jan's changes
vrany
parents: 13390
diff changeset
   565
    "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
   566
    "Modified (format): / 27-07-2012 / 14:17:09 / cg"
13422
b43a8a47037c Jan's changes
vrany
parents: 13390
diff changeset
   567
!
b43a8a47037c Jan's changes
vrany
parents: 13390
diff changeset
   568
b43a8a47037c Jan's changes
vrany
parents: 13390
diff changeset
   569
nameSpace: aNameSpace
b43a8a47037c Jan's changes
vrany
parents: 13390
diff changeset
   570
14261
403921157431 changed: #nameSpace:
Claus Gittinger <cg@exept.de>
parents: 14253
diff changeset
   571
    self annotateWith: (Annotation nameSpace: aNameSpace name)
13422
b43a8a47037c Jan's changes
vrany
parents: 13390
diff changeset
   572
b43a8a47037c Jan's changes
vrany
parents: 13390
diff changeset
   573
    "Created: / 20-05-2010 / 10:05:23 / Jan Vrany <jan.vrany@fit.cvut.cz>"
b43a8a47037c Jan's changes
vrany
parents: 13390
diff changeset
   574
    "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
   575
    "Modified: / 26-07-2012 / 23:08:48 / cg"
13422
b43a8a47037c Jan's changes
vrany
parents: 13390
diff changeset
   576
!
b43a8a47037c Jan's changes
vrany
parents: 13390
diff changeset
   577
b43a8a47037c Jan's changes
vrany
parents: 13390
diff changeset
   578
nameSpaceName
b43a8a47037c Jan's changes
vrany
parents: 13390
diff changeset
   579
    | ns |
16261
52a0604a7b95 class: Method
Stefan Vogel <sv@exept.de>
parents: 16221
diff changeset
   580
    ns := self nameSpace.
52a0604a7b95 class: Method
Stefan Vogel <sv@exept.de>
parents: 16221
diff changeset
   581
    ^ ns isNil ifTrue:[''] ifFalse:[ns name]
13422
b43a8a47037c Jan's changes
vrany
parents: 13390
diff changeset
   582
!
b43a8a47037c Jan's changes
vrany
parents: 13390
diff changeset
   583
13100
d5333b6746d1 +originalMethodIfWrapped
Claus Gittinger <cg@exept.de>
parents: 12948
diff changeset
   584
originalMethodIfWrapped
d5333b6746d1 +originalMethodIfWrapped
Claus Gittinger <cg@exept.de>
parents: 12948
diff changeset
   585
    "return the method the receiver is wrapping - none here"
d5333b6746d1 +originalMethodIfWrapped
Claus Gittinger <cg@exept.de>
parents: 12948
diff changeset
   586
d5333b6746d1 +originalMethodIfWrapped
Claus Gittinger <cg@exept.de>
parents: 12948
diff changeset
   587
    ^ self
d5333b6746d1 +originalMethodIfWrapped
Claus Gittinger <cg@exept.de>
parents: 12948
diff changeset
   588
d5333b6746d1 +originalMethodIfWrapped
Claus Gittinger <cg@exept.de>
parents: 12948
diff changeset
   589
    "Created: / 22-10-2010 / 11:46:07 / cg"
d5333b6746d1 +originalMethodIfWrapped
Claus Gittinger <cg@exept.de>
parents: 12948
diff changeset
   590
!
d5333b6746d1 +originalMethodIfWrapped
Claus Gittinger <cg@exept.de>
parents: 12948
diff changeset
   591
13422
b43a8a47037c Jan's changes
vrany
parents: 13390
diff changeset
   592
overriddenMethod
15952
e55b89f8d241 class: Method
Claus Gittinger <cg@exept.de>
parents: 15787
diff changeset
   593
    <resource: #obsolete>
e55b89f8d241 class: Method
Claus Gittinger <cg@exept.de>
parents: 15787
diff changeset
   594
e55b89f8d241 class: Method
Claus Gittinger <cg@exept.de>
parents: 15787
diff changeset
   595
    self obsoleteMethodWarning: 'Use overwrittenMethod instead, stupid naming'.
e55b89f8d241 class: Method
Claus Gittinger <cg@exept.de>
parents: 15787
diff changeset
   596
    ^self overwrittenMethod
e55b89f8d241 class: Method
Claus Gittinger <cg@exept.de>
parents: 15787
diff changeset
   597
e55b89f8d241 class: Method
Claus Gittinger <cg@exept.de>
parents: 15787
diff changeset
   598
    "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
   599
    "Modified (format): / 18-11-2011 / 14:48:07 / cg"
e55b89f8d241 class: Method
Claus Gittinger <cg@exept.de>
parents: 15787
diff changeset
   600
    "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
   601
!
e55b89f8d241 class: Method
Claus Gittinger <cg@exept.de>
parents: 15787
diff changeset
   602
e55b89f8d241 class: Method
Claus Gittinger <cg@exept.de>
parents: 15787
diff changeset
   603
overriddenMethod: aMethod
e55b89f8d241 class: Method
Claus Gittinger <cg@exept.de>
parents: 15787
diff changeset
   604
    <resource: #obsolete>
e55b89f8d241 class: Method
Claus Gittinger <cg@exept.de>
parents: 15787
diff changeset
   605
e55b89f8d241 class: Method
Claus Gittinger <cg@exept.de>
parents: 15787
diff changeset
   606
    self obsoleteMethodWarning: 'Use overwrittenMethod: instead, stupid naming'.
e55b89f8d241 class: Method
Claus Gittinger <cg@exept.de>
parents: 15787
diff changeset
   607
    self overwrittenMethod: aMethod
e55b89f8d241 class: Method
Claus Gittinger <cg@exept.de>
parents: 15787
diff changeset
   608
e55b89f8d241 class: Method
Claus Gittinger <cg@exept.de>
parents: 15787
diff changeset
   609
    "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
   610
    "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
   611
    "Modified: / 18-11-2011 / 14:48:26 / cg"
e55b89f8d241 class: Method
Claus Gittinger <cg@exept.de>
parents: 15787
diff changeset
   612
    "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
   613
!
e55b89f8d241 class: Method
Claus Gittinger <cg@exept.de>
parents: 15787
diff changeset
   614
e55b89f8d241 class: Method
Claus Gittinger <cg@exept.de>
parents: 15787
diff changeset
   615
overwrittenMethod
13422
b43a8a47037c Jan's changes
vrany
parents: 13390
diff changeset
   616
    "Answers overridden method or nil."
b43a8a47037c Jan's changes
vrany
parents: 13390
diff changeset
   617
13817
7d1e0e8ea364 changed:10 methods
Claus Gittinger <cg@exept.de>
parents: 13805
diff changeset
   618
    Overrides isNil ifTrue:[^ nil].
7d1e0e8ea364 changed:10 methods
Claus Gittinger <cg@exept.de>
parents: 13805
diff changeset
   619
    ^ (Overrides includesKey: self)
13662
7d7ae1e5f589 changed: #annotationAtIndex:
Claus Gittinger <cg@exept.de>
parents: 13660
diff changeset
   620
        ifTrue:[Overrides at: self]
13422
b43a8a47037c Jan's changes
vrany
parents: 13390
diff changeset
   621
15952
e55b89f8d241 class: Method
Claus Gittinger <cg@exept.de>
parents: 15787
diff changeset
   622
    "Created: / 05-07-2012 / 10:49:44 / Jan Vrany <jan.vrany@fit.cvut.cz>"
13422
b43a8a47037c Jan's changes
vrany
parents: 13390
diff changeset
   623
!
b43a8a47037c Jan's changes
vrany
parents: 13390
diff changeset
   624
15952
e55b89f8d241 class: Method
Claus Gittinger <cg@exept.de>
parents: 15787
diff changeset
   625
overwrittenMethod: aMethod
13422
b43a8a47037c Jan's changes
vrany
parents: 13390
diff changeset
   626
b43a8a47037c Jan's changes
vrany
parents: 13390
diff changeset
   627
    "Set overridden method to aMethod"
b43a8a47037c Jan's changes
vrany
parents: 13390
diff changeset
   628
13817
7d1e0e8ea364 changed:10 methods
Claus Gittinger <cg@exept.de>
parents: 13805
diff changeset
   629
    Overrides isNil ifTrue:[Overrides := WeakIdentityDictionary new:10].
7d1e0e8ea364 changed:10 methods
Claus Gittinger <cg@exept.de>
parents: 13805
diff changeset
   630
    aMethod notNil ifTrue:[aMethod makeLocalStringSource].
13422
b43a8a47037c Jan's changes
vrany
parents: 13390
diff changeset
   631
    Overrides at: self put: aMethod
b43a8a47037c Jan's changes
vrany
parents: 13390
diff changeset
   632
15952
e55b89f8d241 class: Method
Claus Gittinger <cg@exept.de>
parents: 15787
diff changeset
   633
    "Created: / 05-07-2012 / 10:50:00 / Jan Vrany <jan.vrany@fit.cvut.cz>"
13422
b43a8a47037c Jan's changes
vrany
parents: 13390
diff changeset
   634
!
b43a8a47037c Jan's changes
vrany
parents: 13390
diff changeset
   635
1093
1e742016eea0 category rename / added access to RESOURCE and CALLED flags
Claus Gittinger <cg@exept.de>
parents: 1087
diff changeset
   636
package
14573
f89b1f406974 class: Method
Claus Gittinger <cg@exept.de>
parents: 14552
diff changeset
   637
    "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
   638
5385
7637332d7b38 care for nil package
Claus Gittinger <cg@exept.de>
parents: 5339
diff changeset
   639
    |cls|
7637332d7b38 care for nil package
Claus Gittinger <cg@exept.de>
parents: 5339
diff changeset
   640
7637332d7b38 care for nil package
Claus Gittinger <cg@exept.de>
parents: 5339
diff changeset
   641
    package notNil ifTrue:[ ^ package ].
14573
f89b1f406974 class: Method
Claus Gittinger <cg@exept.de>
parents: 14552
diff changeset
   642
f89b1f406974 class: Method
Claus Gittinger <cg@exept.de>
parents: 14552
diff changeset
   643
    "/ get it from my class
5385
7637332d7b38 care for nil package
Claus Gittinger <cg@exept.de>
parents: 5339
diff changeset
   644
    (cls := self mclass) isNil ifTrue:[
13662
7d7ae1e5f589 changed: #annotationAtIndex:
Claus Gittinger <cg@exept.de>
parents: 13660
diff changeset
   645
        ^ PackageId noProjectID.
5385
7637332d7b38 care for nil package
Claus Gittinger <cg@exept.de>
parents: 5339
diff changeset
   646
    ].
5724
96c2a5cf4217 category: and package: now send change notifications.
Claus Gittinger <cg@exept.de>
parents: 5721
diff changeset
   647
    "/ set it.
9692
d53de4f90660 allow for and hide nil-packageID (== NoProject)
Claus Gittinger <cg@exept.de>
parents: 9661
diff changeset
   648
    package := cls getPackage.
d53de4f90660 allow for and hide nil-packageID (== NoProject)
Claus Gittinger <cg@exept.de>
parents: 9661
diff changeset
   649
    package isNil ifTrue:[
13662
7d7ae1e5f589 changed: #annotationAtIndex:
Claus Gittinger <cg@exept.de>
parents: 13660
diff changeset
   650
        ^ PackageId noProjectID.
9692
d53de4f90660 allow for and hide nil-packageID (== NoProject)
Claus Gittinger <cg@exept.de>
parents: 9661
diff changeset
   651
    ].
d53de4f90660 allow for and hide nil-packageID (== NoProject)
Claus Gittinger <cg@exept.de>
parents: 9661
diff changeset
   652
    ^ package
3950
f9c4485a91d1 avoid nil package return
Claus Gittinger <cg@exept.de>
parents: 3934
diff changeset
   653
10207
b5ca553d15ad localSourceFirst for extensions.
Claus Gittinger <cg@exept.de>
parents: 10201
diff changeset
   654
    "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
   655
!
1e742016eea0 category rename / added access to RESOURCE and CALLED flags
Claus Gittinger <cg@exept.de>
parents: 1087
diff changeset
   656
1e742016eea0 category rename / added access to RESOURCE and CALLED flags
Claus Gittinger <cg@exept.de>
parents: 1087
diff changeset
   657
package:aSymbol
1e742016eea0 category rename / added access to RESOURCE and CALLED flags
Claus Gittinger <cg@exept.de>
parents: 1087
diff changeset
   658
    "set the package-symbol"
1e742016eea0 category rename / added access to RESOURCE and CALLED flags
Claus Gittinger <cg@exept.de>
parents: 1087
diff changeset
   659
9692
d53de4f90660 allow for and hide nil-packageID (== NoProject)
Claus Gittinger <cg@exept.de>
parents: 9661
diff changeset
   660
    |cls oldPackage newPackage|
d53de4f90660 allow for and hide nil-packageID (== NoProject)
Claus Gittinger <cg@exept.de>
parents: 9661
diff changeset
   661
12216
692af7a76600 Project noProjectId -> PackageId noProjectId
Claus Gittinger <cg@exept.de>
parents: 12193
diff changeset
   662
    aSymbol == PackageId noProjectID ifTrue:[
13662
7d7ae1e5f589 changed: #annotationAtIndex:
Claus Gittinger <cg@exept.de>
parents: 13660
diff changeset
   663
        newPackage := nil
9692
d53de4f90660 allow for and hide nil-packageID (== NoProject)
Claus Gittinger <cg@exept.de>
parents: 9661
diff changeset
   664
    ] ifFalse:[
13662
7d7ae1e5f589 changed: #annotationAtIndex:
Claus Gittinger <cg@exept.de>
parents: 13660
diff changeset
   665
        newPackage := aSymbol
9692
d53de4f90660 allow for and hide nil-packageID (== NoProject)
Claus Gittinger <cg@exept.de>
parents: 9661
diff changeset
   666
    ].
d53de4f90660 allow for and hide nil-packageID (== NoProject)
Claus Gittinger <cg@exept.de>
parents: 9661
diff changeset
   667
9713
fc8ef192492f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9702
diff changeset
   668
    package ~~ newPackage ifTrue:[
13662
7d7ae1e5f589 changed: #annotationAtIndex:
Claus Gittinger <cg@exept.de>
parents: 13660
diff changeset
   669
        oldPackage := package.
7d7ae1e5f589 changed: #annotationAtIndex:
Claus Gittinger <cg@exept.de>
parents: 13660
diff changeset
   670
        "/ this is required, because otherwise I would no longer be able to
7d7ae1e5f589 changed: #annotationAtIndex:
Claus Gittinger <cg@exept.de>
parents: 13660
diff changeset
   671
        "/ reconstruct my sourcecode (as the connection to the source-file is lost).
7d7ae1e5f589 changed: #annotationAtIndex:
Claus Gittinger <cg@exept.de>
parents: 13660
diff changeset
   672
        self makeLocalStringSource.
7d7ae1e5f589 changed: #annotationAtIndex:
Claus Gittinger <cg@exept.de>
parents: 13660
diff changeset
   673
        package := newPackage.
7d7ae1e5f589 changed: #annotationAtIndex:
Claus Gittinger <cg@exept.de>
parents: 13660
diff changeset
   674
15952
e55b89f8d241 class: Method
Claus Gittinger <cg@exept.de>
parents: 15787
diff changeset
   675
        cls := self mclass.
e55b89f8d241 class: Method
Claus Gittinger <cg@exept.de>
parents: 15787
diff changeset
   676
        "JV@2011-01-27: BUG FIX: method may be wrapped (breakpoint on it). 
e55b89f8d241 class: Method
Claus Gittinger <cg@exept.de>
parents: 15787
diff changeset
   677
         Search for the wrapper, if none is found, return immediately
e55b89f8d241 class: Method
Claus Gittinger <cg@exept.de>
parents: 15787
diff changeset
   678
         (avoids DNU)"
e55b89f8d241 class: Method
Claus Gittinger <cg@exept.de>
parents: 15787
diff changeset
   679
        cls isNil ifTrue:[
e55b89f8d241 class: Method
Claus Gittinger <cg@exept.de>
parents: 15787
diff changeset
   680
            | wrapper |
e55b89f8d241 class: Method
Claus Gittinger <cg@exept.de>
parents: 15787
diff changeset
   681
e55b89f8d241 class: Method
Claus Gittinger <cg@exept.de>
parents: 15787
diff changeset
   682
            wrapper := self wrapper.
e55b89f8d241 class: Method
Claus Gittinger <cg@exept.de>
parents: 15787
diff changeset
   683
            wrapper isNil ifTrue:[ ^ self ].
e55b89f8d241 class: Method
Claus Gittinger <cg@exept.de>
parents: 15787
diff changeset
   684
            cls := wrapper mclass.
e55b89f8d241 class: Method
Claus Gittinger <cg@exept.de>
parents: 15787
diff changeset
   685
            cls isNil ifTrue:[ ^ self ].
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
e55b89f8d241 class: Method
Claus Gittinger <cg@exept.de>
parents: 15787
diff changeset
   688
        self changed:#package.                                              "/ will vanish
e55b89f8d241 class: Method
Claus Gittinger <cg@exept.de>
parents: 15787
diff changeset
   689
        cls changed:#methodPackage with:self selector.                      "/ will vanish
e55b89f8d241 class: Method
Claus Gittinger <cg@exept.de>
parents: 15787
diff changeset
   690
e55b89f8d241 class: Method
Claus Gittinger <cg@exept.de>
parents: 15787
diff changeset
   691
        Smalltalk changed:#projectOrganization with:(Array with:cls with:self with:oldPackage).
e55b89f8d241 class: Method
Claus Gittinger <cg@exept.de>
parents: 15787
diff changeset
   692
        cls addChangeRecordForMethodPackage:self package:newPackage.
5724
96c2a5cf4217 category: and package: now send change notifications.
Claus Gittinger <cg@exept.de>
parents: 5721
diff changeset
   693
    ]
10196
f72831ddec29 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10156
diff changeset
   694
f72831ddec29 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10156
diff changeset
   695
    "Modified: / 23-11-2006 / 17:01:02 / cg"
15952
e55b89f8d241 class: Method
Claus Gittinger <cg@exept.de>
parents: 15787
diff changeset
   696
    "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
   697
    "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
   698
!
1e742016eea0 category rename / added access to RESOURCE and CALLED flags
Claus Gittinger <cg@exept.de>
parents: 1087
diff changeset
   699
13422
b43a8a47037c Jan's changes
vrany
parents: 13390
diff changeset
   700
setAnnotations: anObject
b43a8a47037c Jan's changes
vrany
parents: 13390
diff changeset
   701
    "set the annotations (low level - use do not use)"
b43a8a47037c Jan's changes
vrany
parents: 13390
diff changeset
   702
b43a8a47037c Jan's changes
vrany
parents: 13390
diff changeset
   703
    annotations :=  anObject
b43a8a47037c Jan's changes
vrany
parents: 13390
diff changeset
   704
b43a8a47037c Jan's changes
vrany
parents: 13390
diff changeset
   705
    "Created: / 20-05-2010 / 11:27:18 / Jan Vrany <jan.vrany@fit.cvut.cz>"
b43a8a47037c Jan's changes
vrany
parents: 13390
diff changeset
   706
!
b43a8a47037c Jan's changes
vrany
parents: 13390
diff changeset
   707
5721
5f97733ff519 methods now send change-notifications when the category changes
Claus Gittinger <cg@exept.de>
parents: 5704
diff changeset
   708
setCategory:aStringOrSymbol
5f97733ff519 methods now send change-notifications when the category changes
Claus Gittinger <cg@exept.de>
parents: 5704
diff changeset
   709
    "set the methods category (without change notification)"
5f97733ff519 methods now send change-notifications when the category changes
Claus Gittinger <cg@exept.de>
parents: 5704
diff changeset
   710
5f97733ff519 methods now send change-notifications when the category changes
Claus Gittinger <cg@exept.de>
parents: 5704
diff changeset
   711
    aStringOrSymbol notNil ifTrue:[
13662
7d7ae1e5f589 changed: #annotationAtIndex:
Claus Gittinger <cg@exept.de>
parents: 13660
diff changeset
   712
        category := aStringOrSymbol asSymbol
5721
5f97733ff519 methods now send change-notifications when the category changes
Claus Gittinger <cg@exept.de>
parents: 5704
diff changeset
   713
    ]
5f97733ff519 methods now send change-notifications when the category changes
Claus Gittinger <cg@exept.de>
parents: 5704
diff changeset
   714
5f97733ff519 methods now send change-notifications when the category changes
Claus Gittinger <cg@exept.de>
parents: 5704
diff changeset
   715
    "Modified: / 13.11.1998 / 23:55:05 / cg"
5f97733ff519 methods now send change-notifications when the category changes
Claus Gittinger <cg@exept.de>
parents: 5704
diff changeset
   716
!
5f97733ff519 methods now send change-notifications when the category changes
Claus Gittinger <cg@exept.de>
parents: 5704
diff changeset
   717
5398
b15f5eca2060 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5387
diff changeset
   718
setPackage:aSymbol
9702
468675f92260 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9692
diff changeset
   719
    "set the package-symbol (low level - use package:)"
5398
b15f5eca2060 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5387
diff changeset
   720
b15f5eca2060 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5387
diff changeset
   721
    package := aSymbol
b15f5eca2060 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5387
diff changeset
   722
!
b15f5eca2060 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5387
diff changeset
   723
1093
1e742016eea0 category rename / added access to RESOURCE and CALLED flags
Claus Gittinger <cg@exept.de>
parents: 1087
diff changeset
   724
source
1e742016eea0 category rename / added access to RESOURCE and CALLED flags
Claus Gittinger <cg@exept.de>
parents: 1087
diff changeset
   725
    "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
   726
12598
a6862e9bcb8e comment/format in: #source
Claus Gittinger <cg@exept.de>
parents: 12569
diff changeset
   727
    |sourceStream chunk|
1093
1e742016eea0 category rename / added access to RESOURCE and CALLED flags
Claus Gittinger <cg@exept.de>
parents: 1087
diff changeset
   728
1e742016eea0 category rename / added access to RESOURCE and CALLED flags
Claus Gittinger <cg@exept.de>
parents: 1087
diff changeset
   729
    "
1e742016eea0 category rename / added access to RESOURCE and CALLED flags
Claus Gittinger <cg@exept.de>
parents: 1087
diff changeset
   730
     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
   731
     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
   732
     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
   733
    "
1e742016eea0 category rename / added access to RESOURCE and CALLED flags
Claus Gittinger <cg@exept.de>
parents: 1087
diff changeset
   734
    sourcePosition isNil ifTrue:[^ source].
13381
e16cafbd22bd comment/format in: #sourceStreamUsingCache:
Claus Gittinger <cg@exept.de>
parents: 13189
diff changeset
   735
    source isNil ifTrue:[^ nil].
e16cafbd22bd comment/format in: #sourceStreamUsingCache:
Claus Gittinger <cg@exept.de>
parents: 13189
diff changeset
   736
e16cafbd22bd comment/format in: #sourceStreamUsingCache:
Claus Gittinger <cg@exept.de>
parents: 13189
diff changeset
   737
    self class lastMethodSourcesLock critical:[
13662
7d7ae1e5f589 changed: #annotationAtIndex:
Claus Gittinger <cg@exept.de>
parents: 13660
diff changeset
   738
        LastMethodSources notNil ifTrue:[
7d7ae1e5f589 changed: #annotationAtIndex:
Claus Gittinger <cg@exept.de>
parents: 13660
diff changeset
   739
            chunk := LastMethodSources at:self ifAbsent:nil.
7d7ae1e5f589 changed: #annotationAtIndex:
Claus Gittinger <cg@exept.de>
parents: 13660
diff changeset
   740
        ].
13381
e16cafbd22bd comment/format in: #sourceStreamUsingCache:
Claus Gittinger <cg@exept.de>
parents: 13189
diff changeset
   741
    ].
e16cafbd22bd comment/format in: #sourceStreamUsingCache:
Claus Gittinger <cg@exept.de>
parents: 13189
diff changeset
   742
    chunk notNil ifTrue:[
13662
7d7ae1e5f589 changed: #annotationAtIndex:
Claus Gittinger <cg@exept.de>
parents: 13660
diff changeset
   743
        ^ chunk
13381
e16cafbd22bd comment/format in: #sourceStreamUsingCache:
Claus Gittinger <cg@exept.de>
parents: 13189
diff changeset
   744
    ].
e16cafbd22bd comment/format in: #sourceStreamUsingCache:
Claus Gittinger <cg@exept.de>
parents: 13189
diff changeset
   745
13463
7c98583d98c8 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 13422
diff changeset
   746
    LastFileLock
13662
7d7ae1e5f589 changed: #annotationAtIndex:
Claus Gittinger <cg@exept.de>
parents: 13660
diff changeset
   747
        critical:[
7d7ae1e5f589 changed: #annotationAtIndex:
Claus Gittinger <cg@exept.de>
parents: 13660
diff changeset
   748
            "have to protect sourceStream from being closed as a side effect
7d7ae1e5f589 changed: #annotationAtIndex:
Claus Gittinger <cg@exept.de>
parents: 13660
diff changeset
   749
             of some other process fetching some the source from a different source file"
7d7ae1e5f589 changed: #annotationAtIndex:
Claus Gittinger <cg@exept.de>
parents: 13660
diff changeset
   750
7d7ae1e5f589 changed: #annotationAtIndex:
Claus Gittinger <cg@exept.de>
parents: 13660
diff changeset
   751
            sourceStream := self sourceStreamUsingCache:true.
7d7ae1e5f589 changed: #annotationAtIndex:
Claus Gittinger <cg@exept.de>
parents: 13660
diff changeset
   752
            sourceStream notNil ifTrue:[
7d7ae1e5f589 changed: #annotationAtIndex:
Claus Gittinger <cg@exept.de>
parents: 13660
diff changeset
   753
                [
7d7ae1e5f589 changed: #annotationAtIndex:
Claus Gittinger <cg@exept.de>
parents: 13660
diff changeset
   754
                    chunk := self sourceChunkFromStream:sourceStream.
7d7ae1e5f589 changed: #annotationAtIndex:
Claus Gittinger <cg@exept.de>
parents: 13660
diff changeset
   755
                ] on:DecodingError do:[:ex|
7d7ae1e5f589 changed: #annotationAtIndex:
Claus Gittinger <cg@exept.de>
parents: 13660
diff changeset
   756
                    "CharacterEncoder>>#guessEncoding is not fail safe - retry with plain unencoded data"
7d7ae1e5f589 changed: #annotationAtIndex:
Claus Gittinger <cg@exept.de>
parents: 13660
diff changeset
   757
7d7ae1e5f589 changed: #annotationAtIndex:
Claus Gittinger <cg@exept.de>
parents: 13660
diff changeset
   758
                    ('DecodingError ignored when reading <1p> (<2p>)' expandMacrosWith:self whoString with:ex description) infoPrintCR.
7d7ae1e5f589 changed: #annotationAtIndex:
Claus Gittinger <cg@exept.de>
parents: 13660
diff changeset
   759
                    sourceStream := self rawSourceStreamUsingCache:true.
7d7ae1e5f589 changed: #annotationAtIndex:
Claus Gittinger <cg@exept.de>
parents: 13660
diff changeset
   760
                    ex restart.
7d7ae1e5f589 changed: #annotationAtIndex:
Claus Gittinger <cg@exept.de>
parents: 13660
diff changeset
   761
                ].
7d7ae1e5f589 changed: #annotationAtIndex:
Claus Gittinger <cg@exept.de>
parents: 13660
diff changeset
   762
            ].
7d7ae1e5f589 changed: #annotationAtIndex:
Claus Gittinger <cg@exept.de>
parents: 13660
diff changeset
   763
        ]
7d7ae1e5f589 changed: #annotationAtIndex:
Claus Gittinger <cg@exept.de>
parents: 13660
diff changeset
   764
        timeoutMs:100
7d7ae1e5f589 changed: #annotationAtIndex:
Claus Gittinger <cg@exept.de>
parents: 13660
diff changeset
   765
        ifBlocking:[
7d7ae1e5f589 changed: #annotationAtIndex:
Claus Gittinger <cg@exept.de>
parents: 13660
diff changeset
   766
            "take care if LastFileLock is not available - maybe we are
7d7ae1e5f589 changed: #annotationAtIndex:
Claus Gittinger <cg@exept.de>
parents: 13660
diff changeset
   767
             called by a debugger while someone holds the lock.
7d7ae1e5f589 changed: #annotationAtIndex:
Claus Gittinger <cg@exept.de>
parents: 13660
diff changeset
   768
             Use uncached source streams"
7d7ae1e5f589 changed: #annotationAtIndex:
Claus Gittinger <cg@exept.de>
parents: 13660
diff changeset
   769
            sourceStream := self sourceStreamUsingCache:false.
7d7ae1e5f589 changed: #annotationAtIndex:
Claus Gittinger <cg@exept.de>
parents: 13660
diff changeset
   770
            sourceStream notNil ifTrue:[
7d7ae1e5f589 changed: #annotationAtIndex:
Claus Gittinger <cg@exept.de>
parents: 13660
diff changeset
   771
                [
7d7ae1e5f589 changed: #annotationAtIndex:
Claus Gittinger <cg@exept.de>
parents: 13660
diff changeset
   772
                    chunk := self sourceChunkFromStream:sourceStream.
7d7ae1e5f589 changed: #annotationAtIndex:
Claus Gittinger <cg@exept.de>
parents: 13660
diff changeset
   773
                    sourceStream close.
7d7ae1e5f589 changed: #annotationAtIndex:
Claus Gittinger <cg@exept.de>
parents: 13660
diff changeset
   774
                ] on:DecodingError do:[:ex|
7d7ae1e5f589 changed: #annotationAtIndex:
Claus Gittinger <cg@exept.de>
parents: 13660
diff changeset
   775
                    "CharacterEncoder>>#guessEncoding is not fail safe - retry with plain unencoded data"
7d7ae1e5f589 changed: #annotationAtIndex:
Claus Gittinger <cg@exept.de>
parents: 13660
diff changeset
   776
                    ('DecodingError ignored when reading <1p> (<2p>)' expandMacrosWith:self whoString with:ex description) infoPrintCR.
7d7ae1e5f589 changed: #annotationAtIndex:
Claus Gittinger <cg@exept.de>
parents: 13660
diff changeset
   777
                    sourceStream close.
7d7ae1e5f589 changed: #annotationAtIndex:
Claus Gittinger <cg@exept.de>
parents: 13660
diff changeset
   778
                    sourceStream := self rawSourceStreamUsingCache:false.
7d7ae1e5f589 changed: #annotationAtIndex:
Claus Gittinger <cg@exept.de>
parents: 13660
diff changeset
   779
                    ex restart.
7d7ae1e5f589 changed: #annotationAtIndex:
Claus Gittinger <cg@exept.de>
parents: 13660
diff changeset
   780
                ].
7d7ae1e5f589 changed: #annotationAtIndex:
Claus Gittinger <cg@exept.de>
parents: 13660
diff changeset
   781
            ].
7d7ae1e5f589 changed: #annotationAtIndex:
Claus Gittinger <cg@exept.de>
parents: 13660
diff changeset
   782
        ].
2979
6bb06c5e49d8 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2868
diff changeset
   783
10673
05229646ecd7 #source - handle DecodingError when fetching the method's source
Stefan Vogel <sv@exept.de>
parents: 10608
diff changeset
   784
    "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
   785
    chunk notNil ifTrue:[
16221
00b413ddccd5 class: Method
Claus Gittinger <cg@exept.de>
parents: 16220
diff changeset
   786
        "JV@2013-08-19: Don't consult UserPreferences if the system is initilizing. This may
00b413ddccd5 class: Method
Claus Gittinger <cg@exept.de>
parents: 16220
diff changeset
   787
         lead in funny side-effect as #initializeDefaultPreferences is called which tries to
00b413ddccd5 class: Method
Claus Gittinger <cg@exept.de>
parents: 16220
diff changeset
   788
         initialize some colors. But Color itsels is likely not yet initialized, so DNU is 
16384
f36e185cbc66 class: Method
Claus Gittinger <cg@exept.de>
parents: 16271
diff changeset
   789
         thrown.
f36e185cbc66 class: Method
Claus Gittinger <cg@exept.de>
parents: 16271
diff changeset
   790
         CG: also care for standalone non-GUI progs, which have no userPreferences class"
f36e185cbc66 class: Method
Claus Gittinger <cg@exept.de>
parents: 16271
diff changeset
   791
        (Smalltalk isInitialized 
f36e185cbc66 class: Method
Claus Gittinger <cg@exept.de>
parents: 16271
diff changeset
   792
        and:[UserPreferences notNil
f36e185cbc66 class: Method
Claus Gittinger <cg@exept.de>
parents: 16271
diff changeset
   793
        and:[UserPreferences current keepMethodSourceCode]]) ifTrue:[
13662
7d7ae1e5f589 changed: #annotationAtIndex:
Claus Gittinger <cg@exept.de>
parents: 13660
diff changeset
   794
            source := chunk.
7d7ae1e5f589 changed: #annotationAtIndex:
Claus Gittinger <cg@exept.de>
parents: 13660
diff changeset
   795
            sourcePosition := nil.
7d7ae1e5f589 changed: #annotationAtIndex:
Claus Gittinger <cg@exept.de>
parents: 13660
diff changeset
   796
            ^ source.
7d7ae1e5f589 changed: #annotationAtIndex:
Claus Gittinger <cg@exept.de>
parents: 13660
diff changeset
   797
        ].
7d7ae1e5f589 changed: #annotationAtIndex:
Claus Gittinger <cg@exept.de>
parents: 13660
diff changeset
   798
7d7ae1e5f589 changed: #annotationAtIndex:
Claus Gittinger <cg@exept.de>
parents: 13660
diff changeset
   799
        CacheDictionary notNil ifTrue:[
7d7ae1e5f589 changed: #annotationAtIndex:
Claus Gittinger <cg@exept.de>
parents: 13660
diff changeset
   800
            self class lastMethodSourcesLock critical:[
7d7ae1e5f589 changed: #annotationAtIndex:
Claus Gittinger <cg@exept.de>
parents: 13660
diff changeset
   801
                LastMethodSources isNil ifTrue:[
7d7ae1e5f589 changed: #annotationAtIndex:
Claus Gittinger <cg@exept.de>
parents: 13660
diff changeset
   802
                    LastMethodSources := CacheDictionary new:50.
7d7ae1e5f589 changed: #annotationAtIndex:
Claus Gittinger <cg@exept.de>
parents: 13660
diff changeset
   803
                ].
7d7ae1e5f589 changed: #annotationAtIndex:
Claus Gittinger <cg@exept.de>
parents: 13660
diff changeset
   804
                LastMethodSources at:self put:chunk.
7d7ae1e5f589 changed: #annotationAtIndex:
Claus Gittinger <cg@exept.de>
parents: 13660
diff changeset
   805
            ]
7d7ae1e5f589 changed: #annotationAtIndex:
Claus Gittinger <cg@exept.de>
parents: 13660
diff changeset
   806
        ].
2979
6bb06c5e49d8 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2868
diff changeset
   807
    ].
6bb06c5e49d8 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2868
diff changeset
   808
10608
82b1346f3e8d Use similar code when accessing method and class source code
Stefan Vogel <sv@exept.de>
parents: 10482
diff changeset
   809
    ^ chunk
1093
1e742016eea0 category rename / added access to RESOURCE and CALLED flags
Claus Gittinger <cg@exept.de>
parents: 1087
diff changeset
   810
10201
f90568a94903 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10196
diff changeset
   811
    "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
   812
!
1e742016eea0 category rename / added access to RESOURCE and CALLED flags
Claus Gittinger <cg@exept.de>
parents: 1087
diff changeset
   813
1e742016eea0 category rename / added access to RESOURCE and CALLED flags
Claus Gittinger <cg@exept.de>
parents: 1087
diff changeset
   814
source:aString
1e742016eea0 category rename / added access to RESOURCE and CALLED flags
Claus Gittinger <cg@exept.de>
parents: 1087
diff changeset
   815
    "set the methods sourcestring"
1e742016eea0 category rename / added access to RESOURCE and CALLED flags
Claus Gittinger <cg@exept.de>
parents: 1087
diff changeset
   816
15346
c8f751f80e5b class: Method
Claus Gittinger <cg@exept.de>
parents: 15245
diff changeset
   817
    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
   818
    source := aString.
1e742016eea0 category rename / added access to RESOURCE and CALLED flags
Claus Gittinger <cg@exept.de>
parents: 1087
diff changeset
   819
    sourcePosition := nil
1e742016eea0 category rename / added access to RESOURCE and CALLED flags
Claus Gittinger <cg@exept.de>
parents: 1087
diff changeset
   820
!
1e742016eea0 category rename / added access to RESOURCE and CALLED flags
Claus Gittinger <cg@exept.de>
parents: 1087
diff changeset
   821
1e742016eea0 category rename / added access to RESOURCE and CALLED flags
Claus Gittinger <cg@exept.de>
parents: 1087
diff changeset
   822
sourceFilename
1e742016eea0 category rename / added access to RESOURCE and CALLED flags
Claus Gittinger <cg@exept.de>
parents: 1087
diff changeset
   823
    "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
   824
1e742016eea0 category rename / added access to RESOURCE and CALLED flags
Claus Gittinger <cg@exept.de>
parents: 1087
diff changeset
   825
    sourcePosition notNil ifTrue:[^ source].
1e742016eea0 category rename / added access to RESOURCE and CALLED flags
Claus Gittinger <cg@exept.de>
parents: 1087
diff changeset
   826
    ^ nil
1e742016eea0 category rename / added access to RESOURCE and CALLED flags
Claus Gittinger <cg@exept.de>
parents: 1087
diff changeset
   827
!
1e742016eea0 category rename / added access to RESOURCE and CALLED flags
Claus Gittinger <cg@exept.de>
parents: 1087
diff changeset
   828
1e742016eea0 category rename / added access to RESOURCE and CALLED flags
Claus Gittinger <cg@exept.de>
parents: 1087
diff changeset
   829
sourceFilename:aFileName position:aNumber
1e742016eea0 category rename / added access to RESOURCE and CALLED flags
Claus Gittinger <cg@exept.de>
parents: 1087
diff changeset
   830
    "set the methods sourcefile/position"
1e742016eea0 category rename / added access to RESOURCE and CALLED flags
Claus Gittinger <cg@exept.de>
parents: 1087
diff changeset
   831
15346
c8f751f80e5b class: Method
Claus Gittinger <cg@exept.de>
parents: 15245
diff changeset
   832
    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
   833
    source := aFileName.
1e742016eea0 category rename / added access to RESOURCE and CALLED flags
Claus Gittinger <cg@exept.de>
parents: 1087
diff changeset
   834
    sourcePosition := aNumber
1e742016eea0 category rename / added access to RESOURCE and CALLED flags
Claus Gittinger <cg@exept.de>
parents: 1087
diff changeset
   835
!
1e742016eea0 category rename / added access to RESOURCE and CALLED flags
Claus Gittinger <cg@exept.de>
parents: 1087
diff changeset
   836
2812
660a3a2a0ef3 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 2805
diff changeset
   837
sourceLineNumber
660a3a2a0ef3 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 2805
diff changeset
   838
    "return the lineNumber of my source within the returned
660a3a2a0ef3 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 2805
diff changeset
   839
     source sourcestring.
660a3a2a0ef3 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 2805
diff changeset
   840
     For ST methods, the returned sourceString is always the
660a3a2a0ef3 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 2805
diff changeset
   841
     methods pure source; therefore, the lineNumber is always 1."
660a3a2a0ef3 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 2805
diff changeset
   842
660a3a2a0ef3 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 2805
diff changeset
   843
    ^ 1
660a3a2a0ef3 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 2805
diff changeset
   844
660a3a2a0ef3 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 2805
diff changeset
   845
    "Created: 30.7.1997 / 15:42:01 / cg"
660a3a2a0ef3 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 2805
diff changeset
   846
!
660a3a2a0ef3 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 2805
diff changeset
   847
1093
1e742016eea0 category rename / added access to RESOURCE and CALLED flags
Claus Gittinger <cg@exept.de>
parents: 1087
diff changeset
   848
sourcePosition
1e742016eea0 category rename / added access to RESOURCE and CALLED flags
Claus Gittinger <cg@exept.de>
parents: 1087
diff changeset
   849
    "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
   850
2176
1a24b0cef25a when compressing sources, make certain to avoid later
Claus Gittinger <cg@exept.de>
parents: 2171
diff changeset
   851
    sourcePosition isNil ifTrue:[^ sourcePosition].
1a24b0cef25a when compressing sources, make certain to avoid later
Claus Gittinger <cg@exept.de>
parents: 2171
diff changeset
   852
    ^ sourcePosition abs
1a24b0cef25a when compressing sources, make certain to avoid later
Claus Gittinger <cg@exept.de>
parents: 2171
diff changeset
   853
1a24b0cef25a when compressing sources, make certain to avoid later
Claus Gittinger <cg@exept.de>
parents: 2171
diff changeset
   854
    "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
   855
! !
1e742016eea0 category rename / added access to RESOURCE and CALLED flags
Claus Gittinger <cg@exept.de>
parents: 1087
diff changeset
   856
14508
859dca6352f8 class: Method
Claus Gittinger <cg@exept.de>
parents: 14505
diff changeset
   857
!Method methodsFor:'accessing-annotations'!
859dca6352f8 class: Method
Claus Gittinger <cg@exept.de>
parents: 14505
diff changeset
   858
859dca6352f8 class: Method
Claus Gittinger <cg@exept.de>
parents: 14505
diff changeset
   859
annotateWith: annotation
16221
00b413ddccd5 class: Method
Claus Gittinger <cg@exept.de>
parents: 16220
diff changeset
   860
    "add a (hidden) annotation.
00b413ddccd5 class: Method
Claus Gittinger <cg@exept.de>
parents: 16220
diff changeset
   861
     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
   862
14508
859dca6352f8 class: Method
Claus Gittinger <cg@exept.de>
parents: 14505
diff changeset
   863
    | index |
859dca6352f8 class: Method
Claus Gittinger <cg@exept.de>
parents: 14505
diff changeset
   864
859dca6352f8 class: Method
Claus Gittinger <cg@exept.de>
parents: 14505
diff changeset
   865
    index := self annotationIndexOf: annotation key.
859dca6352f8 class: Method
Claus Gittinger <cg@exept.de>
parents: 14505
diff changeset
   866
    index isNil ifTrue:[
859dca6352f8 class: Method
Claus Gittinger <cg@exept.de>
parents: 14505
diff changeset
   867
        annotations := annotations isNil 
859dca6352f8 class: Method
Claus Gittinger <cg@exept.de>
parents: 14505
diff changeset
   868
                            ifTrue:[Array with: annotation]
859dca6352f8 class: Method
Claus Gittinger <cg@exept.de>
parents: 14505
diff changeset
   869
                            ifFalse:[annotations copyWith:annotation]
859dca6352f8 class: Method
Claus Gittinger <cg@exept.de>
parents: 14505
diff changeset
   870
    ] ifFalse:[
859dca6352f8 class: Method
Claus Gittinger <cg@exept.de>
parents: 14505
diff changeset
   871
        annotations at: index put: annotation
859dca6352f8 class: Method
Claus Gittinger <cg@exept.de>
parents: 14505
diff changeset
   872
    ].
859dca6352f8 class: Method
Claus Gittinger <cg@exept.de>
parents: 14505
diff changeset
   873
"/    annotation annotatesMethod: self.
859dca6352f8 class: Method
Claus Gittinger <cg@exept.de>
parents: 14505
diff changeset
   874
859dca6352f8 class: Method
Claus Gittinger <cg@exept.de>
parents: 14505
diff changeset
   875
    "
859dca6352f8 class: Method
Claus Gittinger <cg@exept.de>
parents: 14505
diff changeset
   876
        (Object >> #yourself) annotateWith: (Annotation namespace: 'Fictious').
859dca6352f8 class: Method
Claus Gittinger <cg@exept.de>
parents: 14505
diff changeset
   877
        (Object >> #yourself) annotations.
859dca6352f8 class: Method
Claus Gittinger <cg@exept.de>
parents: 14505
diff changeset
   878
        (Object >> #yourself) annotationAt: #namespace:
859dca6352f8 class: Method
Claus Gittinger <cg@exept.de>
parents: 14505
diff changeset
   879
    "
859dca6352f8 class: Method
Claus Gittinger <cg@exept.de>
parents: 14505
diff changeset
   880
859dca6352f8 class: Method
Claus Gittinger <cg@exept.de>
parents: 14505
diff changeset
   881
    "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
   882
    "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
   883
    "Modified (format): / 26-07-2012 / 15:47:51 / cg"
859dca6352f8 class: Method
Claus Gittinger <cg@exept.de>
parents: 14505
diff changeset
   884
!
859dca6352f8 class: Method
Claus Gittinger <cg@exept.de>
parents: 14505
diff changeset
   885
859dca6352f8 class: Method
Claus Gittinger <cg@exept.de>
parents: 14505
diff changeset
   886
annotationAt: key
859dca6352f8 class: Method
Claus Gittinger <cg@exept.de>
parents: 14505
diff changeset
   887
    | index |
859dca6352f8 class: Method
Claus Gittinger <cg@exept.de>
parents: 14505
diff changeset
   888
859dca6352f8 class: Method
Claus Gittinger <cg@exept.de>
parents: 14505
diff changeset
   889
    index := self annotationIndexOf: key.
859dca6352f8 class: Method
Claus Gittinger <cg@exept.de>
parents: 14505
diff changeset
   890
    index isNil ifTrue:[^ nil].
859dca6352f8 class: Method
Claus Gittinger <cg@exept.de>
parents: 14505
diff changeset
   891
    ^ self annotationAtIndex: index.
859dca6352f8 class: Method
Claus Gittinger <cg@exept.de>
parents: 14505
diff changeset
   892
859dca6352f8 class: Method
Claus Gittinger <cg@exept.de>
parents: 14505
diff changeset
   893
    "
859dca6352f8 class: Method
Claus Gittinger <cg@exept.de>
parents: 14505
diff changeset
   894
        (Object >> #yourself) annotationAt: #namespace:
859dca6352f8 class: Method
Claus Gittinger <cg@exept.de>
parents: 14505
diff changeset
   895
    "
859dca6352f8 class: Method
Claus Gittinger <cg@exept.de>
parents: 14505
diff changeset
   896
859dca6352f8 class: Method
Claus Gittinger <cg@exept.de>
parents: 14505
diff changeset
   897
    "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
   898
    "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
   899
    "Modified: / 18-11-2011 / 14:46:21 / cg"
859dca6352f8 class: Method
Claus Gittinger <cg@exept.de>
parents: 14505
diff changeset
   900
    "Modified (format): / 26-07-2012 / 15:47:54 / cg"
859dca6352f8 class: Method
Claus Gittinger <cg@exept.de>
parents: 14505
diff changeset
   901
!
859dca6352f8 class: Method
Claus Gittinger <cg@exept.de>
parents: 14505
diff changeset
   902
859dca6352f8 class: Method
Claus Gittinger <cg@exept.de>
parents: 14505
diff changeset
   903
annotations
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
   904
    | retval |
14508
859dca6352f8 class: Method
Claus Gittinger <cg@exept.de>
parents: 14505
diff changeset
   905
16261
52a0604a7b95 class: Method
Stefan Vogel <sv@exept.de>
parents: 16221
diff changeset
   906
    annotations isNil ifTrue:[^ #()].
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
   907
    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
   908
    1 to: annotations size do: [:i|
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
   909
        retval at: i put: (self annotationAtIndex: i).
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
   910
    ].
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
   911
    ^ 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
   912
14508
859dca6352f8 class: Method
Claus Gittinger <cg@exept.de>
parents: 14505
diff changeset
   913
    "Modified: / 18-11-2011 / 14:46:56 / cg"
859dca6352f8 class: Method
Claus Gittinger <cg@exept.de>
parents: 14505
diff changeset
   914
    "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
   915
    "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
   916
!
859dca6352f8 class: Method
Claus Gittinger <cg@exept.de>
parents: 14505
diff changeset
   917
859dca6352f8 class: Method
Claus Gittinger <cg@exept.de>
parents: 14505
diff changeset
   918
annotations: anObject
859dca6352f8 class: Method
Claus Gittinger <cg@exept.de>
parents: 14505
diff changeset
   919
    "set the annotations"
859dca6352f8 class: Method
Claus Gittinger <cg@exept.de>
parents: 14505
diff changeset
   920
859dca6352f8 class: Method
Claus Gittinger <cg@exept.de>
parents: 14505
diff changeset
   921
    self setAnnotations: anObject.
859dca6352f8 class: Method
Claus Gittinger <cg@exept.de>
parents: 14505
diff changeset
   922
"/    "iterate over annotations just to invoke
859dca6352f8 class: Method
Claus Gittinger <cg@exept.de>
parents: 14505
diff changeset
   923
"/     annotationAtIndex: which lazyliyinitialize annotations
859dca6352f8 class: Method
Claus Gittinger <cg@exept.de>
parents: 14505
diff changeset
   924
"/     and send #annotatesMethod:"
859dca6352f8 class: Method
Claus Gittinger <cg@exept.de>
parents: 14505
diff changeset
   925
"/    self annotationsDo:[:annotation|]
859dca6352f8 class: Method
Claus Gittinger <cg@exept.de>
parents: 14505
diff changeset
   926
859dca6352f8 class: Method
Claus Gittinger <cg@exept.de>
parents: 14505
diff changeset
   927
    "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
   928
!
859dca6352f8 class: Method
Claus Gittinger <cg@exept.de>
parents: 14505
diff changeset
   929
859dca6352f8 class: Method
Claus Gittinger <cg@exept.de>
parents: 14505
diff changeset
   930
annotationsAt: key
859dca6352f8 class: Method
Claus Gittinger <cg@exept.de>
parents: 14505
diff changeset
   931
859dca6352f8 class: Method
Claus Gittinger <cg@exept.de>
parents: 14505
diff changeset
   932
    ^OrderedCollection 
859dca6352f8 class: Method
Claus Gittinger <cg@exept.de>
parents: 14505
diff changeset
   933
        streamContents:[:annotStream|
859dca6352f8 class: Method
Claus Gittinger <cg@exept.de>
parents: 14505
diff changeset
   934
            self annotationsAt: key do: [:annot| annotStream nextPut: annot]
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
859dca6352f8 class: Method
Claus Gittinger <cg@exept.de>
parents: 14505
diff changeset
   937
    "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
   938
    "Modified (format): / 26-07-2012 / 15:46:56 / cg"
859dca6352f8 class: Method
Claus Gittinger <cg@exept.de>
parents: 14505
diff changeset
   939
!
859dca6352f8 class: Method
Claus Gittinger <cg@exept.de>
parents: 14505
diff changeset
   940
859dca6352f8 class: Method
Claus Gittinger <cg@exept.de>
parents: 14505
diff changeset
   941
annotationsAt: key do: block
859dca6352f8 class: Method
Claus Gittinger <cg@exept.de>
parents: 14505
diff changeset
   942
    self annotationsDo: [:annot|
859dca6352f8 class: Method
Claus Gittinger <cg@exept.de>
parents: 14505
diff changeset
   943
        annot key == key ifTrue:[block value: annot]
859dca6352f8 class: Method
Claus Gittinger <cg@exept.de>
parents: 14505
diff changeset
   944
    ]
859dca6352f8 class: Method
Claus Gittinger <cg@exept.de>
parents: 14505
diff changeset
   945
859dca6352f8 class: Method
Claus Gittinger <cg@exept.de>
parents: 14505
diff changeset
   946
    "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
   947
    "Modified (format): / 26-07-2012 / 15:48:37 / cg"
859dca6352f8 class: Method
Claus Gittinger <cg@exept.de>
parents: 14505
diff changeset
   948
!
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
annotationsAt: key1 orAt: key2
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
    ^OrderedCollection 
859dca6352f8 class: Method
Claus Gittinger <cg@exept.de>
parents: 14505
diff changeset
   953
        streamContents:[:annotStream|
859dca6352f8 class: Method
Claus Gittinger <cg@exept.de>
parents: 14505
diff changeset
   954
            self annotationsAt: key1 orAt: key2 do: [:annot|annotStream nextPut: annot]
859dca6352f8 class: Method
Claus Gittinger <cg@exept.de>
parents: 14505
diff changeset
   955
        ]
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
    "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
   958
    "Modified (format): / 26-07-2012 / 15:49:11 / cg"
859dca6352f8 class: Method
Claus Gittinger <cg@exept.de>
parents: 14505
diff changeset
   959
!
859dca6352f8 class: Method
Claus Gittinger <cg@exept.de>
parents: 14505
diff changeset
   960
859dca6352f8 class: Method
Claus Gittinger <cg@exept.de>
parents: 14505
diff changeset
   961
annotationsAt: key1 orAt: key2 do: block
859dca6352f8 class: Method
Claus Gittinger <cg@exept.de>
parents: 14505
diff changeset
   962
    self annotationsDo:[:annot |
859dca6352f8 class: Method
Claus Gittinger <cg@exept.de>
parents: 14505
diff changeset
   963
        (annot key == key1 or:[annot key == key2]) ifTrue:[
859dca6352f8 class: Method
Claus Gittinger <cg@exept.de>
parents: 14505
diff changeset
   964
            block value: annot
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
    ]
859dca6352f8 class: Method
Claus Gittinger <cg@exept.de>
parents: 14505
diff changeset
   967
859dca6352f8 class: Method
Claus Gittinger <cg@exept.de>
parents: 14505
diff changeset
   968
    "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
   969
    "Modified (format): / 26-07-2012 / 15:49:30 / cg"
859dca6352f8 class: Method
Claus Gittinger <cg@exept.de>
parents: 14505
diff changeset
   970
!
859dca6352f8 class: Method
Claus Gittinger <cg@exept.de>
parents: 14505
diff changeset
   971
859dca6352f8 class: Method
Claus Gittinger <cg@exept.de>
parents: 14505
diff changeset
   972
annotationsDo: aBlock
859dca6352f8 class: Method
Claus Gittinger <cg@exept.de>
parents: 14505
diff changeset
   973
    annotations isNil ifTrue:[^nil].
859dca6352f8 class: Method
Claus Gittinger <cg@exept.de>
parents: 14505
diff changeset
   974
    1 to: annotations size do: [:i|
859dca6352f8 class: Method
Claus Gittinger <cg@exept.de>
parents: 14505
diff changeset
   975
        aBlock value: (self annotationAtIndex: i)
859dca6352f8 class: Method
Claus Gittinger <cg@exept.de>
parents: 14505
diff changeset
   976
    ].
859dca6352f8 class: Method
Claus Gittinger <cg@exept.de>
parents: 14505
diff changeset
   977
859dca6352f8 class: Method
Claus Gittinger <cg@exept.de>
parents: 14505
diff changeset
   978
    "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
   979
    "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
   980
    "Modified (format): / 18-11-2011 / 14:47:06 / cg"
859dca6352f8 class: Method
Claus Gittinger <cg@exept.de>
parents: 14505
diff changeset
   981
! !
859dca6352f8 class: Method
Claus Gittinger <cg@exept.de>
parents: 14505
diff changeset
   982
1093
1e742016eea0 category rename / added access to RESOURCE and CALLED flags
Claus Gittinger <cg@exept.de>
parents: 1087
diff changeset
   983
!Method methodsFor:'accessing-visibility'!
1e742016eea0 category rename / added access to RESOURCE and CALLED flags
Claus Gittinger <cg@exept.de>
parents: 1087
diff changeset
   984
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
   985
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
   986
    "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
   987
     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
   988
     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
   989
     it in its message lookup.
747
ea3b6f7fd7ce added ignoredMethods
Claus Gittinger <cg@exept.de>
parents: 737
diff changeset
   990
     (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
   991
      leads to either the superclasses implementation to be called,
747
ea3b6f7fd7ce added ignoredMethods
Claus Gittinger <cg@exept.de>
parents: 737
diff changeset
   992
      or a doesNotUnderstand exception to be raised)
ea3b6f7fd7ce added ignoredMethods
Claus Gittinger <cg@exept.de>
parents: 737
diff changeset
   993
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
   994
     Notice: this is a nonstandard feature, not supported
747
ea3b6f7fd7ce added ignoredMethods
Claus Gittinger <cg@exept.de>
parents: 737
diff changeset
   995
     by other smalltalk implementations and not specified in the ANSI spec.
ea3b6f7fd7ce added ignoredMethods
Claus Gittinger <cg@exept.de>
parents: 737
diff changeset
   996
ea3b6f7fd7ce added ignoredMethods
Claus Gittinger <cg@exept.de>
parents: 737
diff changeset
   997
     This is EXPERIMENTAL - and being evaluated for usability.
ea3b6f7fd7ce added ignoredMethods
Claus Gittinger <cg@exept.de>
parents: 737
diff changeset
   998
     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
   999
3216
e0f3f49118ed Simplify privacy stuff to make redirection from WrappedMethod easier.
Stefan Vogel <sv@exept.de>
parents: 3168
diff changeset
  1000
    ^ self privacy == #ignored
e0f3f49118ed Simplify privacy stuff to make redirection from WrappedMethod easier.
Stefan Vogel <sv@exept.de>
parents: 3168
diff changeset
  1001
e0f3f49118ed Simplify privacy stuff to make redirection from WrappedMethod easier.
Stefan Vogel <sv@exept.de>
parents: 3168
diff changeset
  1002
    "Modified: / 23.1.1998 / 15:23:02 / stefan"
176
48061f8659aa more queries
claus
parents: 159
diff changeset
  1003
!
48061f8659aa more queries
claus
parents: 159
diff changeset
  1004
48061f8659aa more queries
claus
parents: 159
diff changeset
  1005
isPrivate
48061f8659aa more queries
claus
parents: 159
diff changeset
  1006
    "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
  1007
     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
  1008
     from superclasses or the class itself.
176
48061f8659aa more queries
claus
parents: 159
diff changeset
  1009
     If a private method is called by some other class, a runtime
48061f8659aa more queries
claus
parents: 159
diff changeset
  1010
     error (PrivateMethodSignal) is raised.
48061f8659aa more queries
claus
parents: 159
diff changeset
  1011
     Notice: method privacy is a nonstandard feature, not supported
48061f8659aa more queries
claus
parents: 159
diff changeset
  1012
     by other smalltalk implementations and not specified in the ANSI spec.
747
ea3b6f7fd7ce added ignoredMethods
Claus Gittinger <cg@exept.de>
parents: 737
diff changeset
  1013
176
48061f8659aa more queries
claus
parents: 159
diff changeset
  1014
     This is EXPERIMENTAL - and being evaluated for usability.
48061f8659aa more queries
claus
parents: 159
diff changeset
  1015
     It may change or even vanish (if it shows to be not useful)."
48061f8659aa more queries
claus
parents: 159
diff changeset
  1016
3216
e0f3f49118ed Simplify privacy stuff to make redirection from WrappedMethod easier.
Stefan Vogel <sv@exept.de>
parents: 3168
diff changeset
  1017
    ^ self privacy == #private
e0f3f49118ed Simplify privacy stuff to make redirection from WrappedMethod easier.
Stefan Vogel <sv@exept.de>
parents: 3168
diff changeset
  1018
e0f3f49118ed Simplify privacy stuff to make redirection from WrappedMethod easier.
Stefan Vogel <sv@exept.de>
parents: 3168
diff changeset
  1019
    "Modified: / 23.1.1998 / 15:23:13 / stefan"
68
59faa75185ba *** empty log message ***
claus
parents: 56
diff changeset
  1020
!
59faa75185ba *** empty log message ***
claus
parents: 56
diff changeset
  1021
176
48061f8659aa more queries
claus
parents: 159
diff changeset
  1022
isProtected
48061f8659aa more queries
claus
parents: 159
diff changeset
  1023
    "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
  1024
     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
  1025
     from superclasses, the class itself or subclasse.
176
48061f8659aa more queries
claus
parents: 159
diff changeset
  1026
     If a protected method is called by some other class, a runtime
48061f8659aa more queries
claus
parents: 159
diff changeset
  1027
     error (PrivateMethodSignal) is raised.
747
ea3b6f7fd7ce added ignoredMethods
Claus Gittinger <cg@exept.de>
parents: 737
diff changeset
  1028
176
48061f8659aa more queries
claus
parents: 159
diff changeset
  1029
     Notice: method privacy is a nonstandard feature, not supported
48061f8659aa more queries
claus
parents: 159
diff changeset
  1030
     by other smalltalk implementations and not specified in the ANSI spec.
747
ea3b6f7fd7ce added ignoredMethods
Claus Gittinger <cg@exept.de>
parents: 737
diff changeset
  1031
176
48061f8659aa more queries
claus
parents: 159
diff changeset
  1032
     This is EXPERIMENTAL - and being evaluated for usability.
48061f8659aa more queries
claus
parents: 159
diff changeset
  1033
     It may change or even vanish (if it shows to be not useful)."
48061f8659aa more queries
claus
parents: 159
diff changeset
  1034
3216
e0f3f49118ed Simplify privacy stuff to make redirection from WrappedMethod easier.
Stefan Vogel <sv@exept.de>
parents: 3168
diff changeset
  1035
    ^ self privacy == #protected
e0f3f49118ed Simplify privacy stuff to make redirection from WrappedMethod easier.
Stefan Vogel <sv@exept.de>
parents: 3168
diff changeset
  1036
e0f3f49118ed Simplify privacy stuff to make redirection from WrappedMethod easier.
Stefan Vogel <sv@exept.de>
parents: 3168
diff changeset
  1037
    "Modified: / 23.1.1998 / 15:23:27 / stefan"
176
48061f8659aa more queries
claus
parents: 159
diff changeset
  1038
!
48061f8659aa more queries
claus
parents: 159
diff changeset
  1039
48061f8659aa more queries
claus
parents: 159
diff changeset
  1040
isPublic
48061f8659aa more queries
claus
parents: 159
diff changeset
  1041
    "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
  1042
     This is the default and how other smalltalk implementations treat all methods.
ea3b6f7fd7ce added ignoredMethods
Claus Gittinger <cg@exept.de>
parents: 737
diff changeset
  1043
360
claus
parents: 350
diff changeset
  1044
     Notice: method privacy is a nonstandard feature, not supported
claus
parents: 350
diff changeset
  1045
     by other smalltalk implementations and not specified in the ANSI spec.
747
ea3b6f7fd7ce added ignoredMethods
Claus Gittinger <cg@exept.de>
parents: 737
diff changeset
  1046
360
claus
parents: 350
diff changeset
  1047
     This is EXPERIMENTAL - and being evaluated for usability.
claus
parents: 350
diff changeset
  1048
     It may change or even vanish (if it shows to be not useful)."
176
48061f8659aa more queries
claus
parents: 159
diff changeset
  1049
3216
e0f3f49118ed Simplify privacy stuff to make redirection from WrappedMethod easier.
Stefan Vogel <sv@exept.de>
parents: 3168
diff changeset
  1050
    ^ self privacy == #public
e0f3f49118ed Simplify privacy stuff to make redirection from WrappedMethod easier.
Stefan Vogel <sv@exept.de>
parents: 3168
diff changeset
  1051
e0f3f49118ed Simplify privacy stuff to make redirection from WrappedMethod easier.
Stefan Vogel <sv@exept.de>
parents: 3168
diff changeset
  1052
    "Modified: / 23.1.1998 / 15:23:40 / stefan"
176
48061f8659aa more queries
claus
parents: 159
diff changeset
  1053
!
48061f8659aa more queries
claus
parents: 159
diff changeset
  1054
747
ea3b6f7fd7ce added ignoredMethods
Claus Gittinger <cg@exept.de>
parents: 737
diff changeset
  1055
isRestricted
ea3b6f7fd7ce added ignoredMethods
Claus Gittinger <cg@exept.de>
parents: 737
diff changeset
  1056
    "return the flag bit stating that this method is restricted.
ea3b6f7fd7ce added ignoredMethods
Claus Gittinger <cg@exept.de>
parents: 737
diff changeset
  1057
     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
  1058
     'trap restricted mode' (-->ObjectMemory) otherise a runtime
747
ea3b6f7fd7ce added ignoredMethods
Claus Gittinger <cg@exept.de>
parents: 737
diff changeset
  1059
     error (PrivateMethodSignal) is raised.
ea3b6f7fd7ce added ignoredMethods
Claus Gittinger <cg@exept.de>
parents: 737
diff changeset
  1060
ea3b6f7fd7ce added ignoredMethods
Claus Gittinger <cg@exept.de>
parents: 737
diff changeset
  1061
     Notice: method restriction is a nonstandard feature, not supported
ea3b6f7fd7ce added ignoredMethods
Claus Gittinger <cg@exept.de>
parents: 737
diff changeset
  1062
     by other smalltalk implementations and not specified in the ANSI spec.
ea3b6f7fd7ce added ignoredMethods
Claus Gittinger <cg@exept.de>
parents: 737
diff changeset
  1063
ea3b6f7fd7ce added ignoredMethods
Claus Gittinger <cg@exept.de>
parents: 737
diff changeset
  1064
     This is EXPERIMENTAL - and being evaluated for usability.
ea3b6f7fd7ce added ignoredMethods
Claus Gittinger <cg@exept.de>
parents: 737
diff changeset
  1065
     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
  1066
ea3b6f7fd7ce added ignoredMethods
Claus Gittinger <cg@exept.de>
parents: 737
diff changeset
  1067
%{  /* NOCONTEXT */
ea3b6f7fd7ce added ignoredMethods
Claus Gittinger <cg@exept.de>
parents: 737
diff changeset
  1068
#ifdef F_RESTRICTED
2868
772c890f907c alpha64
Claus Gittinger <cg@exept.de>
parents: 2826
diff changeset
  1069
    INT f = __intVal(__INST(flags));
747
ea3b6f7fd7ce added ignoredMethods
Claus Gittinger <cg@exept.de>
parents: 737
diff changeset
  1070
ea3b6f7fd7ce added ignoredMethods
Claus Gittinger <cg@exept.de>
parents: 737
diff changeset
  1071
    if (f & F_RESTRICTED) {
13662
7d7ae1e5f589 changed: #annotationAtIndex:
Claus Gittinger <cg@exept.de>
parents: 13660
diff changeset
  1072
        RETURN (true);
747
ea3b6f7fd7ce added ignoredMethods
Claus Gittinger <cg@exept.de>
parents: 737
diff changeset
  1073
    }
ea3b6f7fd7ce added ignoredMethods
Claus Gittinger <cg@exept.de>
parents: 737
diff changeset
  1074
#endif
ea3b6f7fd7ce added ignoredMethods
Claus Gittinger <cg@exept.de>
parents: 737
diff changeset
  1075
%}.
ea3b6f7fd7ce added ignoredMethods
Claus Gittinger <cg@exept.de>
parents: 737
diff changeset
  1076
    ^ false
8526
326e7dcb212a *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 8518
diff changeset
  1077
! !
326e7dcb212a *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 8518
diff changeset
  1078
326e7dcb212a *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 8518
diff changeset
  1079
!Method privateMethodsFor:'accessing-visibility'!
326e7dcb212a *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 8518
diff changeset
  1080
326e7dcb212a *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 8518
diff changeset
  1081
primSetPrivacy:aSymbol
326e7dcb212a *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 8518
diff changeset
  1082
    "set the methods access rights (privacy) from a symbol;
326e7dcb212a *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 8518
diff changeset
  1083
     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
  1084
     #setPrivacy: simply sets the attribute. When changing methods, that
8526
326e7dcb212a *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 8518
diff changeset
  1085
     have already been called, #privacy: should be used.
326e7dcb212a *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 8518
diff changeset
  1086
326e7dcb212a *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 8518
diff changeset
  1087
     Notice: method privacy is a nonstandard feature, not supported
326e7dcb212a *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 8518
diff changeset
  1088
     by other smalltalk implementations and not specified in the ANSI spec.
326e7dcb212a *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 8518
diff changeset
  1089
     If at all, use it for debugging purposes, to catch messagesends
326e7dcb212a *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 8518
diff changeset
  1090
     which are not supposed to be sent by others.
326e7dcb212a *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 8518
diff changeset
  1091
     (especially, if working in a team, while integrating other peoples work)
326e7dcb212a *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 8518
diff changeset
  1092
326e7dcb212a *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 8518
diff changeset
  1093
     This is EXPERIMENTAL - and being evaluated for usability.
326e7dcb212a *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 8518
diff changeset
  1094
     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
  1095
326e7dcb212a *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 8518
diff changeset
  1096
%{  /* NOCONTEXT */
326e7dcb212a *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 8518
diff changeset
  1097
326e7dcb212a *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 8518
diff changeset
  1098
#if defined(M_PRIVACY)
326e7dcb212a *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 8518
diff changeset
  1099
    INT f = __intVal(__INST(flags));
326e7dcb212a *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 8518
diff changeset
  1100
    INT p;
326e7dcb212a *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 8518
diff changeset
  1101
326e7dcb212a *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 8518
diff changeset
  1102
    if (aSymbol == @symbol(public))
13662
7d7ae1e5f589 changed: #annotationAtIndex:
Claus Gittinger <cg@exept.de>
parents: 13660
diff changeset
  1103
        p = 0;
8526
326e7dcb212a *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 8518
diff changeset
  1104
    else if (aSymbol == @symbol(protected))
13662
7d7ae1e5f589 changed: #annotationAtIndex:
Claus Gittinger <cg@exept.de>
parents: 13660
diff changeset
  1105
        p = F_PRIVATE;
8526
326e7dcb212a *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 8518
diff changeset
  1106
    else if (aSymbol == @symbol(private))
13662
7d7ae1e5f589 changed: #annotationAtIndex:
Claus Gittinger <cg@exept.de>
parents: 13660
diff changeset
  1107
        p = F_CLASSPRIVATE;
8526
326e7dcb212a *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 8518
diff changeset
  1108
    else if (aSymbol == @symbol(ignored))
13662
7d7ae1e5f589 changed: #annotationAtIndex:
Claus Gittinger <cg@exept.de>
parents: 13660
diff changeset
  1109
        p = F_IGNORED;
8526
326e7dcb212a *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 8518
diff changeset
  1110
    else
13662
7d7ae1e5f589 changed: #annotationAtIndex:
Claus Gittinger <cg@exept.de>
parents: 13660
diff changeset
  1111
        RETURN(false);  /* illegal symbol */
12854
3a3d3c02c3bd *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 12695
diff changeset
  1112
8526
326e7dcb212a *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 8518
diff changeset
  1113
326e7dcb212a *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 8518
diff changeset
  1114
    f = (f & ~M_PRIVACY) | p;
8913
b9498d27a554 64bit; mkSmallInteger
Claus Gittinger <cg@exept.de>
parents: 8896
diff changeset
  1115
    __INST(flags) = __mkSmallInteger(f);
8526
326e7dcb212a *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 8518
diff changeset
  1116
#endif
326e7dcb212a *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 8518
diff changeset
  1117
326e7dcb212a *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 8518
diff changeset
  1118
%}.
326e7dcb212a *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 8518
diff changeset
  1119
    ^ true
326e7dcb212a *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 8518
diff changeset
  1120
326e7dcb212a *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 8518
diff changeset
  1121
    "Modified: 27.8.1995 / 22:58:08 / claus"
326e7dcb212a *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 8518
diff changeset
  1122
! !
326e7dcb212a *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 8518
diff changeset
  1123
326e7dcb212a *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 8518
diff changeset
  1124
!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
  1125
d600e08a5936 handle the case where a method has a sourceFileInfo, but the class has not
Claus Gittinger <cg@exept.de>
parents: 934
diff changeset
  1126
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
  1127
    "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
  1128
     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
  1129
d600e08a5936 handle the case where a method has a sourceFileInfo, but the class has not
Claus Gittinger <cg@exept.de>
parents: 934
diff changeset
  1130
     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
  1131
     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
  1132
     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
  1133
     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
  1134
     (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
  1135
d600e08a5936 handle the case where a method has a sourceFileInfo, but the class has not
Claus Gittinger <cg@exept.de>
parents: 934
diff changeset
  1136
     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
  1137
     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
  1138
3216
e0f3f49118ed Simplify privacy stuff to make redirection from WrappedMethod easier.
Stefan Vogel <sv@exept.de>
parents: 3168
diff changeset
  1139
%{  /* NOCONTEXT */
e0f3f49118ed Simplify privacy stuff to make redirection from WrappedMethod easier.
Stefan Vogel <sv@exept.de>
parents: 3168
diff changeset
  1140
    /* 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
  1141
e0f3f49118ed Simplify privacy stuff to make redirection from WrappedMethod easier.
Stefan Vogel <sv@exept.de>
parents: 3168
diff changeset
  1142
#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
  1143
e0f3f49118ed Simplify privacy stuff to make redirection from WrappedMethod easier.
Stefan Vogel <sv@exept.de>
parents: 3168
diff changeset
  1144
    INT f = __intVal(__INST(flags));
e0f3f49118ed Simplify privacy stuff to make redirection from WrappedMethod easier.
Stefan Vogel <sv@exept.de>
parents: 3168
diff changeset
  1145
    switch (f & M_PRIVACY) {
e0f3f49118ed Simplify privacy stuff to make redirection from WrappedMethod easier.
Stefan Vogel <sv@exept.de>
parents: 3168
diff changeset
  1146
e0f3f49118ed Simplify privacy stuff to make redirection from WrappedMethod easier.
Stefan Vogel <sv@exept.de>
parents: 3168
diff changeset
  1147
# ifdef F_PRIVATE
e0f3f49118ed Simplify privacy stuff to make redirection from WrappedMethod easier.
Stefan Vogel <sv@exept.de>
parents: 3168
diff changeset
  1148
    case F_PRIVATE:
13662
7d7ae1e5f589 changed: #annotationAtIndex:
Claus Gittinger <cg@exept.de>
parents: 13660
diff changeset
  1149
        RETURN (@symbol(protected));
7d7ae1e5f589 changed: #annotationAtIndex:
Claus Gittinger <cg@exept.de>
parents: 13660
diff changeset
  1150
        break;
3216
e0f3f49118ed Simplify privacy stuff to make redirection from WrappedMethod easier.
Stefan Vogel <sv@exept.de>
parents: 3168
diff changeset
  1151
# endif
e0f3f49118ed Simplify privacy stuff to make redirection from WrappedMethod easier.
Stefan Vogel <sv@exept.de>
parents: 3168
diff changeset
  1152
# ifdef F_CLASSPRIVATE
e0f3f49118ed Simplify privacy stuff to make redirection from WrappedMethod easier.
Stefan Vogel <sv@exept.de>
parents: 3168
diff changeset
  1153
    case F_CLASSPRIVATE:
13662
7d7ae1e5f589 changed: #annotationAtIndex:
Claus Gittinger <cg@exept.de>
parents: 13660
diff changeset
  1154
        RETURN (@symbol(private));
7d7ae1e5f589 changed: #annotationAtIndex:
Claus Gittinger <cg@exept.de>
parents: 13660
diff changeset
  1155
        break;
3216
e0f3f49118ed Simplify privacy stuff to make redirection from WrappedMethod easier.
Stefan Vogel <sv@exept.de>
parents: 3168
diff changeset
  1156
# endif
e0f3f49118ed Simplify privacy stuff to make redirection from WrappedMethod easier.
Stefan Vogel <sv@exept.de>
parents: 3168
diff changeset
  1157
# ifdef F_IGNORED
e0f3f49118ed Simplify privacy stuff to make redirection from WrappedMethod easier.
Stefan Vogel <sv@exept.de>
parents: 3168
diff changeset
  1158
    case F_IGNORED:
13662
7d7ae1e5f589 changed: #annotationAtIndex:
Claus Gittinger <cg@exept.de>
parents: 13660
diff changeset
  1159
        RETURN (@symbol(ignored));
7d7ae1e5f589 changed: #annotationAtIndex:
Claus Gittinger <cg@exept.de>
parents: 13660
diff changeset
  1160
        break;
3216
e0f3f49118ed Simplify privacy stuff to make redirection from WrappedMethod easier.
Stefan Vogel <sv@exept.de>
parents: 3168
diff changeset
  1161
# endif
e0f3f49118ed Simplify privacy stuff to make redirection from WrappedMethod easier.
Stefan Vogel <sv@exept.de>
parents: 3168
diff changeset
  1162
    }
e0f3f49118ed Simplify privacy stuff to make redirection from WrappedMethod easier.
Stefan Vogel <sv@exept.de>
parents: 3168
diff changeset
  1163
#endif
e0f3f49118ed Simplify privacy stuff to make redirection from WrappedMethod easier.
Stefan Vogel <sv@exept.de>
parents: 3168
diff changeset
  1164
%}.
e0f3f49118ed Simplify privacy stuff to make redirection from WrappedMethod easier.
Stefan Vogel <sv@exept.de>
parents: 3168
diff changeset
  1165
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
  1166
    ^ #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
  1167
!
d600e08a5936 handle the case where a method has a sourceFileInfo, but the class has not
Claus Gittinger <cg@exept.de>
parents: 934
diff changeset
  1168
d600e08a5936 handle the case where a method has a sourceFileInfo, but the class has not
Claus Gittinger <cg@exept.de>
parents: 934
diff changeset
  1169
privacy:aSymbol
d600e08a5936 handle the case where a method has a sourceFileInfo, but the class has not
Claus Gittinger <cg@exept.de>
parents: 934
diff changeset
  1170
    "set the methods access rights (privacy) from a symbol;
d600e08a5936 handle the case where a method has a sourceFileInfo, but the class has not
Claus Gittinger <cg@exept.de>
parents: 934
diff changeset
  1171
     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
  1172
d600e08a5936 handle the case where a method has a sourceFileInfo, but the class has not
Claus Gittinger <cg@exept.de>
parents: 934
diff changeset
  1173
     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
  1174
     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
  1175
     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
  1176
     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
  1177
     (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
  1178
d600e08a5936 handle the case where a method has a sourceFileInfo, but the class has not
Claus Gittinger <cg@exept.de>
parents: 934
diff changeset
  1179
     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
  1180
     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
  1181
8526
326e7dcb212a *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 8518
diff changeset
  1182
    |oldPrivacy|
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
    oldPrivacy := self privacy.
326e7dcb212a *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 8518
diff changeset
  1185
326e7dcb212a *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 8518
diff changeset
  1186
    (self setPrivacy:aSymbol flushCaches:true) ifTrue:[
13662
7d7ae1e5f589 changed: #annotationAtIndex:
Claus Gittinger <cg@exept.de>
parents: 13660
diff changeset
  1187
        |myClass mySelector|
7d7ae1e5f589 changed: #annotationAtIndex:
Claus Gittinger <cg@exept.de>
parents: 13660
diff changeset
  1188
7d7ae1e5f589 changed: #annotationAtIndex:
Claus Gittinger <cg@exept.de>
parents: 13660
diff changeset
  1189
        myClass := self mclass.
7d7ae1e5f589 changed: #annotationAtIndex:
Claus Gittinger <cg@exept.de>
parents: 13660
diff changeset
  1190
        mySelector := self selector.
7d7ae1e5f589 changed: #annotationAtIndex:
Claus Gittinger <cg@exept.de>
parents: 13660
diff changeset
  1191
7d7ae1e5f589 changed: #annotationAtIndex:
Claus Gittinger <cg@exept.de>
parents: 13660
diff changeset
  1192
        self changed:#privacy.                                       "/ will vanish
7d7ae1e5f589 changed: #annotationAtIndex:
Claus Gittinger <cg@exept.de>
parents: 13660
diff changeset
  1193
        myClass notNil ifTrue:[
7d7ae1e5f589 changed: #annotationAtIndex:
Claus Gittinger <cg@exept.de>
parents: 13660
diff changeset
  1194
            mySelector notNil ifTrue:[
7d7ae1e5f589 changed: #annotationAtIndex:
Claus Gittinger <cg@exept.de>
parents: 13660
diff changeset
  1195
                myClass changed:#methodPrivacy with:mySelector.      "/ will vanish
7d7ae1e5f589 changed: #annotationAtIndex:
Claus Gittinger <cg@exept.de>
parents: 13660
diff changeset
  1196
                Smalltalk changed:#privacyOfMethod with:(Array with:myClass with:self with:oldPrivacy).
7d7ae1e5f589 changed: #annotationAtIndex:
Claus Gittinger <cg@exept.de>
parents: 13660
diff changeset
  1197
                myClass addChangeRecordForMethodPrivacy:self.
7d7ae1e5f589 changed: #annotationAtIndex:
Claus Gittinger <cg@exept.de>
parents: 13660
diff changeset
  1198
            ]
7d7ae1e5f589 changed: #annotationAtIndex:
Claus Gittinger <cg@exept.de>
parents: 13660
diff changeset
  1199
        ]
3216
e0f3f49118ed Simplify privacy stuff to make redirection from WrappedMethod easier.
Stefan Vogel <sv@exept.de>
parents: 3168
diff changeset
  1200
    ]
10196
f72831ddec29 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10156
diff changeset
  1201
f72831ddec29 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10156
diff changeset
  1202
    "Modified: / 23-11-2006 / 17:03:20 / 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
  1203
!
747
ea3b6f7fd7ce added ignoredMethods
Claus Gittinger <cg@exept.de>
parents: 737
diff changeset
  1204
532
2511c99de912 New code to trap restricted (RT) methods.
Stefan Vogel <sv@exept.de>
parents: 530
diff changeset
  1205
restricted:aBoolean
12854
3a3d3c02c3bd *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 12695
diff changeset
  1206
    "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
  1207
     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
  1208
     'trap restricted mode' (-->ObjectMemory) otherise a runtime
2511c99de912 New code to trap restricted (RT) methods.
Stefan Vogel <sv@exept.de>
parents: 530
diff changeset
  1209
     error (PrivateMethodSignal) is raised.
747
ea3b6f7fd7ce added ignoredMethods
Claus Gittinger <cg@exept.de>
parents: 737
diff changeset
  1210
532
2511c99de912 New code to trap restricted (RT) methods.
Stefan Vogel <sv@exept.de>
parents: 530
diff changeset
  1211
     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
  1212
     by other smalltalk implementations and not specified in the ANSI spec.
747
ea3b6f7fd7ce added ignoredMethods
Claus Gittinger <cg@exept.de>
parents: 737
diff changeset
  1213
532
2511c99de912 New code to trap restricted (RT) methods.
Stefan Vogel <sv@exept.de>
parents: 530
diff changeset
  1214
     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
  1215
     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
  1216
2511c99de912 New code to trap restricted (RT) methods.
Stefan Vogel <sv@exept.de>
parents: 530
diff changeset
  1217
%{  /* NOCONTEXT */
2511c99de912 New code to trap restricted (RT) methods.
Stefan Vogel <sv@exept.de>
parents: 530
diff changeset
  1218
    /* 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
  1219
2511c99de912 New code to trap restricted (RT) methods.
Stefan Vogel <sv@exept.de>
parents: 530
diff changeset
  1220
#ifdef F_RESTRICTED
2868
772c890f907c alpha64
Claus Gittinger <cg@exept.de>
parents: 2826
diff changeset
  1221
    INT f = __intVal(__INST(flags));
772c890f907c alpha64
Claus Gittinger <cg@exept.de>
parents: 2826
diff changeset
  1222
    INT old;
532
2511c99de912 New code to trap restricted (RT) methods.
Stefan Vogel <sv@exept.de>
parents: 530
diff changeset
  1223
747
ea3b6f7fd7ce added ignoredMethods
Claus Gittinger <cg@exept.de>
parents: 737
diff changeset
  1224
    old = f;
12854
3a3d3c02c3bd *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 12695
diff changeset
  1225
    if (aBoolean == true)
13662
7d7ae1e5f589 changed: #annotationAtIndex:
Claus Gittinger <cg@exept.de>
parents: 13660
diff changeset
  1226
        f |= F_RESTRICTED;
532
2511c99de912 New code to trap restricted (RT) methods.
Stefan Vogel <sv@exept.de>
parents: 530
diff changeset
  1227
    else
13662
7d7ae1e5f589 changed: #annotationAtIndex:
Claus Gittinger <cg@exept.de>
parents: 13660
diff changeset
  1228
        f &= ~F_RESTRICTED;
8913
b9498d27a554 64bit; mkSmallInteger
Claus Gittinger <cg@exept.de>
parents: 8896
diff changeset
  1229
    __INST(flags) = __mkSmallInteger(f);
532
2511c99de912 New code to trap restricted (RT) methods.
Stefan Vogel <sv@exept.de>
parents: 530
diff changeset
  1230
    if (old & F_RESTRICTED)
13662
7d7ae1e5f589 changed: #annotationAtIndex:
Claus Gittinger <cg@exept.de>
parents: 13660
diff changeset
  1231
        RETURN(true);
532
2511c99de912 New code to trap restricted (RT) methods.
Stefan Vogel <sv@exept.de>
parents: 530
diff changeset
  1232
#endif
2511c99de912 New code to trap restricted (RT) methods.
Stefan Vogel <sv@exept.de>
parents: 530
diff changeset
  1233
%}.
2511c99de912 New code to trap restricted (RT) methods.
Stefan Vogel <sv@exept.de>
parents: 530
diff changeset
  1234
    ^ false
2511c99de912 New code to trap restricted (RT) methods.
Stefan Vogel <sv@exept.de>
parents: 530
diff changeset
  1235
747
ea3b6f7fd7ce added ignoredMethods
Claus Gittinger <cg@exept.de>
parents: 737
diff changeset
  1236
    "
ea3b6f7fd7ce added ignoredMethods
Claus Gittinger <cg@exept.de>
parents: 737
diff changeset
  1237
     (ObjectMemory class compiledMethodAt:#compressingGarbageCollect) restricted:true
ea3b6f7fd7ce added ignoredMethods
Claus Gittinger <cg@exept.de>
parents: 737
diff changeset
  1238
    "
532
2511c99de912 New code to trap restricted (RT) methods.
Stefan Vogel <sv@exept.de>
parents: 530
diff changeset
  1239
2511c99de912 New code to trap restricted (RT) methods.
Stefan Vogel <sv@exept.de>
parents: 530
diff changeset
  1240
    "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
  1241
!
2511c99de912 New code to trap restricted (RT) methods.
Stefan Vogel <sv@exept.de>
parents: 530
diff changeset
  1242
3216
e0f3f49118ed Simplify privacy stuff to make redirection from WrappedMethod easier.
Stefan Vogel <sv@exept.de>
parents: 3168
diff changeset
  1243
setPrivacy:aSymbol
e0f3f49118ed Simplify privacy stuff to make redirection from WrappedMethod easier.
Stefan Vogel <sv@exept.de>
parents: 3168
diff changeset
  1244
    "set the methods access rights (privacy) from a symbol;
e0f3f49118ed Simplify privacy stuff to make redirection from WrappedMethod easier.
Stefan Vogel <sv@exept.de>
parents: 3168
diff changeset
  1245
     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
  1246
     #setPrivacy: simply sets the attribute. When changing methods, that
3216
e0f3f49118ed Simplify privacy stuff to make redirection from WrappedMethod easier.
Stefan Vogel <sv@exept.de>
parents: 3168
diff changeset
  1247
     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
  1248
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
     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
  1250
     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
  1251
     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
  1252
     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
  1253
     (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
  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
     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
  1256
     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
  1257
8526
326e7dcb212a *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 8518
diff changeset
  1258
    ^ self setPrivacy:aSymbol flushCaches:true
326e7dcb212a *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 8518
diff changeset
  1259
!
326e7dcb212a *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 8518
diff changeset
  1260
326e7dcb212a *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 8518
diff changeset
  1261
setPrivacy:aSymbol flushCaches:doFlush
326e7dcb212a *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 8518
diff changeset
  1262
    "set the methods access rights (privacy) from a symbol;
326e7dcb212a *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 8518
diff changeset
  1263
     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
  1264
     #setPrivacy: simply sets the attribute. When changing methods, that
8526
326e7dcb212a *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 8518
diff changeset
  1265
     have already been called, #privacy: should be used.
326e7dcb212a *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 8518
diff changeset
  1266
326e7dcb212a *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 8518
diff changeset
  1267
     Notice: method privacy is a nonstandard feature, not supported
326e7dcb212a *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 8518
diff changeset
  1268
     by other smalltalk implementations and not specified in the ANSI spec.
326e7dcb212a *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 8518
diff changeset
  1269
     If at all, use it for debugging purposes, to catch messagesends
326e7dcb212a *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 8518
diff changeset
  1270
     which are not supposed to be sent by others.
326e7dcb212a *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 8518
diff changeset
  1271
     (especially, if working in a team, while integrating other peoples work)
326e7dcb212a *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 8518
diff changeset
  1272
326e7dcb212a *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 8518
diff changeset
  1273
     This is EXPERIMENTAL - and being evaluated for usability.
326e7dcb212a *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 8518
diff changeset
  1274
     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
  1275
326e7dcb212a *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 8518
diff changeset
  1276
    |old sel|
326e7dcb212a *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 8518
diff changeset
  1277
326e7dcb212a *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 8518
diff changeset
  1278
    old := self privacy.
326e7dcb212a *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 8518
diff changeset
  1279
    old == aSymbol ifTrue:[^ false].
326e7dcb212a *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 8518
diff changeset
  1280
    (self primSetPrivacy:aSymbol) ifFalse:[^ false].
326e7dcb212a *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 8518
diff changeset
  1281
326e7dcb212a *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 8518
diff changeset
  1282
    "/
326e7dcb212a *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 8518
diff changeset
  1283
    "/ no need to flush, if changing from private to public
326e7dcb212a *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 8518
diff changeset
  1284
    "/
326e7dcb212a *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 8518
diff changeset
  1285
    doFlush ifTrue:[
13662
7d7ae1e5f589 changed: #annotationAtIndex:
Claus Gittinger <cg@exept.de>
parents: 13660
diff changeset
  1286
        (aSymbol == #public and:[old ~~ #ignored]) ifFalse:[
7d7ae1e5f589 changed: #annotationAtIndex:
Claus Gittinger <cg@exept.de>
parents: 13660
diff changeset
  1287
            (sel := self selector) notNil ifTrue:[
7d7ae1e5f589 changed: #annotationAtIndex:
Claus Gittinger <cg@exept.de>
parents: 13660
diff changeset
  1288
                ObjectMemory flushCachesForSelector:sel
7d7ae1e5f589 changed: #annotationAtIndex:
Claus Gittinger <cg@exept.de>
parents: 13660
diff changeset
  1289
            ] ifFalse:[
7d7ae1e5f589 changed: #annotationAtIndex:
Claus Gittinger <cg@exept.de>
parents: 13660
diff changeset
  1290
                ObjectMemory flushCaches.
7d7ae1e5f589 changed: #annotationAtIndex:
Claus Gittinger <cg@exept.de>
parents: 13660
diff changeset
  1291
            ].
7d7ae1e5f589 changed: #annotationAtIndex:
Claus Gittinger <cg@exept.de>
parents: 13660
diff changeset
  1292
        ].
8526
326e7dcb212a *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 8518
diff changeset
  1293
    ].
3216
e0f3f49118ed Simplify privacy stuff to make redirection from WrappedMethod easier.
Stefan Vogel <sv@exept.de>
parents: 3168
diff changeset
  1294
    ^ true
1
a27a279701f8 Initial revision
claus
parents:
diff changeset
  1295
! !
a27a279701f8 Initial revision
claus
parents:
diff changeset
  1296
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
  1297
!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
  1298
d600e08a5936 handle the case where a method has a sourceFileInfo, but the class has not
Claus Gittinger <cg@exept.de>
parents: 934
diff changeset
  1299
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
  1300
    "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
  1301
     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
  1302
     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
  1303
     the methodDictionary of any class - just returned.
2064
68b185fbddb6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 2063
diff changeset
  1304
     If the method contains primitive code, this may return a method
68b185fbddb6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 2063
diff changeset
  1305
     without bytecode.
12854
3a3d3c02c3bd *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 12695
diff changeset
  1306
     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
  1307
     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
  1308
     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
  1309
9096
84df3b129718 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9075
diff changeset
  1310
    |mthd|
1
a27a279701f8 Initial revision
claus
parents:
diff changeset
  1311
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
  1312
    byteCode notNil ifTrue:[
13662
7d7ae1e5f589 changed: #annotationAtIndex:
Claus Gittinger <cg@exept.de>
parents: 13660
diff changeset
  1313
        "
7d7ae1e5f589 changed: #annotationAtIndex:
Claus Gittinger <cg@exept.de>
parents: 13660
diff changeset
  1314
         is already a bytecoded method
7d7ae1e5f589 changed: #annotationAtIndex:
Claus Gittinger <cg@exept.de>
parents: 13660
diff changeset
  1315
        "
7d7ae1e5f589 changed: #annotationAtIndex:
Claus Gittinger <cg@exept.de>
parents: 13660
diff changeset
  1316
        ^ 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
  1317
    ].
9096
84df3b129718 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9075
diff changeset
  1318
84df3b129718 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9075
diff changeset
  1319
    ParserFlags
13662
7d7ae1e5f589 changed: #annotationAtIndex:
Claus Gittinger <cg@exept.de>
parents: 13660
diff changeset
  1320
        withSTCCompilation:#never
7d7ae1e5f589 changed: #annotationAtIndex:
Claus Gittinger <cg@exept.de>
parents: 13660
diff changeset
  1321
        do:[
7d7ae1e5f589 changed: #annotationAtIndex:
Claus Gittinger <cg@exept.de>
parents: 13660
diff changeset
  1322
            mthd := self asExecutableMethod.
7d7ae1e5f589 changed: #annotationAtIndex:
Claus Gittinger <cg@exept.de>
parents: 13660
diff changeset
  1323
        ].
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
  1324
    ^ mthd
68
59faa75185ba *** empty log message ***
claus
parents: 56
diff changeset
  1325
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
  1326
    "Created: 24.10.1995 / 14:02:32 / cg"
2064
68b185fbddb6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 2063
diff changeset
  1327
    "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
  1328
!
306
365e65400c93 *** empty log message ***
claus
parents: 302
diff changeset
  1329
5405
f07c8045ab4e *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5398
diff changeset
  1330
asByteCodeMethodWithSource:newSource
9096
84df3b129718 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9075
diff changeset
  1331
    |mthd|
84df3b129718 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9075
diff changeset
  1332
12854
3a3d3c02c3bd *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 12695
diff changeset
  1333
    ParserFlags
13662
7d7ae1e5f589 changed: #annotationAtIndex:
Claus Gittinger <cg@exept.de>
parents: 13660
diff changeset
  1334
        withSTCCompilation:#never
7d7ae1e5f589 changed: #annotationAtIndex:
Claus Gittinger <cg@exept.de>
parents: 13660
diff changeset
  1335
        do:[
7d7ae1e5f589 changed: #annotationAtIndex:
Claus Gittinger <cg@exept.de>
parents: 13660
diff changeset
  1336
            mthd := self asExecutableMethodWithSource:newSource.
7d7ae1e5f589 changed: #annotationAtIndex:
Claus Gittinger <cg@exept.de>
parents: 13660
diff changeset
  1337
        ].
5405
f07c8045ab4e *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5398
diff changeset
  1338
    ^ mthd
f07c8045ab4e *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5398
diff changeset
  1339
f07c8045ab4e *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5398
diff changeset
  1340
    "Created: 24.10.1995 / 14:02:32 / cg"
f07c8045ab4e *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5398
diff changeset
  1341
    "Modified: 5.1.1997 / 01:01:53 / cg"
f07c8045ab4e *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5398
diff changeset
  1342
!
f07c8045ab4e *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5398
diff changeset
  1343
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
  1344
asExecutableMethod
12854
3a3d3c02c3bd *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 12695
diff changeset
  1345
    "if the receiver has neither bytecodes nor machinecode, create & return a
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
  1346
     method having semantics as the receivers source. This may be machine 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
  1347
     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
  1348
     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
  1349
     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
  1350
     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
  1351
     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
  1352
5700
ee59aff043c4 asExecutableMethod / asExecutableMethodWith: - code reuse
Claus Gittinger <cg@exept.de>
parents: 5696
diff changeset
  1353
    |temporaryMethod sourceString|
306
365e65400c93 *** empty log message ***
claus
parents: 302
diff changeset
  1354
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
  1355
    byteCode notNil ifTrue:[
13662
7d7ae1e5f589 changed: #annotationAtIndex:
Claus Gittinger <cg@exept.de>
parents: 13660
diff changeset
  1356
        "
7d7ae1e5f589 changed: #annotationAtIndex:
Claus Gittinger <cg@exept.de>
parents: 13660
diff changeset
  1357
         is already a bytecoded method
7d7ae1e5f589 changed: #annotationAtIndex:
Claus Gittinger <cg@exept.de>
parents: 13660
diff changeset
  1358
        "
7d7ae1e5f589 changed: #annotationAtIndex:
Claus Gittinger <cg@exept.de>
parents: 13660
diff changeset
  1359
        ^ self
5700
ee59aff043c4 asExecutableMethod / asExecutableMethodWith: - code reuse
Claus Gittinger <cg@exept.de>
parents: 5696
diff changeset
  1360
    ].
ee59aff043c4 asExecutableMethod / asExecutableMethodWith: - code reuse
Claus Gittinger <cg@exept.de>
parents: 5696
diff changeset
  1361
ee59aff043c4 asExecutableMethod / asExecutableMethodWith: - code reuse
Claus Gittinger <cg@exept.de>
parents: 5696
diff changeset
  1362
    sourceString := self source.
ee59aff043c4 asExecutableMethod / asExecutableMethodWith: - code reuse
Claus Gittinger <cg@exept.de>
parents: 5696
diff changeset
  1363
    sourceString isNil ifTrue:[
13662
7d7ae1e5f589 changed: #annotationAtIndex:
Claus Gittinger <cg@exept.de>
parents: 13660
diff changeset
  1364
        'Method [warning]: cannot generate bytecode (no source for compilation)' errorPrintCR.
7d7ae1e5f589 changed: #annotationAtIndex:
Claus Gittinger <cg@exept.de>
parents: 13660
diff changeset
  1365
        ^ 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
  1366
    ].
d600e08a5936 handle the case where a method has a sourceFileInfo, but the class has not
Claus Gittinger <cg@exept.de>
parents: 934
diff changeset
  1367
5700
ee59aff043c4 asExecutableMethod / asExecutableMethodWith: - code reuse
Claus Gittinger <cg@exept.de>
parents: 5696
diff changeset
  1368
    temporaryMethod := self asExecutableMethodWithSource:sourceString.
ee59aff043c4 asExecutableMethod / asExecutableMethodWith: - code reuse
Claus Gittinger <cg@exept.de>
parents: 5696
diff changeset
  1369
ee59aff043c4 asExecutableMethod / asExecutableMethodWith: - code reuse
Claus Gittinger <cg@exept.de>
parents: 5696
diff changeset
  1370
    (temporaryMethod isNil or:[temporaryMethod == #Error]) ifTrue:[
13662
7d7ae1e5f589 changed: #annotationAtIndex:
Claus Gittinger <cg@exept.de>
parents: 13660
diff changeset
  1371
        'Method [warning]: cannot generate bytecode (contains primitive code or error)' errorPrintCR.
7d7ae1e5f589 changed: #annotationAtIndex:
Claus Gittinger <cg@exept.de>
parents: 13660
diff changeset
  1372
        ^ nil.
5700
ee59aff043c4 asExecutableMethod / asExecutableMethodWith: - code reuse
Claus Gittinger <cg@exept.de>
parents: 5696
diff changeset
  1373
    ].
ee59aff043c4 asExecutableMethod / asExecutableMethodWith: - code reuse
Claus Gittinger <cg@exept.de>
parents: 5696
diff changeset
  1374
    "/
ee59aff043c4 asExecutableMethod / asExecutableMethodWith: - code reuse
Claus Gittinger <cg@exept.de>
parents: 5696
diff changeset
  1375
    "/ 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
  1376
    "/
12854
3a3d3c02c3bd *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 12695
diff changeset
  1377
    temporaryMethod sourceFilename:source position:sourcePosition.
5700
ee59aff043c4 asExecutableMethod / asExecutableMethodWith: - code reuse
Claus Gittinger <cg@exept.de>
parents: 5696
diff changeset
  1378
    ^ temporaryMethod
ee59aff043c4 asExecutableMethod / asExecutableMethodWith: - code reuse
Claus Gittinger <cg@exept.de>
parents: 5696
diff changeset
  1379
!
ee59aff043c4 asExecutableMethod / asExecutableMethodWith: - code reuse
Claus Gittinger <cg@exept.de>
parents: 5696
diff changeset
  1380
ee59aff043c4 asExecutableMethod / asExecutableMethodWith: - code reuse
Claus Gittinger <cg@exept.de>
parents: 5696
diff changeset
  1381
asExecutableMethodWithSource:newSource
ee59aff043c4 asExecutableMethod / asExecutableMethodWith: - code reuse
Claus Gittinger <cg@exept.de>
parents: 5696
diff changeset
  1382
    |temporaryMethod cls|
ee59aff043c4 asExecutableMethod / asExecutableMethodWith: - code reuse
Claus Gittinger <cg@exept.de>
parents: 5696
diff changeset
  1383
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
  1384
    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
  1385
    cls isNil ifTrue:[
13662
7d7ae1e5f589 changed: #annotationAtIndex:
Claus Gittinger <cg@exept.de>
parents: 13660
diff changeset
  1386
        'Method [warning]: cannot generate bytecode (no class for compilation)' errorPrintCR.
7d7ae1e5f589 changed: #annotationAtIndex:
Claus Gittinger <cg@exept.de>
parents: 13660
diff changeset
  1387
        ^ nil
306
365e65400c93 *** empty log message ***
claus
parents: 302
diff changeset
  1388
    ].
1
a27a279701f8 Initial revision
claus
parents:
diff changeset
  1389
4290
5e43473d7a35 moved recompilation semaphore from LazyMethod to Method
Claus Gittinger <cg@exept.de>
parents: 4015
diff changeset
  1390
    "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
  1391
     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
  1392
     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
  1393
     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
  1394
     (happened when autoloading animation demos)
176
48061f8659aa more queries
claus
parents: 159
diff changeset
  1395
    "
4290
5e43473d7a35 moved recompilation semaphore from LazyMethod to Method
Claus Gittinger <cg@exept.de>
parents: 4015
diff changeset
  1396
    CompilationLock critical:[
13662
7d7ae1e5f589 changed: #annotationAtIndex:
Claus Gittinger <cg@exept.de>
parents: 13660
diff changeset
  1397
        "
7d7ae1e5f589 changed: #annotationAtIndex:
Claus Gittinger <cg@exept.de>
parents: 13660
diff changeset
  1398
         dont want this to go into the changes file,
7d7ae1e5f589 changed: #annotationAtIndex:
Claus Gittinger <cg@exept.de>
parents: 13660
diff changeset
  1399
         dont want output on Transcript and definitely
7d7ae1e5f589 changed: #annotationAtIndex:
Claus Gittinger <cg@exept.de>
parents: 13660
diff changeset
  1400
         dont want a lazy method ...
7d7ae1e5f589 changed: #annotationAtIndex:
Claus Gittinger <cg@exept.de>
parents: 13660
diff changeset
  1401
        "
7d7ae1e5f589 changed: #annotationAtIndex:
Claus Gittinger <cg@exept.de>
parents: 13660
diff changeset
  1402
        Class withoutUpdatingChangesDo:[
7d7ae1e5f589 changed: #annotationAtIndex:
Claus Gittinger <cg@exept.de>
parents: 13660
diff changeset
  1403
            |silent lazy|
7d7ae1e5f589 changed: #annotationAtIndex:
Claus Gittinger <cg@exept.de>
parents: 13660
diff changeset
  1404
7d7ae1e5f589 changed: #annotationAtIndex:
Claus Gittinger <cg@exept.de>
parents: 13660
diff changeset
  1405
            silent := Smalltalk silentLoading:true.
7d7ae1e5f589 changed: #annotationAtIndex:
Claus Gittinger <cg@exept.de>
parents: 13660
diff changeset
  1406
            lazy := Compiler compileLazy:false.
7d7ae1e5f589 changed: #annotationAtIndex:
Claus Gittinger <cg@exept.de>
parents: 13660
diff changeset
  1407
7d7ae1e5f589 changed: #annotationAtIndex:
Claus Gittinger <cg@exept.de>
parents: 13660
diff changeset
  1408
            [
7d7ae1e5f589 changed: #annotationAtIndex:
Claus Gittinger <cg@exept.de>
parents: 13660
diff changeset
  1409
                |compiler|
7d7ae1e5f589 changed: #annotationAtIndex:
Claus Gittinger <cg@exept.de>
parents: 13660
diff changeset
  1410
7d7ae1e5f589 changed: #annotationAtIndex:
Claus Gittinger <cg@exept.de>
parents: 13660
diff changeset
  1411
                Class nameSpaceQuerySignal answer:(cls nameSpace)
7d7ae1e5f589 changed: #annotationAtIndex:
Claus Gittinger <cg@exept.de>
parents: 13660
diff changeset
  1412
                do:[
7d7ae1e5f589 changed: #annotationAtIndex:
Claus Gittinger <cg@exept.de>
parents: 13660
diff changeset
  1413
                    compiler := cls compilerClass.
7d7ae1e5f589 changed: #annotationAtIndex:
Claus Gittinger <cg@exept.de>
parents: 13660
diff changeset
  1414
7d7ae1e5f589 changed: #annotationAtIndex:
Claus Gittinger <cg@exept.de>
parents: 13660
diff changeset
  1415
                    "/
7d7ae1e5f589 changed: #annotationAtIndex:
Claus Gittinger <cg@exept.de>
parents: 13660
diff changeset
  1416
                    "/ kludge - have to make ST/X's compiler protocol
7d7ae1e5f589 changed: #annotationAtIndex:
Claus Gittinger <cg@exept.de>
parents: 13660
diff changeset
  1417
                    "/ be compatible to ST-80's
7d7ae1e5f589 changed: #annotationAtIndex:
Claus Gittinger <cg@exept.de>
parents: 13660
diff changeset
  1418
                    "/
7d7ae1e5f589 changed: #annotationAtIndex:
Claus Gittinger <cg@exept.de>
parents: 13660
diff changeset
  1419
                    (compiler respondsTo:#compile:forClass:inCategory:notifying:install:)
7d7ae1e5f589 changed: #annotationAtIndex:
Claus Gittinger <cg@exept.de>
parents: 13660
diff changeset
  1420
                    ifTrue:[
7d7ae1e5f589 changed: #annotationAtIndex:
Claus Gittinger <cg@exept.de>
parents: 13660
diff changeset
  1421
                        temporaryMethod := compiler
7d7ae1e5f589 changed: #annotationAtIndex:
Claus Gittinger <cg@exept.de>
parents: 13660
diff changeset
  1422
                                             compile:newSource
7d7ae1e5f589 changed: #annotationAtIndex:
Claus Gittinger <cg@exept.de>
parents: 13660
diff changeset
  1423
                                             forClass:cls
7d7ae1e5f589 changed: #annotationAtIndex:
Claus Gittinger <cg@exept.de>
parents: 13660
diff changeset
  1424
                                             inCategory:(self category)
7d7ae1e5f589 changed: #annotationAtIndex:
Claus Gittinger <cg@exept.de>
parents: 13660
diff changeset
  1425
                                             notifying:nil
7d7ae1e5f589 changed: #annotationAtIndex:
Claus Gittinger <cg@exept.de>
parents: 13660
diff changeset
  1426
                                             install:false.
7d7ae1e5f589 changed: #annotationAtIndex:
Claus Gittinger <cg@exept.de>
parents: 13660
diff changeset
  1427
                    ] ifFalse:[
7d7ae1e5f589 changed: #annotationAtIndex:
Claus Gittinger <cg@exept.de>
parents: 13660
diff changeset
  1428
                        temporaryMethod := compiler new
7d7ae1e5f589 changed: #annotationAtIndex:
Claus Gittinger <cg@exept.de>
parents: 13660
diff changeset
  1429
                                             compile:newSource
7d7ae1e5f589 changed: #annotationAtIndex:
Claus Gittinger <cg@exept.de>
parents: 13660
diff changeset
  1430
                                             in:cls
7d7ae1e5f589 changed: #annotationAtIndex:
Claus Gittinger <cg@exept.de>
parents: 13660
diff changeset
  1431
                                             notifying:nil
7d7ae1e5f589 changed: #annotationAtIndex:
Claus Gittinger <cg@exept.de>
parents: 13660
diff changeset
  1432
                                             ifFail:nil
7d7ae1e5f589 changed: #annotationAtIndex:
Claus Gittinger <cg@exept.de>
parents: 13660
diff changeset
  1433
                    ].
7d7ae1e5f589 changed: #annotationAtIndex:
Claus Gittinger <cg@exept.de>
parents: 13660
diff changeset
  1434
                ].
7d7ae1e5f589 changed: #annotationAtIndex:
Claus Gittinger <cg@exept.de>
parents: 13660
diff changeset
  1435
            ] ensure:[
7d7ae1e5f589 changed: #annotationAtIndex:
Claus Gittinger <cg@exept.de>
parents: 13660
diff changeset
  1436
                Compiler compileLazy:lazy.
7d7ae1e5f589 changed: #annotationAtIndex:
Claus Gittinger <cg@exept.de>
parents: 13660
diff changeset
  1437
                Smalltalk silentLoading:silent.
7d7ae1e5f589 changed: #annotationAtIndex:
Claus Gittinger <cg@exept.de>
parents: 13660
diff changeset
  1438
            ]
7d7ae1e5f589 changed: #annotationAtIndex:
Claus Gittinger <cg@exept.de>
parents: 13660
diff changeset
  1439
        ].
463
447ead9f870c be silent on transcript when parsing for args, vars and primitiveCode
Claus Gittinger <cg@exept.de>
parents: 444
diff changeset
  1440
    ].
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
  1441
    (temporaryMethod isNil or:[temporaryMethod == #Error]) ifTrue:[
13662
7d7ae1e5f589 changed: #annotationAtIndex:
Claus Gittinger <cg@exept.de>
parents: 13660
diff changeset
  1442
        'Method [warning]: cannot generate bytecode (contains primitive code or error)' errorPrintCR.
7d7ae1e5f589 changed: #annotationAtIndex:
Claus Gittinger <cg@exept.de>
parents: 13660
diff changeset
  1443
        ^ nil.
5405
f07c8045ab4e *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5398
diff changeset
  1444
    ].
f07c8045ab4e *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5398
diff changeset
  1445
    "/
f07c8045ab4e *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5398
diff changeset
  1446
    "/ 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
  1447
    "/
12854
3a3d3c02c3bd *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 12695
diff changeset
  1448
    temporaryMethod source:newSource.
5405
f07c8045ab4e *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5398
diff changeset
  1449
    "/
f07c8045ab4e *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5398
diff changeset
  1450
    "/ dont forget the methods class & package ...
f07c8045ab4e *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5398
diff changeset
  1451
    "/
f07c8045ab4e *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5398
diff changeset
  1452
    temporaryMethod setPackage:package.
f07c8045ab4e *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5398
diff changeset
  1453
    temporaryMethod mclass:mclass.
f07c8045ab4e *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5398
diff changeset
  1454
    ^ temporaryMethod
1
a27a279701f8 Initial revision
claus
parents:
diff changeset
  1455
! !
a27a279701f8 Initial revision
claus
parents:
diff changeset
  1456
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
  1457
!Method methodsFor:'copying'!
438
claus
parents: 423
diff changeset
  1458
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
  1459
copy
2176
1a24b0cef25a when compressing sources, make certain to avoid later
Claus Gittinger <cg@exept.de>
parents: 2171
diff changeset
  1460
    "redefined to change a source ref into a real string"
438
claus
parents: 423
diff changeset
  1461
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
  1462
    |aCopy|
438
claus
parents: 423
diff changeset
  1463
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
  1464
    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
  1465
    sourcePosition notNil ifTrue:[
13662
7d7ae1e5f589 changed: #annotationAtIndex:
Claus Gittinger <cg@exept.de>
parents: 13660
diff changeset
  1466
        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
  1467
    ].
5676
db728e9fe276 must flush cached mclass, when copying methods around
src
parents: 5665
diff changeset
  1468
    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
  1469
    ^ aCopy
2176
1a24b0cef25a when compressing sources, make certain to avoid later
Claus Gittinger <cg@exept.de>
parents: 2171
diff changeset
  1470
5696
958a0643496d compatibility
Claus Gittinger <cg@exept.de>
parents: 5676
diff changeset
  1471
    "Modified: 16.1.1997 / 01:27:25 / cg"
958a0643496d compatibility
Claus Gittinger <cg@exept.de>
parents: 5676
diff changeset
  1472
! !
438
claus
parents: 423
diff changeset
  1473
1
a27a279701f8 Initial revision
claus
parents:
diff changeset
  1474
!Method methodsFor:'error handling'!
a27a279701f8 Initial revision
claus
parents:
diff changeset
  1475
328
claus
parents: 326
diff changeset
  1476
invalidCodeObject
1873
3544a4a94a2a checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1870
diff changeset
  1477
    "{ Pragma: +optSpace }"
3544a4a94a2a checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1870
diff changeset
  1478
93
e31220cb391f *** empty log message ***
claus
parents: 88
diff changeset
  1479
    "this method is triggered by the interpreter when a nil or non method
e31220cb391f *** empty log message ***
claus
parents: 88
diff changeset
  1480
     is about to be executed.
e31220cb391f *** empty log message ***
claus
parents: 88
diff changeset
  1481
     In this case, the VM sends this to the bad method (the receiver).
e31220cb391f *** empty log message ***
claus
parents: 88
diff changeset
  1482
e31220cb391f *** empty log message ***
claus
parents: 88
diff changeset
  1483
     Also, the Compiler creates methods with their code/bytecode set to
e31220cb391f *** empty log message ***
claus
parents: 88
diff changeset
  1484
     this method if - after a class change - a method cannot be compiled
e31220cb391f *** empty log message ***
claus
parents: 88
diff changeset
  1485
     and is therefore no longer executable (for example, after an instvar
68
59faa75185ba *** empty log message ***
claus
parents: 56
diff changeset
  1486
     has been removed, and a method still tries to access this instvar)
44
b262907c93ea *** empty log message ***
claus
parents: 42
diff changeset
  1487
93
e31220cb391f *** empty log message ***
claus
parents: 88
diff changeset
  1488
     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
  1489
     or compiler/runtime system is broken :-(,
93
e31220cb391f *** empty log message ***
claus
parents: 88
diff changeset
  1490
     or you ignore the error messages during some recompile."
1
a27a279701f8 Initial revision
claus
parents:
diff changeset
  1491
1873
3544a4a94a2a checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1870
diff changeset
  1492
%{
3544a4a94a2a checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1870
diff changeset
  1493
    /*
3544a4a94a2a checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1870
diff changeset
  1494
     * for reasons too far from being explained here,
3544a4a94a2a checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1870
diff changeset
  1495
     * this MUST be a compiled method
3544a4a94a2a checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1870
diff changeset
  1496
     */
3544a4a94a2a checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1870
diff changeset
  1497
%}.
7601
57c257f1150a Fix race when accessing source
Stefan Vogel <sv@exept.de>
parents: 7457
diff changeset
  1498
    ^ InvalidCodeError
13662
7d7ae1e5f589 changed: #annotationAtIndex:
Claus Gittinger <cg@exept.de>
parents: 13660
diff changeset
  1499
        raiseErrorString:'invalid method - not executable'.
1873
3544a4a94a2a checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1870
diff changeset
  1500
3544a4a94a2a checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1870
diff changeset
  1501
    "Modified: 4.11.1996 / 22:45:06 / cg"
1
a27a279701f8 Initial revision
claus
parents:
diff changeset
  1502
!
a27a279701f8 Initial revision
claus
parents:
diff changeset
  1503
13693
16c890248840 added: #invalidCodeObjectWith:
sr
parents: 13683
diff changeset
  1504
invalidCodeObjectWith:arg
16c890248840 added: #invalidCodeObjectWith:
sr
parents: 13683
diff changeset
  1505
    "{ Pragma: +optSpace }"
16c890248840 added: #invalidCodeObjectWith:
sr
parents: 13683
diff changeset
  1506
16c890248840 added: #invalidCodeObjectWith:
sr
parents: 13683
diff changeset
  1507
    "When recompiling classes after a definition-change, all
16c890248840 added: #invalidCodeObjectWith:
sr
parents: 13683
diff changeset
  1508
     uncompilable methods (with 2 args) will be bound to this method here,
16c890248840 added: #invalidCodeObjectWith:
sr
parents: 13683
diff changeset
  1509
     so that evaluating such an uncompilable method will trigger an error."
16c890248840 added: #invalidCodeObjectWith:
sr
parents: 13683
diff changeset
  1510
16c890248840 added: #invalidCodeObjectWith:
sr
parents: 13683
diff changeset
  1511
%{
16c890248840 added: #invalidCodeObjectWith:
sr
parents: 13683
diff changeset
  1512
    /*
16c890248840 added: #invalidCodeObjectWith:
sr
parents: 13683
diff changeset
  1513
     * for reasons too far from being explained here,
16c890248840 added: #invalidCodeObjectWith:
sr
parents: 13683
diff changeset
  1514
     * this MUST be a compiled method
16c890248840 added: #invalidCodeObjectWith:
sr
parents: 13683
diff changeset
  1515
     */
16c890248840 added: #invalidCodeObjectWith:
sr
parents: 13683
diff changeset
  1516
%}.
16c890248840 added: #invalidCodeObjectWith:
sr
parents: 13683
diff changeset
  1517
    ^ InvalidCodeError
16c890248840 added: #invalidCodeObjectWith:
sr
parents: 13683
diff changeset
  1518
        raiseErrorString:'invalid method - not executable'.
16c890248840 added: #invalidCodeObjectWith:
sr
parents: 13683
diff changeset
  1519
16c890248840 added: #invalidCodeObjectWith:
sr
parents: 13683
diff changeset
  1520
    "Created: / 14-09-2011 / 11:23:49 / sr"
16c890248840 added: #invalidCodeObjectWith:
sr
parents: 13683
diff changeset
  1521
!
16c890248840 added: #invalidCodeObjectWith:
sr
parents: 13683
diff changeset
  1522
1870
2623b60c27e1 lifted numVars; added access for invalidCodeObject-trappers
Claus Gittinger <cg@exept.de>
parents: 1855
diff changeset
  1523
invalidCodeObjectWith:arg with:arg2
1873
3544a4a94a2a checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1870
diff changeset
  1524
    "{ Pragma: +optSpace }"
3544a4a94a2a checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1870
diff changeset
  1525
1870
2623b60c27e1 lifted numVars; added access for invalidCodeObject-trappers
Claus Gittinger <cg@exept.de>
parents: 1855
diff changeset
  1526
    "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
  1527
     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
  1528
     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
  1529
1873
3544a4a94a2a checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1870
diff changeset
  1530
%{
3544a4a94a2a checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1870
diff changeset
  1531
    /*
3544a4a94a2a checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1870
diff changeset
  1532
     * for reasons too far from being explained here,
3544a4a94a2a checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1870
diff changeset
  1533
     * this MUST be a compiled method
3544a4a94a2a checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1870
diff changeset
  1534
     */
3544a4a94a2a checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1870
diff changeset
  1535
%}.
7601
57c257f1150a Fix race when accessing source
Stefan Vogel <sv@exept.de>
parents: 7457
diff changeset
  1536
    ^ InvalidCodeError
13662
7d7ae1e5f589 changed: #annotationAtIndex:
Claus Gittinger <cg@exept.de>
parents: 13660
diff changeset
  1537
        raiseErrorString:'invalid method - not executable'.
1870
2623b60c27e1 lifted numVars; added access for invalidCodeObject-trappers
Claus Gittinger <cg@exept.de>
parents: 1855
diff changeset
  1538
2623b60c27e1 lifted numVars; added access for invalidCodeObject-trappers
Claus Gittinger <cg@exept.de>
parents: 1855
diff changeset
  1539
    "Created: 4.11.1996 / 21:16:41 / cg"
1873
3544a4a94a2a checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1870
diff changeset
  1540
    "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
  1541
!
2623b60c27e1 lifted numVars; added access for invalidCodeObject-trappers
Claus Gittinger <cg@exept.de>
parents: 1855
diff changeset
  1542
2623b60c27e1 lifted numVars; added access for invalidCodeObject-trappers
Claus Gittinger <cg@exept.de>
parents: 1855
diff changeset
  1543
invalidCodeObjectWith:arg with:arg2 with:arg3
1873
3544a4a94a2a checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1870
diff changeset
  1544
    "{ Pragma: +optSpace }"
3544a4a94a2a checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1870
diff changeset
  1545
1870
2623b60c27e1 lifted numVars; added access for invalidCodeObject-trappers
Claus Gittinger <cg@exept.de>
parents: 1855
diff changeset
  1546
    "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
  1547
     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
  1548
     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
  1549
1873
3544a4a94a2a checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1870
diff changeset
  1550
%{
3544a4a94a2a checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1870
diff changeset
  1551
    /*
3544a4a94a2a checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1870
diff changeset
  1552
     * for reasons too far from being explained here,
3544a4a94a2a checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1870
diff changeset
  1553
     * this MUST be a compiled method
3544a4a94a2a checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1870
diff changeset
  1554
     */
3544a4a94a2a checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1870
diff changeset
  1555
%}.
7601
57c257f1150a Fix race when accessing source
Stefan Vogel <sv@exept.de>
parents: 7457
diff changeset
  1556
    ^ InvalidCodeError
13662
7d7ae1e5f589 changed: #annotationAtIndex:
Claus Gittinger <cg@exept.de>
parents: 13660
diff changeset
  1557
        raiseErrorString:'invalid method - not executable'.
1870
2623b60c27e1 lifted numVars; added access for invalidCodeObject-trappers
Claus Gittinger <cg@exept.de>
parents: 1855
diff changeset
  1558
2623b60c27e1 lifted numVars; added access for invalidCodeObject-trappers
Claus Gittinger <cg@exept.de>
parents: 1855
diff changeset
  1559
    "Created: 4.11.1996 / 21:16:51 / cg"
1873
3544a4a94a2a checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1870
diff changeset
  1560
    "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
  1561
!
2623b60c27e1 lifted numVars; added access for invalidCodeObject-trappers
Claus Gittinger <cg@exept.de>
parents: 1855
diff changeset
  1562
2623b60c27e1 lifted numVars; added access for invalidCodeObject-trappers
Claus Gittinger <cg@exept.de>
parents: 1855
diff changeset
  1563
invalidCodeObjectWith:arg with:arg2 with:arg3 with:arg4
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
1870
2623b60c27e1 lifted numVars; added access for invalidCodeObject-trappers
Claus Gittinger <cg@exept.de>
parents: 1855
diff changeset
  1566
    "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
  1567
     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
  1568
     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
  1569
1873
3544a4a94a2a checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1870
diff changeset
  1570
%{
3544a4a94a2a checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1870
diff changeset
  1571
    /*
3544a4a94a2a checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1870
diff changeset
  1572
     * for reasons too far from being explained here,
3544a4a94a2a checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1870
diff changeset
  1573
     * this MUST be a compiled method
3544a4a94a2a checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1870
diff changeset
  1574
     */
3544a4a94a2a checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1870
diff changeset
  1575
%}.
7601
57c257f1150a Fix race when accessing source
Stefan Vogel <sv@exept.de>
parents: 7457
diff changeset
  1576
    ^ InvalidCodeError
13662
7d7ae1e5f589 changed: #annotationAtIndex:
Claus Gittinger <cg@exept.de>
parents: 13660
diff changeset
  1577
        raiseErrorString:'invalid method - not executable'.
1870
2623b60c27e1 lifted numVars; added access for invalidCodeObject-trappers
Claus Gittinger <cg@exept.de>
parents: 1855
diff changeset
  1578
2623b60c27e1 lifted numVars; added access for invalidCodeObject-trappers
Claus Gittinger <cg@exept.de>
parents: 1855
diff changeset
  1579
    "Created: 4.11.1996 / 21:17:00 / cg"
1873
3544a4a94a2a checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1870
diff changeset
  1580
    "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
  1581
!
2623b60c27e1 lifted numVars; added access for invalidCodeObject-trappers
Claus Gittinger <cg@exept.de>
parents: 1855
diff changeset
  1582
2623b60c27e1 lifted numVars; added access for invalidCodeObject-trappers
Claus Gittinger <cg@exept.de>
parents: 1855
diff changeset
  1583
invalidCodeObjectWith:arg with:arg2 with:arg3 with:arg4 with:arg5
1873
3544a4a94a2a checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1870
diff changeset
  1584
    "{ Pragma: +optSpace }"
3544a4a94a2a checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1870
diff changeset
  1585
1870
2623b60c27e1 lifted numVars; added access for invalidCodeObject-trappers
Claus Gittinger <cg@exept.de>
parents: 1855
diff changeset
  1586
    "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
  1587
     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
  1588
     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
  1589
1873
3544a4a94a2a checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1870
diff changeset
  1590
%{
3544a4a94a2a checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1870
diff changeset
  1591
    /*
3544a4a94a2a checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1870
diff changeset
  1592
     * for reasons too far from being explained here,
3544a4a94a2a checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1870
diff changeset
  1593
     * this MUST be a compiled method
3544a4a94a2a checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1870
diff changeset
  1594
     */
3544a4a94a2a checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1870
diff changeset
  1595
%}.
7601
57c257f1150a Fix race when accessing source
Stefan Vogel <sv@exept.de>
parents: 7457
diff changeset
  1596
    ^ InvalidCodeError
13662
7d7ae1e5f589 changed: #annotationAtIndex:
Claus Gittinger <cg@exept.de>
parents: 13660
diff changeset
  1597
        raiseErrorString:'invalid method - not executable'.
1870
2623b60c27e1 lifted numVars; added access for invalidCodeObject-trappers
Claus Gittinger <cg@exept.de>
parents: 1855
diff changeset
  1598
2623b60c27e1 lifted numVars; added access for invalidCodeObject-trappers
Claus Gittinger <cg@exept.de>
parents: 1855
diff changeset
  1599
    "Created: 4.11.1996 / 21:17:09 / cg"
1873
3544a4a94a2a checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1870
diff changeset
  1600
    "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
  1601
!
2623b60c27e1 lifted numVars; added access for invalidCodeObject-trappers
Claus Gittinger <cg@exept.de>
parents: 1855
diff changeset
  1602
2623b60c27e1 lifted numVars; added access for invalidCodeObject-trappers
Claus Gittinger <cg@exept.de>
parents: 1855
diff changeset
  1603
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
  1604
    "{ Pragma: +optSpace }"
3544a4a94a2a checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1870
diff changeset
  1605
1870
2623b60c27e1 lifted numVars; added access for invalidCodeObject-trappers
Claus Gittinger <cg@exept.de>
parents: 1855
diff changeset
  1606
    "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
  1607
     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
  1608
     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
  1609
1873
3544a4a94a2a checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1870
diff changeset
  1610
%{
3544a4a94a2a checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1870
diff changeset
  1611
    /*
3544a4a94a2a checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1870
diff changeset
  1612
     * for reasons too far from being explained here,
3544a4a94a2a checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1870
diff changeset
  1613
     * this MUST be a compiled method
3544a4a94a2a checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1870
diff changeset
  1614
     */
3544a4a94a2a checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1870
diff changeset
  1615
%}.
7601
57c257f1150a Fix race when accessing source
Stefan Vogel <sv@exept.de>
parents: 7457
diff changeset
  1616
    ^ InvalidCodeError
13662
7d7ae1e5f589 changed: #annotationAtIndex:
Claus Gittinger <cg@exept.de>
parents: 13660
diff changeset
  1617
        raiseErrorString:'invalid method - not executable'.
1870
2623b60c27e1 lifted numVars; added access for invalidCodeObject-trappers
Claus Gittinger <cg@exept.de>
parents: 1855
diff changeset
  1618
2623b60c27e1 lifted numVars; added access for invalidCodeObject-trappers
Claus Gittinger <cg@exept.de>
parents: 1855
diff changeset
  1619
    "Created: 4.11.1996 / 21:17:17 / cg"
1873
3544a4a94a2a checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1870
diff changeset
  1620
    "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
  1621
!
2623b60c27e1 lifted numVars; added access for invalidCodeObject-trappers
Claus Gittinger <cg@exept.de>
parents: 1855
diff changeset
  1622
2623b60c27e1 lifted numVars; added access for invalidCodeObject-trappers
Claus Gittinger <cg@exept.de>
parents: 1855
diff changeset
  1623
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
  1624
    "{ Pragma: +optSpace }"
3544a4a94a2a checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1870
diff changeset
  1625
1870
2623b60c27e1 lifted numVars; added access for invalidCodeObject-trappers
Claus Gittinger <cg@exept.de>
parents: 1855
diff changeset
  1626
    "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
  1627
     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
  1628
     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
  1629
1873
3544a4a94a2a checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1870
diff changeset
  1630
%{
3544a4a94a2a checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1870
diff changeset
  1631
    /*
3544a4a94a2a checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1870
diff changeset
  1632
     * for reasons too far from being explained here,
3544a4a94a2a checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1870
diff changeset
  1633
     * this MUST be a compiled method
3544a4a94a2a checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1870
diff changeset
  1634
     */
3544a4a94a2a checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1870
diff changeset
  1635
%}.
7601
57c257f1150a Fix race when accessing source
Stefan Vogel <sv@exept.de>
parents: 7457
diff changeset
  1636
    ^ InvalidCodeError
13662
7d7ae1e5f589 changed: #annotationAtIndex:
Claus Gittinger <cg@exept.de>
parents: 13660
diff changeset
  1637
        raiseErrorString:'invalid method - not executable'.
1870
2623b60c27e1 lifted numVars; added access for invalidCodeObject-trappers
Claus Gittinger <cg@exept.de>
parents: 1855
diff changeset
  1638
2623b60c27e1 lifted numVars; added access for invalidCodeObject-trappers
Claus Gittinger <cg@exept.de>
parents: 1855
diff changeset
  1639
    "Created: 4.11.1996 / 21:17:25 / cg"
1873
3544a4a94a2a checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1870
diff changeset
  1640
    "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
  1641
!
2623b60c27e1 lifted numVars; added access for invalidCodeObject-trappers
Claus Gittinger <cg@exept.de>
parents: 1855
diff changeset
  1642
2623b60c27e1 lifted numVars; added access for invalidCodeObject-trappers
Claus Gittinger <cg@exept.de>
parents: 1855
diff changeset
  1643
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
  1644
    "{ Pragma: +optSpace }"
3544a4a94a2a checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1870
diff changeset
  1645
1870
2623b60c27e1 lifted numVars; added access for invalidCodeObject-trappers
Claus Gittinger <cg@exept.de>
parents: 1855
diff changeset
  1646
    "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
  1647
     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
  1648
     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
  1649
1873
3544a4a94a2a checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1870
diff changeset
  1650
%{
3544a4a94a2a checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1870
diff changeset
  1651
    /*
3544a4a94a2a checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1870
diff changeset
  1652
     * for reasons too far from being explained here,
3544a4a94a2a checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1870
diff changeset
  1653
     * this MUST be a compiled method
3544a4a94a2a checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1870
diff changeset
  1654
     */
3544a4a94a2a checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1870
diff changeset
  1655
%}.
7601
57c257f1150a Fix race when accessing source
Stefan Vogel <sv@exept.de>
parents: 7457
diff changeset
  1656
    ^ InvalidCodeError
13662
7d7ae1e5f589 changed: #annotationAtIndex:
Claus Gittinger <cg@exept.de>
parents: 13660
diff changeset
  1657
        raiseErrorString:'invalid method - not executable'.
1870
2623b60c27e1 lifted numVars; added access for invalidCodeObject-trappers
Claus Gittinger <cg@exept.de>
parents: 1855
diff changeset
  1658
2623b60c27e1 lifted numVars; added access for invalidCodeObject-trappers
Claus Gittinger <cg@exept.de>
parents: 1855
diff changeset
  1659
    "Created: 4.11.1996 / 21:17:32 / cg"
1873
3544a4a94a2a checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1870
diff changeset
  1660
    "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
  1661
!
2623b60c27e1 lifted numVars; added access for invalidCodeObject-trappers
Claus Gittinger <cg@exept.de>
parents: 1855
diff changeset
  1662
2623b60c27e1 lifted numVars; added access for invalidCodeObject-trappers
Claus Gittinger <cg@exept.de>
parents: 1855
diff changeset
  1663
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
  1664
    "{ Pragma: +optSpace }"
3544a4a94a2a checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1870
diff changeset
  1665
1870
2623b60c27e1 lifted numVars; added access for invalidCodeObject-trappers
Claus Gittinger <cg@exept.de>
parents: 1855
diff changeset
  1666
    "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
  1667
     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
  1668
     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
  1669
1873
3544a4a94a2a checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1870
diff changeset
  1670
%{
3544a4a94a2a checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1870
diff changeset
  1671
    /*
3544a4a94a2a checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1870
diff changeset
  1672
     * for reasons too far from being explained here,
3544a4a94a2a checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1870
diff changeset
  1673
     * this MUST be a compiled method
3544a4a94a2a checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1870
diff changeset
  1674
     */
3544a4a94a2a checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1870
diff changeset
  1675
%}.
7601
57c257f1150a Fix race when accessing source
Stefan Vogel <sv@exept.de>
parents: 7457
diff changeset
  1676
    ^ InvalidCodeError
13662
7d7ae1e5f589 changed: #annotationAtIndex:
Claus Gittinger <cg@exept.de>
parents: 13660
diff changeset
  1677
        raiseErrorString:'invalid method - not executable'.
1870
2623b60c27e1 lifted numVars; added access for invalidCodeObject-trappers
Claus Gittinger <cg@exept.de>
parents: 1855
diff changeset
  1678
2623b60c27e1 lifted numVars; added access for invalidCodeObject-trappers
Claus Gittinger <cg@exept.de>
parents: 1855
diff changeset
  1679
    "Created: 4.11.1996 / 21:17:37 / cg"
1873
3544a4a94a2a checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1870
diff changeset
  1680
    "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
  1681
!
2623b60c27e1 lifted numVars; added access for invalidCodeObject-trappers
Claus Gittinger <cg@exept.de>
parents: 1855
diff changeset
  1682
2623b60c27e1 lifted numVars; added access for invalidCodeObject-trappers
Claus Gittinger <cg@exept.de>
parents: 1855
diff changeset
  1683
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
  1684
    "{ Pragma: +optSpace }"
3544a4a94a2a checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1870
diff changeset
  1685
1870
2623b60c27e1 lifted numVars; added access for invalidCodeObject-trappers
Claus Gittinger <cg@exept.de>
parents: 1855
diff changeset
  1686
    "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
  1687
     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
  1688
     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
  1689
1873
3544a4a94a2a checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1870
diff changeset
  1690
%{
3544a4a94a2a checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1870
diff changeset
  1691
    /*
3544a4a94a2a checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1870
diff changeset
  1692
     * for reasons too far from being explained here,
3544a4a94a2a checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1870
diff changeset
  1693
     * this MUST be a compiled method
3544a4a94a2a checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1870
diff changeset
  1694
     */
3544a4a94a2a checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1870
diff changeset
  1695
%}.
7601
57c257f1150a Fix race when accessing source
Stefan Vogel <sv@exept.de>
parents: 7457
diff changeset
  1696
    ^ InvalidCodeError
13662
7d7ae1e5f589 changed: #annotationAtIndex:
Claus Gittinger <cg@exept.de>
parents: 13660
diff changeset
  1697
        raiseErrorString:'invalid method - not executable'.
1870
2623b60c27e1 lifted numVars; added access for invalidCodeObject-trappers
Claus Gittinger <cg@exept.de>
parents: 1855
diff changeset
  1698
2623b60c27e1 lifted numVars; added access for invalidCodeObject-trappers
Claus Gittinger <cg@exept.de>
parents: 1855
diff changeset
  1699
    "Created: 4.11.1996 / 21:17:45 / cg"
1873
3544a4a94a2a checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1870
diff changeset
  1700
    "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
  1701
!
2623b60c27e1 lifted numVars; added access for invalidCodeObject-trappers
Claus Gittinger <cg@exept.de>
parents: 1855
diff changeset
  1702
2623b60c27e1 lifted numVars; added access for invalidCodeObject-trappers
Claus Gittinger <cg@exept.de>
parents: 1855
diff changeset
  1703
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
  1704
    "{ Pragma: +optSpace }"
3544a4a94a2a checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1870
diff changeset
  1705
1870
2623b60c27e1 lifted numVars; added access for invalidCodeObject-trappers
Claus Gittinger <cg@exept.de>
parents: 1855
diff changeset
  1706
    "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
  1707
     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
  1708
     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
  1709
1873
3544a4a94a2a checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1870
diff changeset
  1710
%{
3544a4a94a2a checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1870
diff changeset
  1711
    /*
3544a4a94a2a checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1870
diff changeset
  1712
     * for reasons too far from being explained here,
3544a4a94a2a checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1870
diff changeset
  1713
     * this MUST be a compiled method
3544a4a94a2a checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1870
diff changeset
  1714
     */
3544a4a94a2a checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1870
diff changeset
  1715
%}.
7601
57c257f1150a Fix race when accessing source
Stefan Vogel <sv@exept.de>
parents: 7457
diff changeset
  1716
    ^ InvalidCodeError
13662
7d7ae1e5f589 changed: #annotationAtIndex:
Claus Gittinger <cg@exept.de>
parents: 13660
diff changeset
  1717
        raiseErrorString:'invalid method - not executable'.
1870
2623b60c27e1 lifted numVars; added access for invalidCodeObject-trappers
Claus Gittinger <cg@exept.de>
parents: 1855
diff changeset
  1718
2623b60c27e1 lifted numVars; added access for invalidCodeObject-trappers
Claus Gittinger <cg@exept.de>
parents: 1855
diff changeset
  1719
    "Created: 4.11.1996 / 21:17:52 / cg"
1873
3544a4a94a2a checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1870
diff changeset
  1720
    "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
  1721
!
2623b60c27e1 lifted numVars; added access for invalidCodeObject-trappers
Claus Gittinger <cg@exept.de>
parents: 1855
diff changeset
  1722
2623b60c27e1 lifted numVars; added access for invalidCodeObject-trappers
Claus Gittinger <cg@exept.de>
parents: 1855
diff changeset
  1723
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
  1724
    "{ Pragma: +optSpace }"
3544a4a94a2a checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1870
diff changeset
  1725
1870
2623b60c27e1 lifted numVars; added access for invalidCodeObject-trappers
Claus Gittinger <cg@exept.de>
parents: 1855
diff changeset
  1726
    "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
  1727
     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
  1728
     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
  1729
1873
3544a4a94a2a checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1870
diff changeset
  1730
%{
3544a4a94a2a checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1870
diff changeset
  1731
    /*
3544a4a94a2a checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1870
diff changeset
  1732
     * for reasons too far from being explained here,
3544a4a94a2a checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1870
diff changeset
  1733
     * this MUST be a compiled method
3544a4a94a2a checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1870
diff changeset
  1734
     */
3544a4a94a2a checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1870
diff changeset
  1735
%}.
7601
57c257f1150a Fix race when accessing source
Stefan Vogel <sv@exept.de>
parents: 7457
diff changeset
  1736
    ^ InvalidCodeError
13662
7d7ae1e5f589 changed: #annotationAtIndex:
Claus Gittinger <cg@exept.de>
parents: 13660
diff changeset
  1737
        raiseErrorString:'invalid method - not executable'.
1870
2623b60c27e1 lifted numVars; added access for invalidCodeObject-trappers
Claus Gittinger <cg@exept.de>
parents: 1855
diff changeset
  1738
2623b60c27e1 lifted numVars; added access for invalidCodeObject-trappers
Claus Gittinger <cg@exept.de>
parents: 1855
diff changeset
  1739
    "Created: 4.11.1996 / 20:51:28 / cg"
1873
3544a4a94a2a checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1870
diff changeset
  1740
    "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
  1741
!
2623b60c27e1 lifted numVars; added access for invalidCodeObject-trappers
Claus Gittinger <cg@exept.de>
parents: 1855
diff changeset
  1742
2623b60c27e1 lifted numVars; added access for invalidCodeObject-trappers
Claus Gittinger <cg@exept.de>
parents: 1855
diff changeset
  1743
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
  1744
    "{ Pragma: +optSpace }"
3544a4a94a2a checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1870
diff changeset
  1745
1870
2623b60c27e1 lifted numVars; added access for invalidCodeObject-trappers
Claus Gittinger <cg@exept.de>
parents: 1855
diff changeset
  1746
    "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
  1747
     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
  1748
     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
  1749
1873
3544a4a94a2a checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1870
diff changeset
  1750
%{
3544a4a94a2a checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1870
diff changeset
  1751
    /*
3544a4a94a2a checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1870
diff changeset
  1752
     * for reasons too far from being explained here,
3544a4a94a2a checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1870
diff changeset
  1753
     * this MUST be a compiled method
3544a4a94a2a checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1870
diff changeset
  1754
     */
3544a4a94a2a checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1870
diff changeset
  1755
%}.
7601
57c257f1150a Fix race when accessing source
Stefan Vogel <sv@exept.de>
parents: 7457
diff changeset
  1756
    ^ InvalidCodeError
13662
7d7ae1e5f589 changed: #annotationAtIndex:
Claus Gittinger <cg@exept.de>
parents: 13660
diff changeset
  1757
        raiseErrorString:'invalid method - not executable'.
1870
2623b60c27e1 lifted numVars; added access for invalidCodeObject-trappers
Claus Gittinger <cg@exept.de>
parents: 1855
diff changeset
  1758
2623b60c27e1 lifted numVars; added access for invalidCodeObject-trappers
Claus Gittinger <cg@exept.de>
parents: 1855
diff changeset
  1759
    "Created: 4.11.1996 / 21:18:09 / cg"
1873
3544a4a94a2a checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1870
diff changeset
  1760
    "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
  1761
!
2623b60c27e1 lifted numVars; added access for invalidCodeObject-trappers
Claus Gittinger <cg@exept.de>
parents: 1855
diff changeset
  1762
2623b60c27e1 lifted numVars; added access for invalidCodeObject-trappers
Claus Gittinger <cg@exept.de>
parents: 1855
diff changeset
  1763
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
  1764
    "{ Pragma: +optSpace }"
3544a4a94a2a checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1870
diff changeset
  1765
1870
2623b60c27e1 lifted numVars; added access for invalidCodeObject-trappers
Claus Gittinger <cg@exept.de>
parents: 1855
diff changeset
  1766
    "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
  1767
     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
  1768
     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
  1769
1873
3544a4a94a2a checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1870
diff changeset
  1770
%{
3544a4a94a2a checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1870
diff changeset
  1771
    /*
3544a4a94a2a checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1870
diff changeset
  1772
     * for reasons too far from being explained here,
3544a4a94a2a checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1870
diff changeset
  1773
     * this MUST be a compiled method
3544a4a94a2a checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1870
diff changeset
  1774
     */
3544a4a94a2a checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1870
diff changeset
  1775
%}.
7601
57c257f1150a Fix race when accessing source
Stefan Vogel <sv@exept.de>
parents: 7457
diff changeset
  1776
    ^ InvalidCodeError
13662
7d7ae1e5f589 changed: #annotationAtIndex:
Claus Gittinger <cg@exept.de>
parents: 13660
diff changeset
  1777
        raiseErrorString:'invalid method - not executable'.
1870
2623b60c27e1 lifted numVars; added access for invalidCodeObject-trappers
Claus Gittinger <cg@exept.de>
parents: 1855
diff changeset
  1778
2623b60c27e1 lifted numVars; added access for invalidCodeObject-trappers
Claus Gittinger <cg@exept.de>
parents: 1855
diff changeset
  1779
    "Created: 4.11.1996 / 21:18:17 / cg"
1873
3544a4a94a2a checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1870
diff changeset
  1780
    "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
  1781
!
2623b60c27e1 lifted numVars; added access for invalidCodeObject-trappers
Claus Gittinger <cg@exept.de>
parents: 1855
diff changeset
  1782
2623b60c27e1 lifted numVars; added access for invalidCodeObject-trappers
Claus Gittinger <cg@exept.de>
parents: 1855
diff changeset
  1783
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
  1784
    "{ Pragma: +optSpace }"
3544a4a94a2a checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1870
diff changeset
  1785
1870
2623b60c27e1 lifted numVars; added access for invalidCodeObject-trappers
Claus Gittinger <cg@exept.de>
parents: 1855
diff changeset
  1786
    "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
  1787
     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
  1788
     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
  1789
1873
3544a4a94a2a checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1870
diff changeset
  1790
%{
3544a4a94a2a checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1870
diff changeset
  1791
    /*
3544a4a94a2a checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1870
diff changeset
  1792
     * for reasons too far from being explained here,
3544a4a94a2a checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1870
diff changeset
  1793
     * this MUST be a compiled method
3544a4a94a2a checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1870
diff changeset
  1794
     */
3544a4a94a2a checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1870
diff changeset
  1795
%}.
7601
57c257f1150a Fix race when accessing source
Stefan Vogel <sv@exept.de>
parents: 7457
diff changeset
  1796
    ^ InvalidCodeError
13662
7d7ae1e5f589 changed: #annotationAtIndex:
Claus Gittinger <cg@exept.de>
parents: 13660
diff changeset
  1797
        raiseErrorString:'invalid method - not executable'.
1870
2623b60c27e1 lifted numVars; added access for invalidCodeObject-trappers
Claus Gittinger <cg@exept.de>
parents: 1855
diff changeset
  1798
2623b60c27e1 lifted numVars; added access for invalidCodeObject-trappers
Claus Gittinger <cg@exept.de>
parents: 1855
diff changeset
  1799
    "Created: 4.11.1996 / 21:18:22 / cg"
1873
3544a4a94a2a checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1870
diff changeset
  1800
    "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
  1801
!
2623b60c27e1 lifted numVars; added access for invalidCodeObject-trappers
Claus Gittinger <cg@exept.de>
parents: 1855
diff changeset
  1802
109
1fae65190b17 errors raise signals; check arg-count in valueWith...
claus
parents: 93
diff changeset
  1803
privateMethodCalled
1873
3544a4a94a2a checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1870
diff changeset
  1804
    "{ Pragma: +optSpace }"
3544a4a94a2a checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1870
diff changeset
  1805
980
0ab2f56ecfc7 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 957
diff changeset
  1806
    "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
  1807
360
claus
parents: 350
diff changeset
  1808
     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
  1809
     and further privacy exceptions will NOT be reported at this call location,
360
claus
parents: 350
diff changeset
  1810
     until any new method is compiled, or the privacy of any method changes,
claus
parents: 350
diff changeset
  1811
     or the caches are flushed.
claus
parents: 350
diff changeset
  1812
     (the reason is that after the continue, the method is enterred into the
claus
parents: 350
diff changeset
  1813
      calling cache, for which method privacy is not checked.
claus
parents: 350
diff changeset
  1814
      Any of the above actions flushes this cache and a privacy check
claus
parents: 350
diff changeset
  1815
      is performed again.)
claus
parents: 350
diff changeset
  1816
     Future versions may not enter private methods into the cache, to fix this
claus
parents: 350
diff changeset
  1817
     (unobvious) behavior. However, then you will get an exception for EVERY
claus
parents: 350
diff changeset
  1818
     call to a private method ...
claus
parents: 350
diff changeset
  1819
claus
parents: 350
diff changeset
  1820
     Notice: method privacy is a nonstandard feature, not supported
claus
parents: 350
diff changeset
  1821
     by other smalltalk implementations and not specified in the ANSI spec.
claus
parents: 350
diff changeset
  1822
     This is EXPERIMENTAL - and being evaluated for usability.
claus
parents: 350
diff changeset
  1823
     It may change or even vanish (if it shows to be not useful)."
68
59faa75185ba *** empty log message ***
claus
parents: 56
diff changeset
  1824
8518
7dc3f9909640 Interchanged the meaning of method privacy -
Stefan Vogel <sv@exept.de>
parents: 8465
diff changeset
  1825
    ^ PrivateMethodSignal raiseRequest
1873
3544a4a94a2a checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1870
diff changeset
  1826
3544a4a94a2a checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1870
diff changeset
  1827
    "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
  1828
!
d600e08a5936 handle the case where a method has a sourceFileInfo, but the class has not
Claus Gittinger <cg@exept.de>
parents: 934
diff changeset
  1829
d600e08a5936 handle the case where a method has a sourceFileInfo, but the class has not
Claus Gittinger <cg@exept.de>
parents: 934
diff changeset
  1830
uncompiledCodeObject
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
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
  1833
    "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
  1834
     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
  1835
     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
  1836
     For those methods, the compiler generated a method object consisting
1873
3544a4a94a2a checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1870
diff changeset
  1837
     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
  1838
3544a4a94a2a checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1870
diff changeset
  1839
%{
3544a4a94a2a checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1870
diff changeset
  1840
    /*
3544a4a94a2a checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1870
diff changeset
  1841
     * for reasons too far from being explained here,
3544a4a94a2a checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1870
diff changeset
  1842
     * this MUST be a compiled method
3544a4a94a2a checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1870
diff changeset
  1843
     */
3544a4a94a2a checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1870
diff changeset
  1844
%}.
7601
57c257f1150a Fix race when accessing source
Stefan Vogel <sv@exept.de>
parents: 7457
diff changeset
  1845
    ^ InvalidCodeError
13662
7d7ae1e5f589 changed: #annotationAtIndex:
Claus Gittinger <cg@exept.de>
parents: 13660
diff changeset
  1846
        raiseRequestWith:self
7d7ae1e5f589 changed: #annotationAtIndex:
Claus Gittinger <cg@exept.de>
parents: 13660
diff changeset
  1847
        errorString:'invalid method - not compiled'.
1873
3544a4a94a2a checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1870
diff changeset
  1848
3544a4a94a2a checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1870
diff changeset
  1849
    "Modified: 4.11.1996 / 22:58:02 / cg"
3544a4a94a2a checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1870
diff changeset
  1850
!
3544a4a94a2a checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1870
diff changeset
  1851
3544a4a94a2a checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1870
diff changeset
  1852
unloadedCodeObject
3544a4a94a2a checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1870
diff changeset
  1853
    "{ Pragma: +optSpace }"
3544a4a94a2a checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1870
diff changeset
  1854
3544a4a94a2a checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1870
diff changeset
  1855
    "this method is invoked by methods which have been binary-unloaded
3544a4a94a2a checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1870
diff changeset
  1856
     For those the source info consists
3544a4a94a2a checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1870
diff changeset
  1857
     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
  1858
3544a4a94a2a checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1870
diff changeset
  1859
%{
3544a4a94a2a checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1870
diff changeset
  1860
    /*
3544a4a94a2a checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1870
diff changeset
  1861
     * for reasons too far from being explained here,
3544a4a94a2a checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1870
diff changeset
  1862
     * this MUST be a compiled method
3544a4a94a2a checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1870
diff changeset
  1863
     */
3544a4a94a2a checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1870
diff changeset
  1864
%}.
7601
57c257f1150a Fix race when accessing source
Stefan Vogel <sv@exept.de>
parents: 7457
diff changeset
  1865
    ^ InvalidCodeError
13662
7d7ae1e5f589 changed: #annotationAtIndex:
Claus Gittinger <cg@exept.de>
parents: 13660
diff changeset
  1866
        raiseRequestWith:self
7d7ae1e5f589 changed: #annotationAtIndex:
Claus Gittinger <cg@exept.de>
parents: 13660
diff changeset
  1867
        errorString:'invalid method - unloaded'.
1873
3544a4a94a2a checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1870
diff changeset
  1868
3544a4a94a2a checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1870
diff changeset
  1869
    "Created: 4.11.1996 / 22:57:54 / cg"
3544a4a94a2a checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1870
diff changeset
  1870
    "Modified: 4.11.1996 / 22:58:28 / cg"
1
a27a279701f8 Initial revision
claus
parents:
diff changeset
  1871
! !
a27a279701f8 Initial revision
claus
parents:
diff changeset
  1872
9987
2ca75ae430c4 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9827
diff changeset
  1873
93
e31220cb391f *** empty log message ***
claus
parents: 88
diff changeset
  1874
!Method methodsFor:'printing & storing'!
1
a27a279701f8 Initial revision
claus
parents:
diff changeset
  1875
a27a279701f8 Initial revision
claus
parents:
diff changeset
  1876
printOn:aStream
56
be0ed17e6f85 *** empty log message ***
claus
parents: 49
diff changeset
  1877
    "put a printed representation of the receiver onto aStream.
be0ed17e6f85 *** empty log message ***
claus
parents: 49
diff changeset
  1878
     Since methods do not store their class/selector, we have to search
be0ed17e6f85 *** empty log message ***
claus
parents: 49
diff changeset
  1879
     for it here."
1
a27a279701f8 Initial revision
claus
parents:
diff changeset
  1880
227
23b1c4de3402 package & cleanup
claus
parents: 216
diff changeset
  1881
    |classAndSelector m wrapped|
1
a27a279701f8 Initial revision
claus
parents:
diff changeset
  1882
253
30daee717a53 *** empty log message ***
claus
parents: 227
diff changeset
  1883
    wrapped := false.
30daee717a53 *** empty log message ***
claus
parents: 227
diff changeset
  1884
6234
d8083875f657 fixed pixmap readout for win32, where red and green are exchanged
Claus Gittinger <cg@exept.de>
parents: 6160
diff changeset
  1885
    self basicPrintOn:aStream."/ aStream nextPutAll:(self classNameWithArticle).
159
514c749165c3 *** empty log message ***
claus
parents: 142
diff changeset
  1886
    aStream nextPut:$(.
227
23b1c4de3402 package & cleanup
claus
parents: 216
diff changeset
  1887
176
48061f8659aa more queries
claus
parents: 159
diff changeset
  1888
    classAndSelector := self who.
227
23b1c4de3402 package & cleanup
claus
parents: 216
diff changeset
  1889
    classAndSelector isNil ifTrue:[
13662
7d7ae1e5f589 changed: #annotationAtIndex:
Claus Gittinger <cg@exept.de>
parents: 13660
diff changeset
  1890
        "
7d7ae1e5f589 changed: #annotationAtIndex:
Claus Gittinger <cg@exept.de>
parents: 13660
diff changeset
  1891
         not anchored in any class.
7d7ae1e5f589 changed: #annotationAtIndex:
Claus Gittinger <cg@exept.de>
parents: 13660
diff changeset
  1892
         check if wrapped (to be more informative in inspectors)
7d7ae1e5f589 changed: #annotationAtIndex:
Claus Gittinger <cg@exept.de>
parents: 13660
diff changeset
  1893
        "
7d7ae1e5f589 changed: #annotationAtIndex:
Claus Gittinger <cg@exept.de>
parents: 13660
diff changeset
  1894
        m := self wrapper.
7d7ae1e5f589 changed: #annotationAtIndex:
Claus Gittinger <cg@exept.de>
parents: 13660
diff changeset
  1895
        m notNil ifTrue:[
7d7ae1e5f589 changed: #annotationAtIndex:
Claus Gittinger <cg@exept.de>
parents: 13660
diff changeset
  1896
            classAndSelector := m who.
7d7ae1e5f589 changed: #annotationAtIndex:
Claus Gittinger <cg@exept.de>
parents: 13660
diff changeset
  1897
            wrapped := true.
7d7ae1e5f589 changed: #annotationAtIndex:
Claus Gittinger <cg@exept.de>
parents: 13660
diff changeset
  1898
        ]
227
23b1c4de3402 package & cleanup
claus
parents: 216
diff changeset
  1899
    ].
176
48061f8659aa more queries
claus
parents: 159
diff changeset
  1900
    classAndSelector notNil ifTrue:[
13662
7d7ae1e5f589 changed: #annotationAtIndex:
Claus Gittinger <cg@exept.de>
parents: 13660
diff changeset
  1901
        (classAndSelector methodClass) name printOn:aStream.
7d7ae1e5f589 changed: #annotationAtIndex:
Claus Gittinger <cg@exept.de>
parents: 13660
diff changeset
  1902
        aStream nextPutAll:' '.
7d7ae1e5f589 changed: #annotationAtIndex:
Claus Gittinger <cg@exept.de>
parents: 13660
diff changeset
  1903
        (classAndSelector methodSelector) printOn:aStream.
1
a27a279701f8 Initial revision
claus
parents:
diff changeset
  1904
    ] ifFalse:[
13662
7d7ae1e5f589 changed: #annotationAtIndex:
Claus Gittinger <cg@exept.de>
parents: 13660
diff changeset
  1905
        "
7d7ae1e5f589 changed: #annotationAtIndex:
Claus Gittinger <cg@exept.de>
parents: 13660
diff changeset
  1906
         sorry, a method which is nowhere anchored
7d7ae1e5f589 changed: #annotationAtIndex:
Claus Gittinger <cg@exept.de>
parents: 13660
diff changeset
  1907
        "
7d7ae1e5f589 changed: #annotationAtIndex:
Claus Gittinger <cg@exept.de>
parents: 13660
diff changeset
  1908
        aStream nextPutAll:'unbound'
56
be0ed17e6f85 *** empty log message ***
claus
parents: 49
diff changeset
  1909
    ].
13101
7dc4234a844d changed: #printOn:
Claus Gittinger <cg@exept.de>
parents: 13100
diff changeset
  1910
    aStream nextPut:$).
7dc4234a844d changed: #printOn:
Claus Gittinger <cg@exept.de>
parents: 13100
diff changeset
  1911
7dc4234a844d changed: #printOn:
Claus Gittinger <cg@exept.de>
parents: 13100
diff changeset
  1912
    wrapped ifTrue:[
13662
7d7ae1e5f589 changed: #annotationAtIndex:
Claus Gittinger <cg@exept.de>
parents: 13660
diff changeset
  1913
        aStream nextPutAll:'; wrapped'
13101
7dc4234a844d changed: #printOn:
Claus Gittinger <cg@exept.de>
parents: 13100
diff changeset
  1914
    ].
176
48061f8659aa more queries
claus
parents: 159
diff changeset
  1915
48061f8659aa more queries
claus
parents: 159
diff changeset
  1916
    "
253
30daee717a53 *** empty log message ***
claus
parents: 227
diff changeset
  1917
     (Object compiledMethodAt:#at:) printOn:Transcript. Transcript cr.
30daee717a53 *** empty log message ***
claus
parents: 227
diff changeset
  1918
     (Object compiledMethodAt:#at:) copy printOn:Transcript. Transcript cr.
10083
8cec9ab7373e *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10044
diff changeset
  1919
8cec9ab7373e *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10044
diff changeset
  1920
     (Object compiledMethodAt:#at:) whoString printOn:Transcript. Transcript cr.
8cec9ab7373e *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10044
diff changeset
  1921
     (Object compiledMethodAt:#at:) copy whoString printOn:Transcript. Transcript cr.
176
48061f8659aa more queries
claus
parents: 159
diff changeset
  1922
    "
1851
4accc9fafd19 change #who to return a proper object
Claus Gittinger <cg@exept.de>
parents: 1813
diff changeset
  1923
13101
7dc4234a844d changed: #printOn:
Claus Gittinger <cg@exept.de>
parents: 13100
diff changeset
  1924
    "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
  1925
!
d600e08a5936 handle the case where a method has a sourceFileInfo, but the class has not
Claus Gittinger <cg@exept.de>
parents: 934
diff changeset
  1926
d600e08a5936 handle the case where a method has a sourceFileInfo, but the class has not
Claus Gittinger <cg@exept.de>
parents: 934
diff changeset
  1927
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
  1928
    "return a string as className>>selector, if this is not an unbound
d600e08a5936 handle the case where a method has a sourceFileInfo, but the class has not
Claus Gittinger <cg@exept.de>
parents: 934
diff changeset
  1929
     method. Otherwise return 'unbound'. Used with debugging."
d600e08a5936 handle the case where a method has a sourceFileInfo, but the class has not
Claus Gittinger <cg@exept.de>
parents: 934
diff changeset
  1930
1851
4accc9fafd19 change #who to return a proper object
Claus Gittinger <cg@exept.de>
parents: 1813
diff changeset
  1931
    |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
  1932
1851
4accc9fafd19 change #who to return a proper object
Claus Gittinger <cg@exept.de>
parents: 1813
diff changeset
  1933
    who := self who.
4accc9fafd19 change #who to return a proper object
Claus Gittinger <cg@exept.de>
parents: 1813
diff changeset
  1934
    who notNil ifTrue:[
13662
7d7ae1e5f589 changed: #annotationAtIndex:
Claus Gittinger <cg@exept.de>
parents: 13660
diff changeset
  1935
        ^ 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
  1936
    ].
6071
c10946059080 whoString can be evaluated
Claus Gittinger <cg@exept.de>
parents: 6058
diff changeset
  1937
    ^ '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
  1938
d600e08a5936 handle the case where a method has a sourceFileInfo, but the class has not
Claus Gittinger <cg@exept.de>
parents: 934
diff changeset
  1939
    "
12854
3a3d3c02c3bd *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 12695
diff changeset
  1940
     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
  1941
     (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
  1942
    "
1851
4accc9fafd19 change #who to return a proper object
Claus Gittinger <cg@exept.de>
parents: 1813
diff changeset
  1943
4accc9fafd19 change #who to return a proper object
Claus Gittinger <cg@exept.de>
parents: 1813
diff changeset
  1944
    "Modified: 1.11.1996 / 16:27:04 / cg"
1
a27a279701f8 Initial revision
claus
parents:
diff changeset
  1945
! !
a27a279701f8 Initial revision
claus
parents:
diff changeset
  1946
8141
41b25e5f7532 sourceStream access refactored (preps for utf8 decoding)
Claus Gittinger <cg@exept.de>
parents: 8117
diff changeset
  1947
!Method methodsFor:'private'!
41b25e5f7532 sourceStream access refactored (preps for utf8 decoding)
Claus Gittinger <cg@exept.de>
parents: 8117
diff changeset
  1948
13422
b43a8a47037c Jan's changes
vrany
parents: 13390
diff changeset
  1949
annotationAtIndex: index
14253
Claus Gittinger <cg@exept.de>
parents: 14251
diff changeset
  1950
    "return the annotation at given index.
Claus Gittinger <cg@exept.de>
parents: 14251
diff changeset
  1951
     any raw annotation array is lazily initialized"
13422
b43a8a47037c Jan's changes
vrany
parents: 13390
diff changeset
  1952
13662
7d7ae1e5f589 changed: #annotationAtIndex:
Claus Gittinger <cg@exept.de>
parents: 13660
diff changeset
  1953
    | annotationOrArray annotation args |
13683
1b6be902030b comment/format in: #annotationAtIndex:
Claus Gittinger <cg@exept.de>
parents: 13679
diff changeset
  1954
13817
7d1e0e8ea364 changed:10 methods
Claus Gittinger <cg@exept.de>
parents: 13805
diff changeset
  1955
    annotations isNil ifTrue:[^nil].
13662
7d7ae1e5f589 changed: #annotationAtIndex:
Claus Gittinger <cg@exept.de>
parents: 13660
diff changeset
  1956
    annotationOrArray := annotation := annotations at: index.
7d7ae1e5f589 changed: #annotationAtIndex:
Claus Gittinger <cg@exept.de>
parents: 13660
diff changeset
  1957
    annotationOrArray isArray ifTrue:[
7d7ae1e5f589 changed: #annotationAtIndex:
Claus Gittinger <cg@exept.de>
parents: 13660
diff changeset
  1958
        args := annotationOrArray size == 2
7d7ae1e5f589 changed: #annotationAtIndex:
Claus Gittinger <cg@exept.de>
parents: 13660
diff changeset
  1959
                    ifTrue:[annotationOrArray second]
7d7ae1e5f589 changed: #annotationAtIndex:
Claus Gittinger <cg@exept.de>
parents: 13660
diff changeset
  1960
                    ifFalse:[#()].
7d7ae1e5f589 changed: #annotationAtIndex:
Claus Gittinger <cg@exept.de>
parents: 13660
diff changeset
  1961
        args isArray ifFalse:[args := Array with: args].
7d7ae1e5f589 changed: #annotationAtIndex:
Claus Gittinger <cg@exept.de>
parents: 13660
diff changeset
  1962
        annotation := Annotation
7d7ae1e5f589 changed: #annotationAtIndex:
Claus Gittinger <cg@exept.de>
parents: 13660
diff changeset
  1963
                        method:self
7d7ae1e5f589 changed: #annotationAtIndex:
Claus Gittinger <cg@exept.de>
parents: 13660
diff changeset
  1964
                        key: annotationOrArray first
7d7ae1e5f589 changed: #annotationAtIndex:
Claus Gittinger <cg@exept.de>
parents: 13660
diff changeset
  1965
                        arguments: args.
7d7ae1e5f589 changed: #annotationAtIndex:
Claus Gittinger <cg@exept.de>
parents: 13660
diff changeset
  1966
        annotation isUnknown ifFalse:[
7d7ae1e5f589 changed: #annotationAtIndex:
Claus Gittinger <cg@exept.de>
parents: 13660
diff changeset
  1967
            annotations at: index put: annotation.
13422
b43a8a47037c Jan's changes
vrany
parents: 13390
diff changeset
  1968
"/            annotation annotatesMethod: self
13662
7d7ae1e5f589 changed: #annotationAtIndex:
Claus Gittinger <cg@exept.de>
parents: 13660
diff changeset
  1969
        ].
13422
b43a8a47037c Jan's changes
vrany
parents: 13390
diff changeset
  1970
    ].
b43a8a47037c Jan's changes
vrany
parents: 13390
diff changeset
  1971
    ^annotation
b43a8a47037c Jan's changes
vrany
parents: 13390
diff changeset
  1972
b43a8a47037c Jan's changes
vrany
parents: 13390
diff changeset
  1973
    "Created: / 02-07-2010 / 22:30:44 / Jan Vrany <jan.vrany@fit.cvut.cz>"
b43a8a47037c Jan's changes
vrany
parents: 13390
diff changeset
  1974
    "Modified: / 11-07-2010 / 19:39:33 / Jan Vrany <jan.vrany@fit.cvut.cz>"
13817
7d1e0e8ea364 changed:10 methods
Claus Gittinger <cg@exept.de>
parents: 13805
diff changeset
  1975
    "Modified: / 18-11-2011 / 14:46:27 / cg"
14253
Claus Gittinger <cg@exept.de>
parents: 14251
diff changeset
  1976
    "Modified (comment): / 26-07-2012 / 15:48:07 / cg"
13422
b43a8a47037c Jan's changes
vrany
parents: 13390
diff changeset
  1977
!
b43a8a47037c Jan's changes
vrany
parents: 13390
diff changeset
  1978
b43a8a47037c Jan's changes
vrany
parents: 13390
diff changeset
  1979
annotationIndexOf: key
14253
Claus Gittinger <cg@exept.de>
parents: 14251
diff changeset
  1980
    "Returns the index of annotation with given key
13422
b43a8a47037c Jan's changes
vrany
parents: 13390
diff changeset
  1981
     or nil if there is no such annotation"
b43a8a47037c Jan's changes
vrany
parents: 13390
diff changeset
  1982
13817
7d1e0e8ea364 changed:10 methods
Claus Gittinger <cg@exept.de>
parents: 13805
diff changeset
  1983
    annotations isNil ifTrue:[^nil].
7d1e0e8ea364 changed:10 methods
Claus Gittinger <cg@exept.de>
parents: 13805
diff changeset
  1984
7d1e0e8ea364 changed:10 methods
Claus Gittinger <cg@exept.de>
parents: 13805
diff changeset
  1985
    annotations keysAndValuesDo: [:index :annotationOrArray|
13662
7d7ae1e5f589 changed: #annotationAtIndex:
Claus Gittinger <cg@exept.de>
parents: 13660
diff changeset
  1986
        annotationOrArray isArray
7d7ae1e5f589 changed: #annotationAtIndex:
Claus Gittinger <cg@exept.de>
parents: 13660
diff changeset
  1987
            ifTrue: [annotationOrArray first == key ifTrue:[^index]]
13817
7d1e0e8ea364 changed:10 methods
Claus Gittinger <cg@exept.de>
parents: 13805
diff changeset
  1988
            ifFalse:[annotationOrArray key == key ifTrue:[^index]]
7d1e0e8ea364 changed:10 methods
Claus Gittinger <cg@exept.de>
parents: 13805
diff changeset
  1989
    ].
13422
b43a8a47037c Jan's changes
vrany
parents: 13390
diff changeset
  1990
    ^nil.
b43a8a47037c Jan's changes
vrany
parents: 13390
diff changeset
  1991
b43a8a47037c Jan's changes
vrany
parents: 13390
diff changeset
  1992
    "Created: / 19-05-2010 / 16:40:32 / Jan Vrany <jan.vrany@fit.cvut.cz>"
b43a8a47037c Jan's changes
vrany
parents: 13390
diff changeset
  1993
    "Modified: / 11-07-2010 / 19:23:21 / Jan Vrany <jan.vrany@fit.cvut.cz>"
14253
Claus Gittinger <cg@exept.de>
parents: 14251
diff changeset
  1994
    "Modified (comment): / 26-07-2012 / 15:48:14 / cg"
13422
b43a8a47037c Jan's changes
vrany
parents: 13390
diff changeset
  1995
!
b43a8a47037c Jan's changes
vrany
parents: 13390
diff changeset
  1996
12695
14b7044c2e4a changed:
Stefan Vogel <sv@exept.de>
parents: 12682
diff changeset
  1997
cacheSourceStream:aStream
14b7044c2e4a changed:
Stefan Vogel <sv@exept.de>
parents: 12682
diff changeset
  1998
    "remember a (raw) source stream for later use"
14b7044c2e4a changed:
Stefan Vogel <sv@exept.de>
parents: 12682
diff changeset
  1999
14b7044c2e4a changed:
Stefan Vogel <sv@exept.de>
parents: 12682
diff changeset
  2000
    |lastStream|
14b7044c2e4a changed:
Stefan Vogel <sv@exept.de>
parents: 12682
diff changeset
  2001
14b7044c2e4a changed:
Stefan Vogel <sv@exept.de>
parents: 12682
diff changeset
  2002
    (package notNil and:[package ~= PackageId noProjectID]) ifTrue:[
13662
7d7ae1e5f589 changed: #annotationAtIndex:
Claus Gittinger <cg@exept.de>
parents: 13660
diff changeset
  2003
        LastFileLock critical:[
7d7ae1e5f589 changed: #annotationAtIndex:
Claus Gittinger <cg@exept.de>
parents: 13660
diff changeset
  2004
            lastStream := LastFileReference at:1.
7d7ae1e5f589 changed: #annotationAtIndex:
Claus Gittinger <cg@exept.de>
parents: 13660
diff changeset
  2005
            (lastStream notNil and:[lastStream ~= 0 and:[lastStream isOpen]]) ifTrue:[
7d7ae1e5f589 changed: #annotationAtIndex:
Claus Gittinger <cg@exept.de>
parents: 13660
diff changeset
  2006
                lastStream close.
7d7ae1e5f589 changed: #annotationAtIndex:
Claus Gittinger <cg@exept.de>
parents: 13660
diff changeset
  2007
            ].
7d7ae1e5f589 changed: #annotationAtIndex:
Claus Gittinger <cg@exept.de>
parents: 13660
diff changeset
  2008
            LastSourceFileName := package,'/',source.
7d7ae1e5f589 changed: #annotationAtIndex:
Claus Gittinger <cg@exept.de>
parents: 13660
diff changeset
  2009
            LastFileReference at:1 put:aStream.
7d7ae1e5f589 changed: #annotationAtIndex:
Claus Gittinger <cg@exept.de>
parents: 13660
diff changeset
  2010
        ].
12695
14b7044c2e4a changed:
Stefan Vogel <sv@exept.de>
parents: 12682
diff changeset
  2011
    ].
14b7044c2e4a changed:
Stefan Vogel <sv@exept.de>
parents: 12682
diff changeset
  2012
!
14b7044c2e4a changed:
Stefan Vogel <sv@exept.de>
parents: 12682
diff changeset
  2013
13422
b43a8a47037c Jan's changes
vrany
parents: 13390
diff changeset
  2014
getAnnotations
b43a8a47037c Jan's changes
vrany
parents: 13390
diff changeset
  2015
    ^annotations
b43a8a47037c Jan's changes
vrany
parents: 13390
diff changeset
  2016
b43a8a47037c Jan's changes
vrany
parents: 13390
diff changeset
  2017
    "Created: / 10-07-2010 / 21:55:02 / Jan Vrany <jan.vrany@fit.cvut.cz>"
b43a8a47037c Jan's changes
vrany
parents: 13390
diff changeset
  2018
    "Modified: / 11-07-2010 / 19:30:13 / Jan Vrany <jan.vrany@fit.cvut.cz>"
14253
Claus Gittinger <cg@exept.de>
parents: 14251
diff changeset
  2019
    "Modified (format): / 26-07-2012 / 15:49:38 / cg"
13422
b43a8a47037c Jan's changes
vrany
parents: 13390
diff changeset
  2020
!
b43a8a47037c Jan's changes
vrany
parents: 13390
diff changeset
  2021
b43a8a47037c Jan's changes
vrany
parents: 13390
diff changeset
  2022
getLookupObject
b43a8a47037c Jan's changes
vrany
parents: 13390
diff changeset
  2023
b43a8a47037c Jan's changes
vrany
parents: 13390
diff changeset
  2024
    ^lookupObject
b43a8a47037c Jan's changes
vrany
parents: 13390
diff changeset
  2025
b43a8a47037c Jan's changes
vrany
parents: 13390
diff changeset
  2026
    "Created: / 10-07-2010 / 21:55:02 / Jan Vrany <jan.vrany@fit.cvut.cz>"
b43a8a47037c Jan's changes
vrany
parents: 13390
diff changeset
  2027
!
b43a8a47037c Jan's changes
vrany
parents: 13390
diff changeset
  2028
8141
41b25e5f7532 sourceStream access refactored (preps for utf8 decoding)
Claus Gittinger <cg@exept.de>
parents: 8117
diff changeset
  2029
localSourceStream
41b25e5f7532 sourceStream access refactored (preps for utf8 decoding)
Claus Gittinger <cg@exept.de>
parents: 8117
diff changeset
  2030
    "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
  2031
     searching in standard places."
41b25e5f7532 sourceStream access refactored (preps for utf8 decoding)
Claus Gittinger <cg@exept.de>
parents: 8117
diff changeset
  2032
8216
3b56b52db477 getpackageDir
ca
parents: 8169
diff changeset
  2033
    |dir fileName aStream|
8141
41b25e5f7532 sourceStream access refactored (preps for utf8 decoding)
Claus Gittinger <cg@exept.de>
parents: 8117
diff changeset
  2034
41b25e5f7532 sourceStream access refactored (preps for utf8 decoding)
Claus Gittinger <cg@exept.de>
parents: 8117
diff changeset
  2035
    package notNil ifTrue:[
13662
7d7ae1e5f589 changed: #annotationAtIndex:
Claus Gittinger <cg@exept.de>
parents: 13660
diff changeset
  2036
        "/
7d7ae1e5f589 changed: #annotationAtIndex:
Claus Gittinger <cg@exept.de>
parents: 13660
diff changeset
  2037
        "/ old: look in 'source/<filename>'
7d7ae1e5f589 changed: #annotationAtIndex:
Claus Gittinger <cg@exept.de>
parents: 13660
diff changeset
  2038
        "/ this is still kept in order to find user-private
7d7ae1e5f589 changed: #annotationAtIndex:
Claus Gittinger <cg@exept.de>
parents: 13660
diff changeset
  2039
        "/ classes in her currentDirectory.
7d7ae1e5f589 changed: #annotationAtIndex:
Claus Gittinger <cg@exept.de>
parents: 13660
diff changeset
  2040
        "/
7d7ae1e5f589 changed: #annotationAtIndex:
Claus Gittinger <cg@exept.de>
parents: 13660
diff changeset
  2041
        fileName := Smalltalk getSourceFileName:(package copyReplaceAll:$: with:$/) , '/' , source.
7d7ae1e5f589 changed: #annotationAtIndex:
Claus Gittinger <cg@exept.de>
parents: 13660
diff changeset
  2042
        fileName notNil ifTrue:[
7d7ae1e5f589 changed: #annotationAtIndex:
Claus Gittinger <cg@exept.de>
parents: 13660
diff changeset
  2043
            aStream := fileName asFilename readStreamOrNil.
7d7ae1e5f589 changed: #annotationAtIndex:
Claus Gittinger <cg@exept.de>
parents: 13660
diff changeset
  2044
            aStream notNil ifTrue:[^ aStream].
7d7ae1e5f589 changed: #annotationAtIndex:
Claus Gittinger <cg@exept.de>
parents: 13660
diff changeset
  2045
        ].
7d7ae1e5f589 changed: #annotationAtIndex:
Claus Gittinger <cg@exept.de>
parents: 13660
diff changeset
  2046
        "/
7d7ae1e5f589 changed: #annotationAtIndex:
Claus Gittinger <cg@exept.de>
parents: 13660
diff changeset
  2047
        "/ new: look in package-dir
7d7ae1e5f589 changed: #annotationAtIndex:
Claus Gittinger <cg@exept.de>
parents: 13660
diff changeset
  2048
        "/
7d7ae1e5f589 changed: #annotationAtIndex:
Claus Gittinger <cg@exept.de>
parents: 13660
diff changeset
  2049
        dir := Smalltalk getPackageDirectoryForPackage:package.
7d7ae1e5f589 changed: #annotationAtIndex:
Claus Gittinger <cg@exept.de>
parents: 13660
diff changeset
  2050
        dir notNil ifTrue:[
7d7ae1e5f589 changed: #annotationAtIndex:
Claus Gittinger <cg@exept.de>
parents: 13660
diff changeset
  2051
            fileName := dir construct:source.
7d7ae1e5f589 changed: #annotationAtIndex:
Claus Gittinger <cg@exept.de>
parents: 13660
diff changeset
  2052
            aStream := fileName asFilename readStreamOrNil.
7d7ae1e5f589 changed: #annotationAtIndex:
Claus Gittinger <cg@exept.de>
parents: 13660
diff changeset
  2053
            aStream notNil ifTrue:[^ aStream].
7d7ae1e5f589 changed: #annotationAtIndex:
Claus Gittinger <cg@exept.de>
parents: 13660
diff changeset
  2054
        ].
8141
41b25e5f7532 sourceStream access refactored (preps for utf8 decoding)
Claus Gittinger <cg@exept.de>
parents: 8117
diff changeset
  2055
    ].
41b25e5f7532 sourceStream access refactored (preps for utf8 decoding)
Claus Gittinger <cg@exept.de>
parents: 8117
diff changeset
  2056
    fileName := Smalltalk getSourceFileName:source.
41b25e5f7532 sourceStream access refactored (preps for utf8 decoding)
Claus Gittinger <cg@exept.de>
parents: 8117
diff changeset
  2057
    fileName notNil ifTrue:[
13662
7d7ae1e5f589 changed: #annotationAtIndex:
Claus Gittinger <cg@exept.de>
parents: 13660
diff changeset
  2058
        aStream := fileName asFilename readStreamOrNil.
8141
41b25e5f7532 sourceStream access refactored (preps for utf8 decoding)
Claus Gittinger <cg@exept.de>
parents: 8117
diff changeset
  2059
    ].
41b25e5f7532 sourceStream access refactored (preps for utf8 decoding)
Claus Gittinger <cg@exept.de>
parents: 8117
diff changeset
  2060
    ^ aStream
41b25e5f7532 sourceStream access refactored (preps for utf8 decoding)
Claus Gittinger <cg@exept.de>
parents: 8117
diff changeset
  2061
!
41b25e5f7532 sourceStream access refactored (preps for utf8 decoding)
Claus Gittinger <cg@exept.de>
parents: 8117
diff changeset
  2062
12682
Stefan Vogel <sv@exept.de>
parents: 12620
diff changeset
  2063
rawSourceStreamUsingCache:usingCacheBoolean
Stefan Vogel <sv@exept.de>
parents: 12620
diff changeset
  2064
    "return an open sourceStream (needs positioning).
Stefan Vogel <sv@exept.de>
parents: 12620
diff changeset
  2065
     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
  2066
     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
  2067
     if usingCacheBoolean is true."
8141
41b25e5f7532 sourceStream access refactored (preps for utf8 decoding)
Claus Gittinger <cg@exept.de>
parents: 8117
diff changeset
  2068
15952
e55b89f8d241 class: Method
Claus Gittinger <cg@exept.de>
parents: 15787
diff changeset
  2069
    |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
  2070
41b25e5f7532 sourceStream access refactored (preps for utf8 decoding)
Claus Gittinger <cg@exept.de>
parents: 8117
diff changeset
  2071
    "
41b25e5f7532 sourceStream access refactored (preps for utf8 decoding)
Claus Gittinger <cg@exept.de>
parents: 8117
diff changeset
  2072
     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
  2073
     abs(sourcePosition) is the offset.
41b25e5f7532 sourceStream access refactored (preps for utf8 decoding)
Claus Gittinger <cg@exept.de>
parents: 8117
diff changeset
  2074
     Otherwise, source is the real source
41b25e5f7532 sourceStream access refactored (preps for utf8 decoding)
Claus Gittinger <cg@exept.de>
parents: 8117
diff changeset
  2075
    "
41b25e5f7532 sourceStream access refactored (preps for utf8 decoding)
Claus Gittinger <cg@exept.de>
parents: 8117
diff changeset
  2076
    source isNil ifTrue:[^ nil].
41b25e5f7532 sourceStream access refactored (preps for utf8 decoding)
Claus Gittinger <cg@exept.de>
parents: 8117
diff changeset
  2077
    sourcePosition isNil ifTrue:[^ source readStream].
41b25e5f7532 sourceStream access refactored (preps for utf8 decoding)
Claus Gittinger <cg@exept.de>
parents: 8117
diff changeset
  2078
12682
Stefan Vogel <sv@exept.de>
parents: 12620
diff changeset
  2079
    usingCacheBoolean ifTrue:[
13662
7d7ae1e5f589 changed: #annotationAtIndex:
Claus Gittinger <cg@exept.de>
parents: 13660
diff changeset
  2080
        (package notNil and:[package ~= PackageId noProjectID]) ifTrue:[
7d7ae1e5f589 changed: #annotationAtIndex:
Claus Gittinger <cg@exept.de>
parents: 13660
diff changeset
  2081
            "/ keep the last source file open, because open/close
7d7ae1e5f589 changed: #annotationAtIndex:
Claus Gittinger <cg@exept.de>
parents: 13660
diff changeset
  2082
            "/ operations maybe slow on NFS-mounted file systems.
7d7ae1e5f589 changed: #annotationAtIndex:
Claus Gittinger <cg@exept.de>
parents: 13660
diff changeset
  2083
            "/ Since the reference to the file is weak, it will be closed
7d7ae1e5f589 changed: #annotationAtIndex:
Claus Gittinger <cg@exept.de>
parents: 13660
diff changeset
  2084
            "/ automatically if the file is not referenced for a while.
7d7ae1e5f589 changed: #annotationAtIndex:
Claus Gittinger <cg@exept.de>
parents: 13660
diff changeset
  2085
            "/ Neat trick.
7d7ae1e5f589 changed: #annotationAtIndex:
Claus Gittinger <cg@exept.de>
parents: 13660
diff changeset
  2086
7d7ae1e5f589 changed: #annotationAtIndex:
Claus Gittinger <cg@exept.de>
parents: 13660
diff changeset
  2087
            LastFileLock critical:[
7d7ae1e5f589 changed: #annotationAtIndex:
Claus Gittinger <cg@exept.de>
parents: 13660
diff changeset
  2088
                aStream := LastFileReference at:1.
7d7ae1e5f589 changed: #annotationAtIndex:
Claus Gittinger <cg@exept.de>
parents: 13660
diff changeset
  2089
                (aStream isNil or:[aStream == 0 or:[aStream isOpen not]]) ifTrue:[
7d7ae1e5f589 changed: #annotationAtIndex:
Claus Gittinger <cg@exept.de>
parents: 13660
diff changeset
  2090
                    aStream := nil.
7d7ae1e5f589 changed: #annotationAtIndex:
Claus Gittinger <cg@exept.de>
parents: 13660
diff changeset
  2091
                    LastFileReference at:1 put:nil.
7d7ae1e5f589 changed: #annotationAtIndex:
Claus Gittinger <cg@exept.de>
parents: 13660
diff changeset
  2092
                ].
7d7ae1e5f589 changed: #annotationAtIndex:
Claus Gittinger <cg@exept.de>
parents: 13660
diff changeset
  2093
                (aStream notNil and:[LastSourceFileName ~= (package,'/',source)]) ifTrue:[
7d7ae1e5f589 changed: #annotationAtIndex:
Claus Gittinger <cg@exept.de>
parents: 13660
diff changeset
  2094
                    aStream := nil.
7d7ae1e5f589 changed: #annotationAtIndex:
Claus Gittinger <cg@exept.de>
parents: 13660
diff changeset
  2095
                ].
7d7ae1e5f589 changed: #annotationAtIndex:
Claus Gittinger <cg@exept.de>
parents: 13660
diff changeset
  2096
            ].
7d7ae1e5f589 changed: #annotationAtIndex:
Claus Gittinger <cg@exept.de>
parents: 13660
diff changeset
  2097
7d7ae1e5f589 changed: #annotationAtIndex:
Claus Gittinger <cg@exept.de>
parents: 13660
diff changeset
  2098
            aStream notNil ifTrue:[
7d7ae1e5f589 changed: #annotationAtIndex:
Claus Gittinger <cg@exept.de>
parents: 13660
diff changeset
  2099
                ^ aStream
7d7ae1e5f589 changed: #annotationAtIndex:
Claus Gittinger <cg@exept.de>
parents: 13660
diff changeset
  2100
            ].
7d7ae1e5f589 changed: #annotationAtIndex:
Claus Gittinger <cg@exept.de>
parents: 13660
diff changeset
  2101
        ].
8141
41b25e5f7532 sourceStream access refactored (preps for utf8 decoding)
Claus Gittinger <cg@exept.de>
parents: 8117
diff changeset
  2102
    ].
41b25e5f7532 sourceStream access refactored (preps for utf8 decoding)
Claus Gittinger <cg@exept.de>
parents: 8117
diff changeset
  2103
41b25e5f7532 sourceStream access refactored (preps for utf8 decoding)
Claus Gittinger <cg@exept.de>
parents: 8117
diff changeset
  2104
    "/ a negative sourcePosition indicates
12854
3a3d3c02c3bd *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 12695
diff changeset
  2105
    "/ that this is a local file
8141
41b25e5f7532 sourceStream access refactored (preps for utf8 decoding)
Claus Gittinger <cg@exept.de>
parents: 8117
diff changeset
  2106
    "/ (not to be requested via the sourceCodeManager)
41b25e5f7532 sourceStream access refactored (preps for utf8 decoding)
Claus Gittinger <cg@exept.de>
parents: 8117
diff changeset
  2107
    "/ 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
  2108
    "/ 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
  2109
    "/ 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
  2110
41b25e5f7532 sourceStream access refactored (preps for utf8 decoding)
Claus Gittinger <cg@exept.de>
parents: 8117
diff changeset
  2111
    sourcePosition < 0 ifTrue:[
13662
7d7ae1e5f589 changed: #annotationAtIndex:
Claus Gittinger <cg@exept.de>
parents: 13660
diff changeset
  2112
        aStream := source asFilename readStreamOrNil.
7d7ae1e5f589 changed: #annotationAtIndex:
Claus Gittinger <cg@exept.de>
parents: 13660
diff changeset
  2113
        aStream isNil ifTrue:[
7d7ae1e5f589 changed: #annotationAtIndex:
Claus Gittinger <cg@exept.de>
parents: 13660
diff changeset
  2114
            "/ search in some standard places
7d7ae1e5f589 changed: #annotationAtIndex:
Claus Gittinger <cg@exept.de>
parents: 13660
diff changeset
  2115
            fileName := Smalltalk getSourceFileName:source.
7d7ae1e5f589 changed: #annotationAtIndex:
Claus Gittinger <cg@exept.de>
parents: 13660
diff changeset
  2116
            fileName notNil ifTrue:[
7d7ae1e5f589 changed: #annotationAtIndex:
Claus Gittinger <cg@exept.de>
parents: 13660
diff changeset
  2117
                aStream := fileName asFilename readStreamOrNil.
7d7ae1e5f589 changed: #annotationAtIndex:
Claus Gittinger <cg@exept.de>
parents: 13660
diff changeset
  2118
            ].
7d7ae1e5f589 changed: #annotationAtIndex:
Claus Gittinger <cg@exept.de>
parents: 13660
diff changeset
  2119
        ].
7d7ae1e5f589 changed: #annotationAtIndex:
Claus Gittinger <cg@exept.de>
parents: 13660
diff changeset
  2120
        aStream notNil ifTrue:[
7d7ae1e5f589 changed: #annotationAtIndex:
Claus Gittinger <cg@exept.de>
parents: 13660
diff changeset
  2121
            usingCacheBoolean ifTrue:[
7d7ae1e5f589 changed: #annotationAtIndex:
Claus Gittinger <cg@exept.de>
parents: 13660
diff changeset
  2122
                self cacheSourceStream:aStream.
7d7ae1e5f589 changed: #annotationAtIndex:
Claus Gittinger <cg@exept.de>
parents: 13660
diff changeset
  2123
            ].
7d7ae1e5f589 changed: #annotationAtIndex:
Claus Gittinger <cg@exept.de>
parents: 13660
diff changeset
  2124
            ^ aStream
7d7ae1e5f589 changed: #annotationAtIndex:
Claus Gittinger <cg@exept.de>
parents: 13660
diff changeset
  2125
        ].
8141
41b25e5f7532 sourceStream access refactored (preps for utf8 decoding)
Claus Gittinger <cg@exept.de>
parents: 8117
diff changeset
  2126
    ].
41b25e5f7532 sourceStream access refactored (preps for utf8 decoding)
Claus Gittinger <cg@exept.de>
parents: 8117
diff changeset
  2127
41b25e5f7532 sourceStream access refactored (preps for utf8 decoding)
Claus Gittinger <cg@exept.de>
parents: 8117
diff changeset
  2128
    "/
41b25e5f7532 sourceStream access refactored (preps for utf8 decoding)
Claus Gittinger <cg@exept.de>
parents: 8117
diff changeset
  2129
    "/ 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
  2130
    "/
15952
e55b89f8d241 class: Method
Claus Gittinger <cg@exept.de>
parents: 15787
diff changeset
  2131
    (mclass notNil and:[package == mclass package]) ifTrue:[
e55b89f8d241 class: Method
Claus Gittinger <cg@exept.de>
parents: 15787
diff changeset
  2132
        mgr := mclass sourceCodeManagerFromBinaryRevision
e55b89f8d241 class: Method
Claus Gittinger <cg@exept.de>
parents: 15787
diff changeset
  2133
    ] ifFalse:[
e55b89f8d241 class: Method
Claus Gittinger <cg@exept.de>
parents: 15787
diff changeset
  2134
        "I'm an extension and we don't have binary revision info (!!)
e55b89f8d241 class: Method
Claus Gittinger <cg@exept.de>
parents: 15787
diff changeset
  2135
         for extensions, try tp guess here"
e55b89f8d241 class: Method
Claus Gittinger <cg@exept.de>
parents: 15787
diff changeset
  2136
        pkgDef := ProjectDefinition definitionClassForPackage: package.
e55b89f8d241 class: Method
Claus Gittinger <cg@exept.de>
parents: 15787
diff changeset
  2137
        pkgDef notNil ifTrue:[
e55b89f8d241 class: Method
Claus Gittinger <cg@exept.de>
parents: 15787
diff changeset
  2138
            mgr := pkgDef sourceCodeManagerFromBinaryRevision
e55b89f8d241 class: Method
Claus Gittinger <cg@exept.de>
parents: 15787
diff changeset
  2139
        ] ifFalse:[
e55b89f8d241 class: Method
Claus Gittinger <cg@exept.de>
parents: 15787
diff changeset
  2140
            "OK, trust the configuration"
e55b89f8d241 class: Method
Claus Gittinger <cg@exept.de>
parents: 15787
diff changeset
  2141
            mgr := AbstractSourceCodeManager managerForPackage: package
e55b89f8d241 class: Method
Claus Gittinger <cg@exept.de>
parents: 15787
diff changeset
  2142
        ]
e55b89f8d241 class: Method
Claus Gittinger <cg@exept.de>
parents: 15787
diff changeset
  2143
    ].
e55b89f8d241 class: Method
Claus Gittinger <cg@exept.de>
parents: 15787
diff changeset
  2144
e55b89f8d241 class: Method
Claus Gittinger <cg@exept.de>
parents: 15787
diff changeset
  2145
    (Class tryLocalSourceFirst or:[mgr isNil]) ifTrue:[
13662
7d7ae1e5f589 changed: #annotationAtIndex:
Claus Gittinger <cg@exept.de>
parents: 13660
diff changeset
  2146
        aStream := self localSourceStream.
7d7ae1e5f589 changed: #annotationAtIndex:
Claus Gittinger <cg@exept.de>
parents: 13660
diff changeset
  2147
        aStream notNil ifTrue:[
7d7ae1e5f589 changed: #annotationAtIndex:
Claus Gittinger <cg@exept.de>
parents: 13660
diff changeset
  2148
            usingCacheBoolean ifTrue:[
7d7ae1e5f589 changed: #annotationAtIndex:
Claus Gittinger <cg@exept.de>
parents: 13660
diff changeset
  2149
                self cacheSourceStream:aStream.
7d7ae1e5f589 changed: #annotationAtIndex:
Claus Gittinger <cg@exept.de>
parents: 13660
diff changeset
  2150
            ].
7d7ae1e5f589 changed: #annotationAtIndex:
Claus Gittinger <cg@exept.de>
parents: 13660
diff changeset
  2151
            ^ aStream
7d7ae1e5f589 changed: #annotationAtIndex:
Claus Gittinger <cg@exept.de>
parents: 13660
diff changeset
  2152
        ].
8141
41b25e5f7532 sourceStream access refactored (preps for utf8 decoding)
Claus Gittinger <cg@exept.de>
parents: 8117
diff changeset
  2153
    ].
41b25e5f7532 sourceStream access refactored (preps for utf8 decoding)
Claus Gittinger <cg@exept.de>
parents: 8117
diff changeset
  2154
41b25e5f7532 sourceStream access refactored (preps for utf8 decoding)
Claus Gittinger <cg@exept.de>
parents: 8117
diff changeset
  2155
    "/
41b25e5f7532 sourceStream access refactored (preps for utf8 decoding)
Claus Gittinger <cg@exept.de>
parents: 8117
diff changeset
  2156
    "/ 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
  2157
    "/
41b25e5f7532 sourceStream access refactored (preps for utf8 decoding)
Claus Gittinger <cg@exept.de>
parents: 8117
diff changeset
  2158
    who := self who.
41b25e5f7532 sourceStream access refactored (preps for utf8 decoding)
Claus Gittinger <cg@exept.de>
parents: 8117
diff changeset
  2159
    who notNil ifTrue:[
13662
7d7ae1e5f589 changed: #annotationAtIndex:
Claus Gittinger <cg@exept.de>
parents: 13660
diff changeset
  2160
        myClass := who methodClass.
7d7ae1e5f589 changed: #annotationAtIndex:
Claus Gittinger <cg@exept.de>
parents: 13660
diff changeset
  2161
7d7ae1e5f589 changed: #annotationAtIndex:
Claus Gittinger <cg@exept.de>
parents: 13660
diff changeset
  2162
        (package notNil and:[package ~= myClass package]) ifTrue:[
7d7ae1e5f589 changed: #annotationAtIndex:
Claus Gittinger <cg@exept.de>
parents: 13660
diff changeset
  2163
            "/ I am an extension
7d7ae1e5f589 changed: #annotationAtIndex:
Claus Gittinger <cg@exept.de>
parents: 13660
diff changeset
  2164
            mgr notNil ifTrue:[
7d7ae1e5f589 changed: #annotationAtIndex:
Claus Gittinger <cg@exept.de>
parents: 13660
diff changeset
  2165
                "/ try to get the source using my package information ...
7d7ae1e5f589 changed: #annotationAtIndex:
Claus Gittinger <cg@exept.de>
parents: 13660
diff changeset
  2166
                mod := package asPackageId module.
7d7ae1e5f589 changed: #annotationAtIndex:
Claus Gittinger <cg@exept.de>
parents: 13660
diff changeset
  2167
                dir := package asPackageId directory.
7d7ae1e5f589 changed: #annotationAtIndex:
Claus Gittinger <cg@exept.de>
parents: 13660
diff changeset
  2168
                aStream := mgr streamForExtensionFile:source package:package directory:dir module:mod cache:true.
7d7ae1e5f589 changed: #annotationAtIndex:
Claus Gittinger <cg@exept.de>
parents: 13660
diff changeset
  2169
                aStream notNil ifTrue:[
7d7ae1e5f589 changed: #annotationAtIndex:
Claus Gittinger <cg@exept.de>
parents: 13660
diff changeset
  2170
                    usingCacheBoolean ifTrue:[
7d7ae1e5f589 changed: #annotationAtIndex:
Claus Gittinger <cg@exept.de>
parents: 13660
diff changeset
  2171
                        self cacheSourceStream:aStream.
7d7ae1e5f589 changed: #annotationAtIndex:
Claus Gittinger <cg@exept.de>
parents: 13660
diff changeset
  2172
                    ].
7d7ae1e5f589 changed: #annotationAtIndex:
Claus Gittinger <cg@exept.de>
parents: 13660
diff changeset
  2173
                    ^ aStream
7d7ae1e5f589 changed: #annotationAtIndex:
Claus Gittinger <cg@exept.de>
parents: 13660
diff changeset
  2174
                ].
7d7ae1e5f589 changed: #annotationAtIndex:
Claus Gittinger <cg@exept.de>
parents: 13660
diff changeset
  2175
            ].
7d7ae1e5f589 changed: #annotationAtIndex:
Claus Gittinger <cg@exept.de>
parents: 13660
diff changeset
  2176
            "/ consult the local fileSystem
7d7ae1e5f589 changed: #annotationAtIndex:
Claus Gittinger <cg@exept.de>
parents: 13660
diff changeset
  2177
            aStream := self localSourceStream.
7d7ae1e5f589 changed: #annotationAtIndex:
Claus Gittinger <cg@exept.de>
parents: 13660
diff changeset
  2178
            aStream notNil ifTrue:[
7d7ae1e5f589 changed: #annotationAtIndex:
Claus Gittinger <cg@exept.de>
parents: 13660
diff changeset
  2179
                usingCacheBoolean ifTrue:[
7d7ae1e5f589 changed: #annotationAtIndex:
Claus Gittinger <cg@exept.de>
parents: 13660
diff changeset
  2180
                    self cacheSourceStream:aStream.
7d7ae1e5f589 changed: #annotationAtIndex:
Claus Gittinger <cg@exept.de>
parents: 13660
diff changeset
  2181
                ].
7d7ae1e5f589 changed: #annotationAtIndex:
Claus Gittinger <cg@exept.de>
parents: 13660
diff changeset
  2182
                ^ aStream
7d7ae1e5f589 changed: #annotationAtIndex:
Claus Gittinger <cg@exept.de>
parents: 13660
diff changeset
  2183
            ]
7d7ae1e5f589 changed: #annotationAtIndex:
Claus Gittinger <cg@exept.de>
parents: 13660
diff changeset
  2184
        ].
7d7ae1e5f589 changed: #annotationAtIndex:
Claus Gittinger <cg@exept.de>
parents: 13660
diff changeset
  2185
7d7ae1e5f589 changed: #annotationAtIndex:
Claus Gittinger <cg@exept.de>
parents: 13660
diff changeset
  2186
        aStream := myClass sourceStreamFor:source.
7d7ae1e5f589 changed: #annotationAtIndex:
Claus Gittinger <cg@exept.de>
parents: 13660
diff changeset
  2187
        aStream notNil ifTrue:[
7d7ae1e5f589 changed: #annotationAtIndex:
Claus Gittinger <cg@exept.de>
parents: 13660
diff changeset
  2188
            usingCacheBoolean ifTrue:[
7d7ae1e5f589 changed: #annotationAtIndex:
Claus Gittinger <cg@exept.de>
parents: 13660
diff changeset
  2189
                self cacheSourceStream:aStream.
7d7ae1e5f589 changed: #annotationAtIndex:
Claus Gittinger <cg@exept.de>
parents: 13660
diff changeset
  2190
            ].
7d7ae1e5f589 changed: #annotationAtIndex:
Claus Gittinger <cg@exept.de>
parents: 13660
diff changeset
  2191
            ^ aStream
7d7ae1e5f589 changed: #annotationAtIndex:
Claus Gittinger <cg@exept.de>
parents: 13660
diff changeset
  2192
        ].
8141
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
41b25e5f7532 sourceStream access refactored (preps for utf8 decoding)
Claus Gittinger <cg@exept.de>
parents: 8117
diff changeset
  2195
    "/
12854
3a3d3c02c3bd *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 12695
diff changeset
  2196
    "/ nope - look in standard places
8141
41b25e5f7532 sourceStream access refactored (preps for utf8 decoding)
Claus Gittinger <cg@exept.de>
parents: 8117
diff changeset
  2197
    "/ (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
  2198
    "/
10207
b5ca553d15ad localSourceFirst for extensions.
Claus Gittinger <cg@exept.de>
parents: 10201
diff changeset
  2199
    (mgr notNil and:[Class tryLocalSourceFirst not]) ifTrue:[
13662
7d7ae1e5f589 changed: #annotationAtIndex:
Claus Gittinger <cg@exept.de>
parents: 13660
diff changeset
  2200
        aStream := self localSourceStream.
7d7ae1e5f589 changed: #annotationAtIndex:
Claus Gittinger <cg@exept.de>
parents: 13660
diff changeset
  2201
        aStream notNil ifTrue:[
7d7ae1e5f589 changed: #annotationAtIndex:
Claus Gittinger <cg@exept.de>
parents: 13660
diff changeset
  2202
            usingCacheBoolean ifTrue:[
7d7ae1e5f589 changed: #annotationAtIndex:
Claus Gittinger <cg@exept.de>
parents: 13660
diff changeset
  2203
                self cacheSourceStream:aStream.
7d7ae1e5f589 changed: #annotationAtIndex:
Claus Gittinger <cg@exept.de>
parents: 13660
diff changeset
  2204
            ].
7d7ae1e5f589 changed: #annotationAtIndex:
Claus Gittinger <cg@exept.de>
parents: 13660
diff changeset
  2205
            ^ aStream
7d7ae1e5f589 changed: #annotationAtIndex:
Claus Gittinger <cg@exept.de>
parents: 13660
diff changeset
  2206
        ].
8141
41b25e5f7532 sourceStream access refactored (preps for utf8 decoding)
Claus Gittinger <cg@exept.de>
parents: 8117
diff changeset
  2207
    ].
41b25e5f7532 sourceStream access refactored (preps for utf8 decoding)
Claus Gittinger <cg@exept.de>
parents: 8117
diff changeset
  2208
41b25e5f7532 sourceStream access refactored (preps for utf8 decoding)
Claus Gittinger <cg@exept.de>
parents: 8117
diff changeset
  2209
    "/
41b25e5f7532 sourceStream access refactored (preps for utf8 decoding)
Claus Gittinger <cg@exept.de>
parents: 8117
diff changeset
  2210
    "/ final chance: try current directory
41b25e5f7532 sourceStream access refactored (preps for utf8 decoding)
Claus Gittinger <cg@exept.de>
parents: 8117
diff changeset
  2211
    "/
41b25e5f7532 sourceStream access refactored (preps for utf8 decoding)
Claus Gittinger <cg@exept.de>
parents: 8117
diff changeset
  2212
    aStream isNil ifTrue:[
13662
7d7ae1e5f589 changed: #annotationAtIndex:
Claus Gittinger <cg@exept.de>
parents: 13660
diff changeset
  2213
        aStream := source asFilename readStreamOrNil.
7d7ae1e5f589 changed: #annotationAtIndex:
Claus Gittinger <cg@exept.de>
parents: 13660
diff changeset
  2214
        aStream notNil ifTrue:[
7d7ae1e5f589 changed: #annotationAtIndex:
Claus Gittinger <cg@exept.de>
parents: 13660
diff changeset
  2215
            usingCacheBoolean ifTrue:[
7d7ae1e5f589 changed: #annotationAtIndex:
Claus Gittinger <cg@exept.de>
parents: 13660
diff changeset
  2216
                self cacheSourceStream:aStream.
7d7ae1e5f589 changed: #annotationAtIndex:
Claus Gittinger <cg@exept.de>
parents: 13660
diff changeset
  2217
            ].
7d7ae1e5f589 changed: #annotationAtIndex:
Claus Gittinger <cg@exept.de>
parents: 13660
diff changeset
  2218
            ^ aStream
7d7ae1e5f589 changed: #annotationAtIndex:
Claus Gittinger <cg@exept.de>
parents: 13660
diff changeset
  2219
        ].
8141
41b25e5f7532 sourceStream access refactored (preps for utf8 decoding)
Claus Gittinger <cg@exept.de>
parents: 8117
diff changeset
  2220
    ].
41b25e5f7532 sourceStream access refactored (preps for utf8 decoding)
Claus Gittinger <cg@exept.de>
parents: 8117
diff changeset
  2221
41b25e5f7532 sourceStream access refactored (preps for utf8 decoding)
Claus Gittinger <cg@exept.de>
parents: 8117
diff changeset
  2222
    (who isNil and:[source notNil]) ifTrue:[
13662
7d7ae1e5f589 changed: #annotationAtIndex:
Claus Gittinger <cg@exept.de>
parents: 13660
diff changeset
  2223
        "/
7d7ae1e5f589 changed: #annotationAtIndex:
Claus Gittinger <cg@exept.de>
parents: 13660
diff changeset
  2224
        "/ mhmh - seems to be a method which used to be in some
7d7ae1e5f589 changed: #annotationAtIndex:
Claus Gittinger <cg@exept.de>
parents: 13660
diff changeset
  2225
        "/ class, but has been overwritten by another or removed.
7d7ae1e5f589 changed: #annotationAtIndex:
Claus Gittinger <cg@exept.de>
parents: 13660
diff changeset
  2226
        "/ (i.e. it has no containing class anyMore)
7d7ae1e5f589 changed: #annotationAtIndex:
Claus Gittinger <cg@exept.de>
parents: 13660
diff changeset
  2227
        "/ try to guess the class from the sourceFileName.
7d7ae1e5f589 changed: #annotationAtIndex:
Claus Gittinger <cg@exept.de>
parents: 13660
diff changeset
  2228
        "/ and retry.
7d7ae1e5f589 changed: #annotationAtIndex:
Claus Gittinger <cg@exept.de>
parents: 13660
diff changeset
  2229
        "/
7d7ae1e5f589 changed: #annotationAtIndex:
Claus Gittinger <cg@exept.de>
parents: 13660
diff changeset
  2230
        className := Smalltalk classNameForFile:source.
7d7ae1e5f589 changed: #annotationAtIndex:
Claus Gittinger <cg@exept.de>
parents: 13660
diff changeset
  2231
        (classNameSymbol := className asSymbolIfInterned) notNil ifTrue:[
7d7ae1e5f589 changed: #annotationAtIndex:
Claus Gittinger <cg@exept.de>
parents: 13660
diff changeset
  2232
            myClass := Smalltalk at:classNameSymbol ifAbsent:nil.
7d7ae1e5f589 changed: #annotationAtIndex:
Claus Gittinger <cg@exept.de>
parents: 13660
diff changeset
  2233
            myClass notNil ifTrue:[
7d7ae1e5f589 changed: #annotationAtIndex:
Claus Gittinger <cg@exept.de>
parents: 13660
diff changeset
  2234
                aStream := myClass sourceStreamFor:source.
7d7ae1e5f589 changed: #annotationAtIndex:
Claus Gittinger <cg@exept.de>
parents: 13660
diff changeset
  2235
                aStream notNil ifTrue:[
7d7ae1e5f589 changed: #annotationAtIndex:
Claus Gittinger <cg@exept.de>
parents: 13660
diff changeset
  2236
                    usingCacheBoolean ifTrue:[
7d7ae1e5f589 changed: #annotationAtIndex:
Claus Gittinger <cg@exept.de>
parents: 13660
diff changeset
  2237
                        self cacheSourceStream:aStream.
7d7ae1e5f589 changed: #annotationAtIndex:
Claus Gittinger <cg@exept.de>
parents: 13660
diff changeset
  2238
                    ].
7d7ae1e5f589 changed: #annotationAtIndex:
Claus Gittinger <cg@exept.de>
parents: 13660
diff changeset
  2239
                    ^ aStream
7d7ae1e5f589 changed: #annotationAtIndex:
Claus Gittinger <cg@exept.de>
parents: 13660
diff changeset
  2240
                ].
7d7ae1e5f589 changed: #annotationAtIndex:
Claus Gittinger <cg@exept.de>
parents: 13660
diff changeset
  2241
            ]
7d7ae1e5f589 changed: #annotationAtIndex:
Claus Gittinger <cg@exept.de>
parents: 13660
diff changeset
  2242
        ]
12854
3a3d3c02c3bd *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 12695
diff changeset
  2243
    ].
8141
41b25e5f7532 sourceStream access refactored (preps for utf8 decoding)
Claus Gittinger <cg@exept.de>
parents: 8117
diff changeset
  2244
41b25e5f7532 sourceStream access refactored (preps for utf8 decoding)
Claus Gittinger <cg@exept.de>
parents: 8117
diff changeset
  2245
    ^ nil
10201
f90568a94903 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10196
diff changeset
  2246
f90568a94903 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10196
diff changeset
  2247
    "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
  2248
!
41b25e5f7532 sourceStream access refactored (preps for utf8 decoding)
Claus Gittinger <cg@exept.de>
parents: 8117
diff changeset
  2249
13422
b43a8a47037c Jan's changes
vrany
parents: 13390
diff changeset
  2250
setLookupObject: lookup
b43a8a47037c Jan's changes
vrany
parents: 13390
diff changeset
  2251
    "set the lookupObject (low level - use lookupObject:)"
b43a8a47037c Jan's changes
vrany
parents: 13390
diff changeset
  2252
14536
db30b9862370 class: Method
Claus Gittinger <cg@exept.de>
parents: 14508
diff changeset
  2253
    lookupObject ~~ lookup ifTrue:[
db30b9862370 class: Method
Claus Gittinger <cg@exept.de>
parents: 14508
diff changeset
  2254
        lookupObject := lookup.
db30b9862370 class: Method
Claus Gittinger <cg@exept.de>
parents: 14508
diff changeset
  2255
        ObjectMemory flushCaches.
db30b9862370 class: Method
Claus Gittinger <cg@exept.de>
parents: 14508
diff changeset
  2256
    ].
13422
b43a8a47037c Jan's changes
vrany
parents: 13390
diff changeset
  2257
b43a8a47037c Jan's changes
vrany
parents: 13390
diff changeset
  2258
    "Created: / 11-07-2010 / 19:31:59 / Jan Vrany <jan.vrany@fit.cvut.cz>"
b43a8a47037c Jan's changes
vrany
parents: 13390
diff changeset
  2259
!
b43a8a47037c Jan's changes
vrany
parents: 13390
diff changeset
  2260
8141
41b25e5f7532 sourceStream access refactored (preps for utf8 decoding)
Claus Gittinger <cg@exept.de>
parents: 8117
diff changeset
  2261
sourceChunkFromStream:aStream
10673
05229646ecd7 #source - handle DecodingError when fetching the method's source
Stefan Vogel <sv@exept.de>
parents: 10608
diff changeset
  2262
    PositionError handle:[:ex |
13662
7d7ae1e5f589 changed: #annotationAtIndex:
Claus Gittinger <cg@exept.de>
parents: 13660
diff changeset
  2263
        ^ nil
8141
41b25e5f7532 sourceStream access refactored (preps for utf8 decoding)
Claus Gittinger <cg@exept.de>
parents: 8117
diff changeset
  2264
    ] do:[
15614
70bf14a15a59 class: Method
Stefan Vogel <sv@exept.de>
parents: 15579
diff changeset
  2265
        aStream position:(sourcePosition ? 1) abs - 1.
8141
41b25e5f7532 sourceStream access refactored (preps for utf8 decoding)
Claus Gittinger <cg@exept.de>
parents: 8117
diff changeset
  2266
    ].
41b25e5f7532 sourceStream access refactored (preps for utf8 decoding)
Claus Gittinger <cg@exept.de>
parents: 8117
diff changeset
  2267
    ^ aStream nextChunk.
41b25e5f7532 sourceStream access refactored (preps for utf8 decoding)
Claus Gittinger <cg@exept.de>
parents: 8117
diff changeset
  2268
!
41b25e5f7532 sourceStream access refactored (preps for utf8 decoding)
Claus Gittinger <cg@exept.de>
parents: 8117
diff changeset
  2269
12682
Stefan Vogel <sv@exept.de>
parents: 12620
diff changeset
  2270
sourceStreamUsingCache:usingCacheBoolean
Stefan Vogel <sv@exept.de>
parents: 12620
diff changeset
  2271
    "return an open sourceStream (needs positioning).
Stefan Vogel <sv@exept.de>
parents: 12620
diff changeset
  2272
     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
  2273
     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
  2274
     if usingCacheBoolean is true."
8141
41b25e5f7532 sourceStream access refactored (preps for utf8 decoding)
Claus Gittinger <cg@exept.de>
parents: 8117
diff changeset
  2275
12695
14b7044c2e4a changed:
Stefan Vogel <sv@exept.de>
parents: 12682
diff changeset
  2276
    |rawStream|
14b7044c2e4a changed:
Stefan Vogel <sv@exept.de>
parents: 12682
diff changeset
  2277
14b7044c2e4a changed:
Stefan Vogel <sv@exept.de>
parents: 12682
diff changeset
  2278
    rawStream := self rawSourceStreamUsingCache:usingCacheBoolean.
14b7044c2e4a changed:
Stefan Vogel <sv@exept.de>
parents: 12682
diff changeset
  2279
    rawStream isNil ifTrue:[
13662
7d7ae1e5f589 changed: #annotationAtIndex:
Claus Gittinger <cg@exept.de>
parents: 13660
diff changeset
  2280
        ^ nil.
8141
41b25e5f7532 sourceStream access refactored (preps for utf8 decoding)
Claus Gittinger <cg@exept.de>
parents: 8117
diff changeset
  2281
    ].
14090
bb45ad9b6aab changed: #sourceStreamUsingCache:
Stefan Vogel <sv@exept.de>
parents: 14047
diff changeset
  2282
    rawStream position:0.
12695
14b7044c2e4a changed:
Stefan Vogel <sv@exept.de>
parents: 12682
diff changeset
  2283
14b7044c2e4a changed:
Stefan Vogel <sv@exept.de>
parents: 12682
diff changeset
  2284
    "/ see if its utf8 encoded...
14b7044c2e4a changed:
Stefan Vogel <sv@exept.de>
parents: 12682
diff changeset
  2285
    ^ EncodedStream decodedStreamFor:rawStream.
8141
41b25e5f7532 sourceStream access refactored (preps for utf8 decoding)
Claus Gittinger <cg@exept.de>
parents: 8117
diff changeset
  2286
! !
41b25e5f7532 sourceStream access refactored (preps for utf8 decoding)
Claus Gittinger <cg@exept.de>
parents: 8117
diff changeset
  2287
1093
1e742016eea0 category rename / added access to RESOURCE and CALLED flags
Claus Gittinger <cg@exept.de>
parents: 1087
diff changeset
  2288
!Method methodsFor:'private-compiler interface'!
1e742016eea0 category rename / added access to RESOURCE and CALLED flags
Claus Gittinger <cg@exept.de>
parents: 1087
diff changeset
  2289
5405
f07c8045ab4e *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5398
diff changeset
  2290
primitiveNumber
f07c8045ab4e *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5398
diff changeset
  2291
    "for stx rel >= 5.x only:
f07c8045ab4e *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5398
diff changeset
  2292
     return the primitive number."
f07c8045ab4e *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5398
diff changeset
  2293
f07c8045ab4e *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5398
diff changeset
  2294
%{  /* NOCONTEXT */
f07c8045ab4e *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5398
diff changeset
  2295
f07c8045ab4e *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5398
diff changeset
  2296
#ifdef F_PRIMITIVE
f07c8045ab4e *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5398
diff changeset
  2297
    INT f = __intVal(__INST(flags));
6014
14acbd7c25d4 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6006
diff changeset
  2298
    OBJ nr = 0;
5405
f07c8045ab4e *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5398
diff changeset
  2299
f07c8045ab4e *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5398
diff changeset
  2300
    if (f & F_PRIMITIVE) {
13662
7d7ae1e5f589 changed: #annotationAtIndex:
Claus Gittinger <cg@exept.de>
parents: 13660
diff changeset
  2301
        nr = __INST(code_);
5405
f07c8045ab4e *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5398
diff changeset
  2302
    }
f07c8045ab4e *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5398
diff changeset
  2303
    RETURN (nr);
f07c8045ab4e *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5398
diff changeset
  2304
#endif
f07c8045ab4e *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5398
diff changeset
  2305
%}.
f07c8045ab4e *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5398
diff changeset
  2306
    self primitiveFailed
f07c8045ab4e *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5398
diff changeset
  2307
!
f07c8045ab4e *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5398
diff changeset
  2308
f07c8045ab4e *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5398
diff changeset
  2309
setPrimitiveNumber:aNumber
f07c8045ab4e *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5398
diff changeset
  2310
    "for stx rel >= 5.x only:
f07c8045ab4e *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5398
diff changeset
  2311
     mark the method as having primitive code."
f07c8045ab4e *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5398
diff changeset
  2312
f07c8045ab4e *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5398
diff changeset
  2313
%{  /* NOCONTEXT */
f07c8045ab4e *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5398
diff changeset
  2314
f07c8045ab4e *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5398
diff changeset
  2315
#ifdef F_PRIMITIVE
f07c8045ab4e *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5398
diff changeset
  2316
    INT f = __intVal(__INST(flags));
f07c8045ab4e *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5398
diff changeset
  2317
f07c8045ab4e *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5398
diff changeset
  2318
    f |= F_PRIMITIVE;
8913
b9498d27a554 64bit; mkSmallInteger
Claus Gittinger <cg@exept.de>
parents: 8896
diff changeset
  2319
    __INST(flags) = __mkSmallInteger(f);
5405
f07c8045ab4e *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5398
diff changeset
  2320
    __INST(code_) = aNumber;
f07c8045ab4e *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5398
diff changeset
  2321
    RETURN (self);
f07c8045ab4e *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5398
diff changeset
  2322
#endif
f07c8045ab4e *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5398
diff changeset
  2323
%}.
f07c8045ab4e *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5398
diff changeset
  2324
    self primitiveFailed
f07c8045ab4e *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5398
diff changeset
  2325
f07c8045ab4e *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5398
diff changeset
  2326
f07c8045ab4e *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5398
diff changeset
  2327
f07c8045ab4e *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5398
diff changeset
  2328
!
f07c8045ab4e *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5398
diff changeset
  2329
1093
1e742016eea0 category rename / added access to RESOURCE and CALLED flags
Claus Gittinger <cg@exept.de>
parents: 1087
diff changeset
  2330
setResourceFlag
1e742016eea0 category rename / added access to RESOURCE and CALLED flags
Claus Gittinger <cg@exept.de>
parents: 1087
diff changeset
  2331
    "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
  2332
     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
  2333
1e742016eea0 category rename / added access to RESOURCE and CALLED flags
Claus Gittinger <cg@exept.de>
parents: 1087
diff changeset
  2334
%{  /* NOCONTEXT */
1e742016eea0 category rename / added access to RESOURCE and CALLED flags
Claus Gittinger <cg@exept.de>
parents: 1087
diff changeset
  2335
1e742016eea0 category rename / added access to RESOURCE and CALLED flags
Claus Gittinger <cg@exept.de>
parents: 1087
diff changeset
  2336
#ifdef F_RESOURCE
2868
772c890f907c alpha64
Claus Gittinger <cg@exept.de>
parents: 2826
diff changeset
  2337
    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
  2338
1e742016eea0 category rename / added access to RESOURCE and CALLED flags
Claus Gittinger <cg@exept.de>
parents: 1087
diff changeset
  2339
    f |= F_RESOURCE;
8913
b9498d27a554 64bit; mkSmallInteger
Claus Gittinger <cg@exept.de>
parents: 8896
diff changeset
  2340
    __INST(flags) = __mkSmallInteger(f);
1093
1e742016eea0 category rename / added access to RESOURCE and CALLED flags
Claus Gittinger <cg@exept.de>
parents: 1087
diff changeset
  2341
#endif
1e742016eea0 category rename / added access to RESOURCE and CALLED flags
Claus Gittinger <cg@exept.de>
parents: 1087
diff changeset
  2342
%}
1e742016eea0 category rename / added access to RESOURCE and CALLED flags
Claus Gittinger <cg@exept.de>
parents: 1087
diff changeset
  2343
! !
1e742016eea0 category rename / added access to RESOURCE and CALLED flags
Claus Gittinger <cg@exept.de>
parents: 1087
diff changeset
  2344
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
  2345
!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
  2346
2702
5d6f23d8ee18 more ST80 queries
Claus Gittinger <cg@exept.de>
parents: 2695
diff changeset
  2347
accessedInstVars
5d6f23d8ee18 more ST80 queries
Claus Gittinger <cg@exept.de>
parents: 2695
diff changeset
  2348
    "return a collection of instVarNames, which are accessed by
5d6f23d8ee18 more ST80 queries
Claus Gittinger <cg@exept.de>
parents: 2695
diff changeset
  2349
     the receiver method"
5d6f23d8ee18 more ST80 queries
Claus Gittinger <cg@exept.de>
parents: 2695
diff changeset
  2350
5d6f23d8ee18 more ST80 queries
Claus Gittinger <cg@exept.de>
parents: 2695
diff changeset
  2351
    |src parser|
5d6f23d8ee18 more ST80 queries
Claus Gittinger <cg@exept.de>
parents: 2695
diff changeset
  2352
5d6f23d8ee18 more ST80 queries
Claus Gittinger <cg@exept.de>
parents: 2695
diff changeset
  2353
    src := self source.
5d6f23d8ee18 more ST80 queries
Claus Gittinger <cg@exept.de>
parents: 2695
diff changeset
  2354
    src notNil ifTrue:[
13662
7d7ae1e5f589 changed: #annotationAtIndex:
Claus Gittinger <cg@exept.de>
parents: 13660
diff changeset
  2355
        parser := Parser
7d7ae1e5f589 changed: #annotationAtIndex:
Claus Gittinger <cg@exept.de>
parents: 13660
diff changeset
  2356
                        parseMethod:src
7d7ae1e5f589 changed: #annotationAtIndex:
Claus Gittinger <cg@exept.de>
parents: 13660
diff changeset
  2357
                        in:self containingClass
7d7ae1e5f589 changed: #annotationAtIndex:
Claus Gittinger <cg@exept.de>
parents: 13660
diff changeset
  2358
                        ignoreErrors:true
7d7ae1e5f589 changed: #annotationAtIndex:
Claus Gittinger <cg@exept.de>
parents: 13660
diff changeset
  2359
                        ignoreWarnings:true.
7d7ae1e5f589 changed: #annotationAtIndex:
Claus Gittinger <cg@exept.de>
parents: 13660
diff changeset
  2360
7d7ae1e5f589 changed: #annotationAtIndex:
Claus Gittinger <cg@exept.de>
parents: 13660
diff changeset
  2361
        (parser notNil and:[parser ~~ #Error]) ifTrue:[
7d7ae1e5f589 changed: #annotationAtIndex:
Claus Gittinger <cg@exept.de>
parents: 13660
diff changeset
  2362
            ^ parser usedInstVars
7d7ae1e5f589 changed: #annotationAtIndex:
Claus Gittinger <cg@exept.de>
parents: 13660
diff changeset
  2363
        ].
2702
5d6f23d8ee18 more ST80 queries
Claus Gittinger <cg@exept.de>
parents: 2695
diff changeset
  2364
    ].
5d6f23d8ee18 more ST80 queries
Claus Gittinger <cg@exept.de>
parents: 2695
diff changeset
  2365
    ^ #() "/ actually: unknown
5d6f23d8ee18 more ST80 queries
Claus Gittinger <cg@exept.de>
parents: 2695
diff changeset
  2366
5d6f23d8ee18 more ST80 queries
Claus Gittinger <cg@exept.de>
parents: 2695
diff changeset
  2367
    "Modified: 19.6.1997 / 17:54:09 / cg"
5d6f23d8ee18 more ST80 queries
Claus Gittinger <cg@exept.de>
parents: 2695
diff changeset
  2368
!
5d6f23d8ee18 more ST80 queries
Claus Gittinger <cg@exept.de>
parents: 2695
diff changeset
  2369
14237
Claus Gittinger <cg@exept.de>
parents: 14236
diff changeset
  2370
accessesField:instVarIndex
Claus Gittinger <cg@exept.de>
parents: 14236
diff changeset
  2371
    "return true, if the instvar at instVarIndex is accessed by the receiver.
Claus Gittinger <cg@exept.de>
parents: 14236
diff changeset
  2372
     Uses parser (for now); could look at bytecode as well here..."
Claus Gittinger <cg@exept.de>
parents: 14236
diff changeset
  2373
Claus Gittinger <cg@exept.de>
parents: 14236
diff changeset
  2374
    |instVarName|
Claus Gittinger <cg@exept.de>
parents: 14236
diff changeset
  2375
Claus Gittinger <cg@exept.de>
parents: 14236
diff changeset
  2376
    instVarName := (self mclass allInstVarNames) at:instVarIndex.
Claus Gittinger <cg@exept.de>
parents: 14236
diff changeset
  2377
    ^ self accessesInstVar:instVarName
Claus Gittinger <cg@exept.de>
parents: 14236
diff changeset
  2378
Claus Gittinger <cg@exept.de>
parents: 14236
diff changeset
  2379
    "Created: / 23-07-2012 / 11:13:54 / cg"
Claus Gittinger <cg@exept.de>
parents: 14236
diff changeset
  2380
!
Claus Gittinger <cg@exept.de>
parents: 14236
diff changeset
  2381
Claus Gittinger <cg@exept.de>
parents: 14236
diff changeset
  2382
accessesInstVar:instVarName
Claus Gittinger <cg@exept.de>
parents: 14236
diff changeset
  2383
    "return true, if the named instvar is accessed by the receiver.
Claus Gittinger <cg@exept.de>
parents: 14236
diff changeset
  2384
     Uses parser (for now); could look at bytecode as well here..."
Claus Gittinger <cg@exept.de>
parents: 14236
diff changeset
  2385
Claus Gittinger <cg@exept.de>
parents: 14236
diff changeset
  2386
    |usedInstVars|
Claus Gittinger <cg@exept.de>
parents: 14236
diff changeset
  2387
Claus Gittinger <cg@exept.de>
parents: 14236
diff changeset
  2388
    (self source includesString:instVarName) ifFalse:[^ false].     "/ that's much faster than parsing...
Claus Gittinger <cg@exept.de>
parents: 14236
diff changeset
  2389
    usedInstVars := self parse:#'parseMethodSilent:in:' with:self mclass  return:#usedInstVars or:#().
Claus Gittinger <cg@exept.de>
parents: 14236
diff changeset
  2390
    ^ usedInstVars includes:instVarName.
Claus Gittinger <cg@exept.de>
parents: 14236
diff changeset
  2391
Claus Gittinger <cg@exept.de>
parents: 14236
diff changeset
  2392
    "Created: / 23-07-2012 / 11:15:02 / cg"
Claus Gittinger <cg@exept.de>
parents: 14236
diff changeset
  2393
!
Claus Gittinger <cg@exept.de>
parents: 14236
diff changeset
  2394
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
  2395
containingClass
12854
3a3d3c02c3bd *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 12695
diff changeset
  2396
    "return the class I am defined in.
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
  2397
     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
  2398
d600e08a5936 handle the case where a method has a sourceFileInfo, but the class has not
Claus Gittinger <cg@exept.de>
parents: 934
diff changeset
  2399
    "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
  2400
1851
4accc9fafd19 change #who to return a proper object
Claus Gittinger <cg@exept.de>
parents: 1813
diff changeset
  2401
    |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
  2402
5704
aeeece3a93ef flush mclass, if no longer valid
Claus Gittinger <cg@exept.de>
parents: 5700
diff changeset
  2403
    mclass notNil ifTrue:[
14508
859dca6352f8 class: Method
Claus Gittinger <cg@exept.de>
parents: 14505
diff changeset
  2404
        "/ check if this (cached) info is still valid...
13662
7d7ae1e5f589 changed: #annotationAtIndex:
Claus Gittinger <cg@exept.de>
parents: 13660
diff changeset
  2405
        (mclass containsMethod:self) ifTrue:[
7d7ae1e5f589 changed: #annotationAtIndex:
Claus Gittinger <cg@exept.de>
parents: 13660
diff changeset
  2406
            ^ mclass
7d7ae1e5f589 changed: #annotationAtIndex:
Claus Gittinger <cg@exept.de>
parents: 13660
diff changeset
  2407
        ].
7d7ae1e5f589 changed: #annotationAtIndex:
Claus Gittinger <cg@exept.de>
parents: 13660
diff changeset
  2408
        mclass := nil.
5704
aeeece3a93ef flush mclass, if no longer valid
Claus Gittinger <cg@exept.de>
parents: 5700
diff changeset
  2409
    ].
5324
5c9959ce98af make use of mclass
Claus Gittinger <cg@exept.de>
parents: 5322
diff changeset
  2410
1851
4accc9fafd19 change #who to return a proper object
Claus Gittinger <cg@exept.de>
parents: 1813
diff changeset
  2411
    who := self who.
4accc9fafd19 change #who to return a proper object
Claus Gittinger <cg@exept.de>
parents: 1813
diff changeset
  2412
    who notNil ifTrue:[^ who methodClass].
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
  2413
    "
d600e08a5936 handle the case where a method has a sourceFileInfo, but the class has not
Claus Gittinger <cg@exept.de>
parents: 934
diff changeset
  2414
     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
  2415
    "
d600e08a5936 handle the case where a method has a sourceFileInfo, but the class has not
Claus Gittinger <cg@exept.de>
parents: 934
diff changeset
  2416
    ^ 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
  2417
d600e08a5936 handle the case where a method has a sourceFileInfo, but the class has not
Claus Gittinger <cg@exept.de>
parents: 934
diff changeset
  2418
    "
12854
3a3d3c02c3bd *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 12695
diff changeset
  2419
     (Object compiledMethodAt:#at:) containingClass
3a3d3c02c3bd *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 12695
diff changeset
  2420
3a3d3c02c3bd *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 12695
diff changeset
  2421
     (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
  2422
    "
d600e08a5936 handle the case where a method has a sourceFileInfo, but the class has not
Claus Gittinger <cg@exept.de>
parents: 934
diff changeset
  2423
!
d600e08a5936 handle the case where a method has a sourceFileInfo, but the class has not
Claus Gittinger <cg@exept.de>
parents: 934
diff changeset
  2424
10482
11b634beb199 +ole queries
fm
parents: 10375
diff changeset
  2425
externalLibraryFunction
11b634beb199 +ole queries
fm
parents: 10375
diff changeset
  2426
    "if this is an externalLibraryFunction call, return the externalLibraryFunction.
11b634beb199 +ole queries
fm
parents: 10375
diff changeset
  2427
     Returns nil otherwise."
11b634beb199 +ole queries
fm
parents: 10375
diff changeset
  2428
13189
96fe3d9e3f3a changed: #externalLibraryFunction
Claus Gittinger <cg@exept.de>
parents: 13156
diff changeset
  2429
    |newMethod function|
96fe3d9e3f3a changed: #externalLibraryFunction
Claus Gittinger <cg@exept.de>
parents: 13156
diff changeset
  2430
13463
7c98583d98c8 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 13422
diff changeset
  2431
    (self
13662
7d7ae1e5f589 changed: #annotationAtIndex:
Claus Gittinger <cg@exept.de>
parents: 13660
diff changeset
  2432
        literalsDetect:[:lit |
7d7ae1e5f589 changed: #annotationAtIndex:
Claus Gittinger <cg@exept.de>
parents: 13660
diff changeset
  2433
            #(
7d7ae1e5f589 changed: #annotationAtIndex:
Claus Gittinger <cg@exept.de>
parents: 13660
diff changeset
  2434
                #'invoke'
7d7ae1e5f589 changed: #annotationAtIndex:
Claus Gittinger <cg@exept.de>
parents: 13660
diff changeset
  2435
                #'invokeWith:'
7d7ae1e5f589 changed: #annotationAtIndex:
Claus Gittinger <cg@exept.de>
parents: 13660
diff changeset
  2436
                #'invokeWith:with:'
7d7ae1e5f589 changed: #annotationAtIndex:
Claus Gittinger <cg@exept.de>
parents: 13660
diff changeset
  2437
                #'invokeWith:with:with:'
7d7ae1e5f589 changed: #annotationAtIndex:
Claus Gittinger <cg@exept.de>
parents: 13660
diff changeset
  2438
                #'invokeWith:with:with:with:'
7d7ae1e5f589 changed: #annotationAtIndex:
Claus Gittinger <cg@exept.de>
parents: 13660
diff changeset
  2439
                #'invokeWithArguments:'
7d7ae1e5f589 changed: #annotationAtIndex:
Claus Gittinger <cg@exept.de>
parents: 13660
diff changeset
  2440
                #'invokeCPPVirtualOn:'
7d7ae1e5f589 changed: #annotationAtIndex:
Claus Gittinger <cg@exept.de>
parents: 13660
diff changeset
  2441
                #'invokeCPPVirtualOn:with:'
7d7ae1e5f589 changed: #annotationAtIndex:
Claus Gittinger <cg@exept.de>
parents: 13660
diff changeset
  2442
                #'invokeCPPVirtualOn:with:with:'
7d7ae1e5f589 changed: #annotationAtIndex:
Claus Gittinger <cg@exept.de>
parents: 13660
diff changeset
  2443
                #'invokeCPPVirtualOn:with:with:with:'
7d7ae1e5f589 changed: #annotationAtIndex:
Claus Gittinger <cg@exept.de>
parents: 13660
diff changeset
  2444
                #'invokeCPPVirtualOn:with:with:with:with:'
7d7ae1e5f589 changed: #annotationAtIndex:
Claus Gittinger <cg@exept.de>
parents: 13660
diff changeset
  2445
                #'invokeCPPVirtualOn:withArguments:'
7d7ae1e5f589 changed: #annotationAtIndex:
Claus Gittinger <cg@exept.de>
parents: 13660
diff changeset
  2446
            ) includes:lit
7d7ae1e5f589 changed: #annotationAtIndex:
Claus Gittinger <cg@exept.de>
parents: 13660
diff changeset
  2447
        ]
7d7ae1e5f589 changed: #annotationAtIndex:
Claus Gittinger <cg@exept.de>
parents: 13660
diff changeset
  2448
        ifNone:nil) notNil
13189
96fe3d9e3f3a changed: #externalLibraryFunction
Claus Gittinger <cg@exept.de>
parents: 13156
diff changeset
  2449
    ifTrue:[
13662
7d7ae1e5f589 changed: #annotationAtIndex:
Claus Gittinger <cg@exept.de>
parents: 13660
diff changeset
  2450
        "/ sigh - for stc-compiled code, this does not work:
7d7ae1e5f589 changed: #annotationAtIndex:
Claus Gittinger <cg@exept.de>
parents: 13660
diff changeset
  2451
        function := self literalsDetect:[:lit | lit isExternalLibraryFunction] ifNone:nil.
7d7ae1e5f589 changed: #annotationAtIndex:
Claus Gittinger <cg@exept.de>
parents: 13660
diff changeset
  2452
        function isNil ifTrue:[
7d7ae1e5f589 changed: #annotationAtIndex:
Claus Gittinger <cg@exept.de>
parents: 13660
diff changeset
  2453
            "/ parse it and ask the parser
7d7ae1e5f589 changed: #annotationAtIndex:
Claus Gittinger <cg@exept.de>
parents: 13660
diff changeset
  2454
            newMethod := Compiler compile:self source forClass:self mclass install:false.
7d7ae1e5f589 changed: #annotationAtIndex:
Claus Gittinger <cg@exept.de>
parents: 13660
diff changeset
  2455
            function := newMethod literalsDetect:[:lit | lit isExternalLibraryFunction] ifNone:nil.
7d7ae1e5f589 changed: #annotationAtIndex:
Claus Gittinger <cg@exept.de>
parents: 13660
diff changeset
  2456
        ].
7d7ae1e5f589 changed: #annotationAtIndex:
Claus Gittinger <cg@exept.de>
parents: 13660
diff changeset
  2457
        ^ function
13189
96fe3d9e3f3a changed: #externalLibraryFunction
Claus Gittinger <cg@exept.de>
parents: 13156
diff changeset
  2458
    ].
96fe3d9e3f3a changed: #externalLibraryFunction
Claus Gittinger <cg@exept.de>
parents: 13156
diff changeset
  2459
    ^ nil
96fe3d9e3f3a changed: #externalLibraryFunction
Claus Gittinger <cg@exept.de>
parents: 13156
diff changeset
  2460
96fe3d9e3f3a changed: #externalLibraryFunction
Claus Gittinger <cg@exept.de>
parents: 13156
diff changeset
  2461
    "
96fe3d9e3f3a changed: #externalLibraryFunction
Claus Gittinger <cg@exept.de>
parents: 13156
diff changeset
  2462
     (IDispatchPointer compiledMethodAt:#'invokeGetTypeInfo:_:_:')
13662
7d7ae1e5f589 changed: #annotationAtIndex:
Claus Gittinger <cg@exept.de>
parents: 13660
diff changeset
  2463
        externalLibraryFunction
13189
96fe3d9e3f3a changed: #externalLibraryFunction
Claus Gittinger <cg@exept.de>
parents: 13156
diff changeset
  2464
    "
10482
11b634beb199 +ole queries
fm
parents: 10375
diff changeset
  2465
!
11b634beb199 +ole queries
fm
parents: 10375
diff changeset
  2466
13422
b43a8a47037c Jan's changes
vrany
parents: 13390
diff changeset
  2467
hasAnnotation
14253
Claus Gittinger <cg@exept.de>
parents: 14251
diff changeset
  2468
    "Return true iff the method has any annotation"
13422
b43a8a47037c Jan's changes
vrany
parents: 13390
diff changeset
  2469
b43a8a47037c Jan's changes
vrany
parents: 13390
diff changeset
  2470
    ^annotations notNil
b43a8a47037c Jan's changes
vrany
parents: 13390
diff changeset
  2471
b43a8a47037c Jan's changes
vrany
parents: 13390
diff changeset
  2472
    "Created: / 11-07-2010 / 19:27:10 / Jan Vrany <jan.vrany@fit.cvut.cz>"
14253
Claus Gittinger <cg@exept.de>
parents: 14251
diff changeset
  2473
    "Modified (comment): / 26-07-2012 / 15:49:59 / cg"
13422
b43a8a47037c Jan's changes
vrany
parents: 13390
diff changeset
  2474
!
b43a8a47037c Jan's changes
vrany
parents: 13390
diff changeset
  2475
b43a8a47037c Jan's changes
vrany
parents: 13390
diff changeset
  2476
hasAnnotation: key
14253
Claus Gittinger <cg@exept.de>
parents: 14251
diff changeset
  2477
    "Return true iff the method is annotated with the given key"
13422
b43a8a47037c Jan's changes
vrany
parents: 13390
diff changeset
  2478
b43a8a47037c Jan's changes
vrany
parents: 13390
diff changeset
  2479
    ^(self annotationIndexOf: key) notNil
b43a8a47037c Jan's changes
vrany
parents: 13390
diff changeset
  2480
b43a8a47037c Jan's changes
vrany
parents: 13390
diff changeset
  2481
    "Created: / 11-07-2010 / 19:28:00 / Jan Vrany <jan.vrany@fit.cvut.cz>"
14253
Claus Gittinger <cg@exept.de>
parents: 14251
diff changeset
  2482
    "Modified (comment): / 26-07-2012 / 15:49:54 / cg"
13422
b43a8a47037c Jan's changes
vrany
parents: 13390
diff changeset
  2483
!
b43a8a47037c Jan's changes
vrany
parents: 13390
diff changeset
  2484
12913
142c9566a768 added: #hasAnyResource:
Claus Gittinger <cg@exept.de>
parents: 12900
diff changeset
  2485
hasAnyResource:aCollectionOfSymbols
142c9566a768 added: #hasAnyResource:
Claus Gittinger <cg@exept.de>
parents: 12900
diff changeset
  2486
    "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
  2487
142c9566a768 added: #hasAnyResource:
Claus Gittinger <cg@exept.de>
parents: 12900
diff changeset
  2488
    ^ self hasResource and:[ self resources keys includesAny:aCollectionOfSymbols ]
142c9566a768 added: #hasAnyResource:
Claus Gittinger <cg@exept.de>
parents: 12900
diff changeset
  2489
142c9566a768 added: #hasAnyResource:
Claus Gittinger <cg@exept.de>
parents: 12900
diff changeset
  2490
    "
142c9566a768 added: #hasAnyResource:
Claus Gittinger <cg@exept.de>
parents: 12900
diff changeset
  2491
     Method allInstancesDo:[:m |
13662
7d7ae1e5f589 changed: #annotationAtIndex:
Claus Gittinger <cg@exept.de>
parents: 13660
diff changeset
  2492
        (m hasAnyResource:#(image canvas)) ifTrue:[self halt]
12913
142c9566a768 added: #hasAnyResource:
Claus Gittinger <cg@exept.de>
parents: 12900
diff changeset
  2493
     ].
142c9566a768 added: #hasAnyResource:
Claus Gittinger <cg@exept.de>
parents: 12900
diff changeset
  2494
    "
142c9566a768 added: #hasAnyResource:
Claus Gittinger <cg@exept.de>
parents: 12900
diff changeset
  2495
!
142c9566a768 added: #hasAnyResource:
Claus Gittinger <cg@exept.de>
parents: 12900
diff changeset
  2496
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
  2497
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
  2498
    "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
  2499
     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
  2500
d600e08a5936 handle the case where a method has a sourceFileInfo, but the class has not
Claus Gittinger <cg@exept.de>
parents: 934
diff changeset
  2501
    |src|
159
514c749165c3 *** empty log message ***
claus
parents: 142
diff changeset
  2502
2218
93c4cb83372a comment
Claus Gittinger <cg@exept.de>
parents: 2201
diff changeset
  2503
    "/ first a trivial reject, if the source does not
5534
bf00d9a2dfd5 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5530
diff changeset
  2504
    "/ contain a '% {' sequence
2218
93c4cb83372a comment
Claus Gittinger <cg@exept.de>
parents: 2201
diff changeset
  2505
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
  2506
    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
  2507
    src notNil ifTrue:[
13662
7d7ae1e5f589 changed: #annotationAtIndex:
Claus Gittinger <cg@exept.de>
parents: 13660
diff changeset
  2508
        (src includesString:(String with:$% with:${) "<- no constant here - to avoid trouble with stupid scanners" ) ifFalse:[
7d7ae1e5f589 changed: #annotationAtIndex:
Claus Gittinger <cg@exept.de>
parents: 13660
diff changeset
  2509
            "/ cannot contain primitive code.
7d7ae1e5f589 changed: #annotationAtIndex:
Claus Gittinger <cg@exept.de>
parents: 13660
diff changeset
  2510
            ^ false
7d7ae1e5f589 changed: #annotationAtIndex:
Claus Gittinger <cg@exept.de>
parents: 13660
diff changeset
  2511
        ]
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
  2512
    ].
2218
93c4cb83372a comment
Claus Gittinger <cg@exept.de>
parents: 2201
diff changeset
  2513
93c4cb83372a comment
Claus Gittinger <cg@exept.de>
parents: 2201
diff changeset
  2514
    "/ ok; it may or may not ...
93c4cb83372a comment
Claus Gittinger <cg@exept.de>
parents: 2201
diff changeset
  2515
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
  2516
    ^ 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
  2517
d600e08a5936 handle the case where a method has a sourceFileInfo, but the class has not
Claus Gittinger <cg@exept.de>
parents: 934
diff changeset
  2518
    "
12854
3a3d3c02c3bd *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 12695
diff changeset
  2519
     (Method compiledMethodAt:#hasPrimitiveCode) hasPrimitiveCode
3a3d3c02c3bd *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 12695
diff changeset
  2520
     (Object compiledMethodAt:#at:) hasPrimitiveCode
3a3d3c02c3bd *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 12695
diff changeset
  2521
     (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
  2522
    "
159
514c749165c3 *** empty log message ***
claus
parents: 142
diff changeset
  2523
2218
93c4cb83372a comment
Claus Gittinger <cg@exept.de>
parents: 2201
diff changeset
  2524
    "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
  2525
!
d600e08a5936 handle the case where a method has a sourceFileInfo, but the class has not
Claus Gittinger <cg@exept.de>
parents: 934
diff changeset
  2526
1093
1e742016eea0 category rename / added access to RESOURCE and CALLED flags
Claus Gittinger <cg@exept.de>
parents: 1087
diff changeset
  2527
hasResource
1e742016eea0 category rename / added access to RESOURCE and CALLED flags
Claus Gittinger <cg@exept.de>
parents: 1087
diff changeset
  2528
    "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
  2529
     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
  2530
1e742016eea0 category rename / added access to RESOURCE and CALLED flags
Claus Gittinger <cg@exept.de>
parents: 1087
diff changeset
  2531
%{  /* NOCONTEXT */
1e742016eea0 category rename / added access to RESOURCE and CALLED flags
Claus Gittinger <cg@exept.de>
parents: 1087
diff changeset
  2532
1e742016eea0 category rename / added access to RESOURCE and CALLED flags
Claus Gittinger <cg@exept.de>
parents: 1087
diff changeset
  2533
#ifdef F_RESOURCE
1133
961f2b095c22 underline cleanup
Claus Gittinger <cg@exept.de>
parents: 1103
diff changeset
  2534
    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
  2535
#endif
1e742016eea0 category rename / added access to RESOURCE and CALLED flags
Claus Gittinger <cg@exept.de>
parents: 1087
diff changeset
  2536
%}.
1e742016eea0 category rename / added access to RESOURCE and CALLED flags
Claus Gittinger <cg@exept.de>
parents: 1087
diff changeset
  2537
    ^ false
1e742016eea0 category rename / added access to RESOURCE and CALLED flags
Claus Gittinger <cg@exept.de>
parents: 1087
diff changeset
  2538
!
1e742016eea0 category rename / added access to RESOURCE and CALLED flags
Claus Gittinger <cg@exept.de>
parents: 1087
diff changeset
  2539
10482
11b634beb199 +ole queries
fm
parents: 10375
diff changeset
  2540
indexOfOLECall
14357
08d5b662477a comment/format in: #indexOfOLECall
Claus Gittinger <cg@exept.de>
parents: 14274
diff changeset
  2541
    "return the vtable inedx, if the method contains an ole call; nil if not.
10482
11b634beb199 +ole queries
fm
parents: 10375
diff changeset
  2542
     Uses Parser to parse methods source and get the information."
11b634beb199 +ole queries
fm
parents: 10375
diff changeset
  2543
11b634beb199 +ole queries
fm
parents: 10375
diff changeset
  2544
    |funcOrNil|
11b634beb199 +ole queries
fm
parents: 10375
diff changeset
  2545
11b634beb199 +ole queries
fm
parents: 10375
diff changeset
  2546
    funcOrNil := self externalLibraryFunction.
11b634beb199 +ole queries
fm
parents: 10375
diff changeset
  2547
    (funcOrNil isNil or:[funcOrNil isCallTypeOLE not]) ifTrue:[^ nil].
11b634beb199 +ole queries
fm
parents: 10375
diff changeset
  2548
    ^ funcOrNil vtableIndex
11b634beb199 +ole queries
fm
parents: 10375
diff changeset
  2549
11b634beb199 +ole queries
fm
parents: 10375
diff changeset
  2550
    "
12854
3a3d3c02c3bd *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 12695
diff changeset
  2551
     (Method compiledMethodAt:#hasPrimitiveCode) isOLECall
3a3d3c02c3bd *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 12695
diff changeset
  2552
     (Method compiledMethodAt:#hasPrimitiveCode) indexOfOLECall
3a3d3c02c3bd *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 12695
diff changeset
  2553
3a3d3c02c3bd *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 12695
diff changeset
  2554
     (Win32OperatingSystem class compiledMethodAt:#primClosePrinter:) isOLECall
3a3d3c02c3bd *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 12695
diff changeset
  2555
     (Win32OperatingSystem class compiledMethodAt:#primClosePrinter:) indexOfOLECall
3a3d3c02c3bd *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 12695
diff changeset
  2556
     (Win32OperatingSystem class compiledMethodAt:#primClosePrinter:) isExternalLibraryFunctionCall
3a3d3c02c3bd *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 12695
diff changeset
  2557
     (Win32OperatingSystem class compiledMethodAt:#primClosePrinter:) externalLibraryFunctionCall
3a3d3c02c3bd *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 12695
diff changeset
  2558
3a3d3c02c3bd *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 12695
diff changeset
  2559
     (IUnknownPointer compiledMethodAt:#invokeAddRef) isExternalLibraryFunctionCall
3a3d3c02c3bd *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 12695
diff changeset
  2560
     (IUnknownPointer compiledMethodAt:#invokeAddRef) externalLibraryFunction
3a3d3c02c3bd *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 12695
diff changeset
  2561
     (IUnknownPointer compiledMethodAt:#invokeAddRef) isOLECall
3a3d3c02c3bd *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 12695
diff changeset
  2562
     (IUnknownPointer compiledMethodAt:#invokeAddRef) indexOfOLECall
10482
11b634beb199 +ole queries
fm
parents: 10375
diff changeset
  2563
    "
14357
08d5b662477a comment/format in: #indexOfOLECall
Claus Gittinger <cg@exept.de>
parents: 14274
diff changeset
  2564
08d5b662477a comment/format in: #indexOfOLECall
Claus Gittinger <cg@exept.de>
parents: 14274
diff changeset
  2565
    "Modified (comment): / 25-09-2012 / 12:01:32 / cg"
10482
11b634beb199 +ole queries
fm
parents: 10375
diff changeset
  2566
!
11b634beb199 +ole queries
fm
parents: 10375
diff changeset
  2567
11986
3f2738b9e2c3 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 11985
diff changeset
  2568
isDocumentationMethod
11987
05e30e073541 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 11986
diff changeset
  2569
    "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
  2570
     (implies being a metaclass method)"
11986
3f2738b9e2c3 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 11985
diff changeset
  2571
12275
8ca2aabefa4e changed: #isDocumentationMethod
Claus Gittinger <cg@exept.de>
parents: 12216
diff changeset
  2572
    self mclass isMeta ifFalse:[^ false].
12283
54b6f67bcc26 changed: #isDocumentationMethod
Claus Gittinger <cg@exept.de>
parents: 12275
diff changeset
  2573
    self isVersionMethod ifTrue:[^ false].
12159
1768c0019100 compiler interface
fm
parents: 12017
diff changeset
  2574
    ^ self parse:#'parseMethodSilent:' return:#isEmptyMethod or:false.
11986
3f2738b9e2c3 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 11985
diff changeset
  2575
!
3f2738b9e2c3 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 11985
diff changeset
  2576
13639
01a74c51c29a added: #isExtension
Claus Gittinger <cg@exept.de>
parents: 13638
diff changeset
  2577
isExtension
01a74c51c29a added: #isExtension
Claus Gittinger <cg@exept.de>
parents: 13638
diff changeset
  2578
    "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
  2579
01a74c51c29a added: #isExtension
Claus Gittinger <cg@exept.de>
parents: 13638
diff changeset
  2580
    ^ package ~= self mclass package
01a74c51c29a added: #isExtension
Claus Gittinger <cg@exept.de>
parents: 13638
diff changeset
  2581
01a74c51c29a added: #isExtension
Claus Gittinger <cg@exept.de>
parents: 13638
diff changeset
  2582
    "Created: / 07-09-2011 / 09:29:13 / cg"
01a74c51c29a added: #isExtension
Claus Gittinger <cg@exept.de>
parents: 13638
diff changeset
  2583
!
01a74c51c29a added: #isExtension
Claus Gittinger <cg@exept.de>
parents: 13638
diff changeset
  2584
10482
11b634beb199 +ole queries
fm
parents: 10375
diff changeset
  2585
isExternalLibraryFunctionCall
11b634beb199 +ole queries
fm
parents: 10375
diff changeset
  2586
    "Return true, if this is an externalLibraryFunction call."
11b634beb199 +ole queries
fm
parents: 10375
diff changeset
  2587
12569
b97efbbc1ac7 comment/format in: #isExternalLibraryFunctionCall
Claus Gittinger <cg@exept.de>
parents: 12546
diff changeset
  2588
    "/ 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
  2589
    "/ to be fixed...
b97efbbc1ac7 comment/format in: #isExternalLibraryFunctionCall
Claus Gittinger <cg@exept.de>
parents: 12546
diff changeset
  2590
10482
11b634beb199 +ole queries
fm
parents: 10375
diff changeset
  2591
    ^ self externalLibraryFunction notNil
11b634beb199 +ole queries
fm
parents: 10375
diff changeset
  2592
!
11b634beb199 +ole queries
fm
parents: 10375
diff changeset
  2593
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
  2594
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
  2595
    "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
  2596
     a (re)-compilation error. Since invalidation is by patching the
628abcb5fbb6 moved some protocol from to upper levels
Claus Gittinger <cg@exept.de>
parents: 1190
diff changeset
  2597
     methods code-pointer to a trap function, check for that here.
628abcb5fbb6 moved some protocol from to upper levels
Claus Gittinger <cg@exept.de>
parents: 1190
diff changeset
  2598
     (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
  2599
2558
07e7d6fef46d removed unused var
Claus Gittinger <cg@exept.de>
parents: 2541
diff changeset
  2600
    |m myCode|
1873
3544a4a94a2a checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1870
diff changeset
  2601
3544a4a94a2a checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1870
diff changeset
  2602
    myCode := self code.
3544a4a94a2a checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1870
diff changeset
  2603
3544a4a94a2a checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1870
diff changeset
  2604
    m := self trapMethodForNumArgs:(self numArgs).
3544a4a94a2a checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1870
diff changeset
  2605
    (m notNil and:[self ~~ m]) ifTrue:[
13662
7d7ae1e5f589 changed: #annotationAtIndex:
Claus Gittinger <cg@exept.de>
parents: 13660
diff changeset
  2606
        (myCode notNil and:[myCode = m code]) ifTrue:[^ true].
7d7ae1e5f589 changed: #annotationAtIndex:
Claus Gittinger <cg@exept.de>
parents: 13660
diff changeset
  2607
        (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
  2608
    ].
159
514c749165c3 *** empty log message ***
claus
parents: 142
diff changeset
  2609
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
  2610
    m := Method compiledMethodAt:#uncompiledCodeObject.
1873
3544a4a94a2a checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1870
diff changeset
  2611
    (m notNil and:[self ~~ m]) ifTrue:[
13662
7d7ae1e5f589 changed: #annotationAtIndex:
Claus Gittinger <cg@exept.de>
parents: 13660
diff changeset
  2612
        (myCode notNil and:[myCode = m code]) ifTrue:[^ true].
7d7ae1e5f589 changed: #annotationAtIndex:
Claus Gittinger <cg@exept.de>
parents: 13660
diff changeset
  2613
        (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
  2614
    ].
1873
3544a4a94a2a checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1870
diff changeset
  2615
3544a4a94a2a checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1870
diff changeset
  2616
    m := Method compiledMethodAt:#unloadedCodeObject.
3544a4a94a2a checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1870
diff changeset
  2617
    (m notNil and:[self ~~ m]) ifTrue:[
13662
7d7ae1e5f589 changed: #annotationAtIndex:
Claus Gittinger <cg@exept.de>
parents: 13660
diff changeset
  2618
        (myCode notNil and:[myCode = m code]) ifTrue:[^ true].
7d7ae1e5f589 changed: #annotationAtIndex:
Claus Gittinger <cg@exept.de>
parents: 13660
diff changeset
  2619
        (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
  2620
    ].
1873
3544a4a94a2a checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1870
diff changeset
  2621
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
  2622
    ^ false
1194
628abcb5fbb6 moved some protocol from to upper levels
Claus Gittinger <cg@exept.de>
parents: 1190
diff changeset
  2623
1873
3544a4a94a2a checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1870
diff changeset
  2624
    "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
  2625
!
d600e08a5936 handle the case where a method has a sourceFileInfo, but the class has not
Claus Gittinger <cg@exept.de>
parents: 934
diff changeset
  2626
d600e08a5936 handle the case where a method has a sourceFileInfo, but the class has not
Claus Gittinger <cg@exept.de>
parents: 934
diff changeset
  2627
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
  2628
    "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
  2629
     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
  2630
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
    ^ 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
  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
14274
cee19bad32a0 added: #isMethodWithBreakpoints
Claus Gittinger <cg@exept.de>
parents: 14266
diff changeset
  2634
isMethodWithBreakpoints
cee19bad32a0 added: #isMethodWithBreakpoints
Claus Gittinger <cg@exept.de>
parents: 14266
diff changeset
  2635
    "only redefined in MethodWithBreakpoints"
cee19bad32a0 added: #isMethodWithBreakpoints
Claus Gittinger <cg@exept.de>
parents: 14266
diff changeset
  2636
cee19bad32a0 added: #isMethodWithBreakpoints
Claus Gittinger <cg@exept.de>
parents: 14266
diff changeset
  2637
    ^ false
cee19bad32a0 added: #isMethodWithBreakpoints
Claus Gittinger <cg@exept.de>
parents: 14266
diff changeset
  2638
cee19bad32a0 added: #isMethodWithBreakpoints
Claus Gittinger <cg@exept.de>
parents: 14266
diff changeset
  2639
    "Created: / 01-08-2012 / 17:26:43 / cg"
cee19bad32a0 added: #isMethodWithBreakpoints
Claus Gittinger <cg@exept.de>
parents: 14266
diff changeset
  2640
!
cee19bad32a0 added: #isMethodWithBreakpoints
Claus Gittinger <cg@exept.de>
parents: 14266
diff changeset
  2641
10482
11b634beb199 +ole queries
fm
parents: 10375
diff changeset
  2642
isOLECall
11b634beb199 +ole queries
fm
parents: 10375
diff changeset
  2643
    "return true, if the method is an ole call; false if not."
11b634beb199 +ole queries
fm
parents: 10375
diff changeset
  2644
11b634beb199 +ole queries
fm
parents: 10375
diff changeset
  2645
    |funcOrNil|
11b634beb199 +ole queries
fm
parents: 10375
diff changeset
  2646
11b634beb199 +ole queries
fm
parents: 10375
diff changeset
  2647
    funcOrNil := self externalLibraryFunction.
11b634beb199 +ole queries
fm
parents: 10375
diff changeset
  2648
    ^ funcOrNil notNil and:[funcOrNil isCallTypeOLE]
11b634beb199 +ole queries
fm
parents: 10375
diff changeset
  2649
!
11b634beb199 +ole queries
fm
parents: 10375
diff changeset
  2650
5894
ed6193fa6040 Define #isObsolete and fix various comments
Stefan Vogel <sv@exept.de>
parents: 5818
diff changeset
  2651
isObsolete
ed6193fa6040 Define #isObsolete and fix various comments
Stefan Vogel <sv@exept.de>
parents: 5818
diff changeset
  2652
    "returns true, if this method is obsolete and should not be used any longer"
ed6193fa6040 Define #isObsolete and fix various comments
Stefan Vogel <sv@exept.de>
parents: 5818
diff changeset
  2653
ed6193fa6040 Define #isObsolete and fix various comments
Stefan Vogel <sv@exept.de>
parents: 5818
diff changeset
  2654
    |res|
ed6193fa6040 Define #isObsolete and fix various comments
Stefan Vogel <sv@exept.de>
parents: 5818
diff changeset
  2655
ed6193fa6040 Define #isObsolete and fix various comments
Stefan Vogel <sv@exept.de>
parents: 5818
diff changeset
  2656
    ^ (res := self resources) notNil and:[res includesKey:#obsolete]
ed6193fa6040 Define #isObsolete and fix various comments
Stefan Vogel <sv@exept.de>
parents: 5818
diff changeset
  2657
!
ed6193fa6040 Define #isObsolete and fix various comments
Stefan Vogel <sv@exept.de>
parents: 5818
diff changeset
  2658
15079
8f16af69c964 class: Method
Claus Gittinger <cg@exept.de>
parents: 15045
diff changeset
  2659
isShadowingExtension
8f16af69c964 class: Method
Claus Gittinger <cg@exept.de>
parents: 15045
diff changeset
  2660
    "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
  2661
     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
  2662
8f16af69c964 class: Method
Claus Gittinger <cg@exept.de>
parents: 15045
diff changeset
  2663
    |myClass myProjectDefinition|
8f16af69c964 class: Method
Claus Gittinger <cg@exept.de>
parents: 15045
diff changeset
  2664
15109
8297a153874b class: Method
Claus Gittinger <cg@exept.de>
parents: 15079
diff changeset
  2665
    myClass := self mclass.
8297a153874b class: Method
Claus Gittinger <cg@exept.de>
parents: 15079
diff changeset
  2666
    myClass isNil ifTrue:[^ false].
8297a153874b class: Method
Claus Gittinger <cg@exept.de>
parents: 15079
diff changeset
  2667
    myClass := myClass theNonMetaclass.
15079
8f16af69c964 class: Method
Claus Gittinger <cg@exept.de>
parents: 15045
diff changeset
  2668
    ^ myClass notNil
8f16af69c964 class: Method
Claus Gittinger <cg@exept.de>
parents: 15045
diff changeset
  2669
        and:[ package ~= myClass package
15445
707b77342862 class: Method
Claus Gittinger <cg@exept.de>
parents: 15425
diff changeset
  2670
        and:[ package ~= PackageId noProjectID
15079
8f16af69c964 class: Method
Claus Gittinger <cg@exept.de>
parents: 15045
diff changeset
  2671
        and:[ (myProjectDefinition := myClass projectDefinitionClass) notNil
15445
707b77342862 class: Method
Claus Gittinger <cg@exept.de>
parents: 15425
diff changeset
  2672
        and:[ (myProjectDefinition savedOverwrittenMethodForClass:self mclass selector:self selector) notNil ]]]]
15079
8f16af69c964 class: Method
Claus Gittinger <cg@exept.de>
parents: 15045
diff changeset
  2673
!
8f16af69c964 class: Method
Claus Gittinger <cg@exept.de>
parents: 15045
diff changeset
  2674
13422
b43a8a47037c Jan's changes
vrany
parents: 13390
diff changeset
  2675
isSynthetic
13638
c5b12d3594ba changed: #rationale
Claus Gittinger <cg@exept.de>
parents: 13634
diff changeset
  2676
    "a syntheric method does not really exist - it is only shown in a browser's list"
c5b12d3594ba changed: #rationale
Claus Gittinger <cg@exept.de>
parents: 13634
diff changeset
  2677
c5b12d3594ba changed: #rationale
Claus Gittinger <cg@exept.de>
parents: 13634
diff changeset
  2678
    ^ false
c5b12d3594ba changed: #rationale
Claus Gittinger <cg@exept.de>
parents: 13634
diff changeset
  2679
c5b12d3594ba changed: #rationale
Claus Gittinger <cg@exept.de>
parents: 13634
diff changeset
  2680
    "Modified (format): / 07-09-2011 / 09:00:56 / cg"
13422
b43a8a47037c Jan's changes
vrany
parents: 13390
diff changeset
  2681
!
b43a8a47037c Jan's changes
vrany
parents: 13390
diff changeset
  2682
11985
5fb68bfa4648 +isVersionMethod
Claus Gittinger <cg@exept.de>
parents: 11950
diff changeset
  2683
isVersionMethod
12017
908685b92c3e comment/format in: #isVersionMethod
Claus Gittinger <cg@exept.de>
parents: 12016
diff changeset
  2684
    "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
  2685
     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
  2686
     method attribute for that..."
11985
5fb68bfa4648 +isVersionMethod
Claus Gittinger <cg@exept.de>
parents: 11950
diff changeset
  2687
12016
7918f05b2046 changed: #isVersionMethod
Claus Gittinger <cg@exept.de>
parents: 11987
diff changeset
  2688
    ^ self mclass isMeta
12165
ca71a1aba926 changed: #isVersionMethod
fm
parents: 12159
diff changeset
  2689
    and:[(AbstractSourceCodeManager isVersionMethodSelector:self selector)]
11985
5fb68bfa4648 +isVersionMethod
Claus Gittinger <cg@exept.de>
parents: 11950
diff changeset
  2690
5fb68bfa4648 +isVersionMethod
Claus Gittinger <cg@exept.de>
parents: 11950
diff changeset
  2691
    "
12854
3a3d3c02c3bd *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 12695
diff changeset
  2692
     (Method class compiledMethodAt:#version) isVersionMethod
11985
5fb68bfa4648 +isVersionMethod
Claus Gittinger <cg@exept.de>
parents: 11950
diff changeset
  2693
     (Method class compiledMethodAt:#documentation) isVersionMethod
5fb68bfa4648 +isVersionMethod
Claus Gittinger <cg@exept.de>
parents: 11950
diff changeset
  2694
    "
5fb68bfa4648 +isVersionMethod
Claus Gittinger <cg@exept.de>
parents: 11950
diff changeset
  2695
!
5fb68bfa4648 +isVersionMethod
Claus Gittinger <cg@exept.de>
parents: 11950
diff changeset
  2696
11848
ca89d472f9cf *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 11778
diff changeset
  2697
isVisualWorksTypedef
ca89d472f9cf *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 11778
diff changeset
  2698
    "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
  2699
ca89d472f9cf *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 11778
diff changeset
  2700
    ^ (self literals size > 0)
ca89d472f9cf *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 11778
diff changeset
  2701
    and:[ (self literalAt:1) isKindOf:CType ]
ca89d472f9cf *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 11778
diff changeset
  2702
!
ca89d472f9cf *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 11778
diff changeset
  2703
2695
79229a9ab2da added #mclass for ST80 compatibility
Claus Gittinger <cg@exept.de>
parents: 2694
diff changeset
  2704
mclass
79229a9ab2da added #mclass for ST80 compatibility
Claus Gittinger <cg@exept.de>
parents: 2694
diff changeset
  2705
    "return the class in which the receiver was compiled.
79229a9ab2da added #mclass for ST80 compatibility
Claus Gittinger <cg@exept.de>
parents: 2694
diff changeset
  2706
     Same as #containingClass, for ST80 compatibility."
79229a9ab2da added #mclass for ST80 compatibility
Claus Gittinger <cg@exept.de>
parents: 2694
diff changeset
  2707
79229a9ab2da added #mclass for ST80 compatibility
Claus Gittinger <cg@exept.de>
parents: 2694
diff changeset
  2708
    ^ self containingClass
79229a9ab2da added #mclass for ST80 compatibility
Claus Gittinger <cg@exept.de>
parents: 2694
diff changeset
  2709
79229a9ab2da added #mclass for ST80 compatibility
Claus Gittinger <cg@exept.de>
parents: 2694
diff changeset
  2710
    "Created: 19.6.1997 / 16:26:13 / cg"
79229a9ab2da added #mclass for ST80 compatibility
Claus Gittinger <cg@exept.de>
parents: 2694
diff changeset
  2711
!
79229a9ab2da added #mclass for ST80 compatibility
Claus Gittinger <cg@exept.de>
parents: 2694
diff changeset
  2712
5696
958a0643496d compatibility
Claus Gittinger <cg@exept.de>
parents: 5676
diff changeset
  2713
messages
958a0643496d compatibility
Claus Gittinger <cg@exept.de>
parents: 5676
diff changeset
  2714
    "return a collection of message-selectors, sent by this method."
958a0643496d compatibility
Claus Gittinger <cg@exept.de>
parents: 5676
diff changeset
  2715
958a0643496d compatibility
Claus Gittinger <cg@exept.de>
parents: 5676
diff changeset
  2716
    ^ self messagesSent
958a0643496d compatibility
Claus Gittinger <cg@exept.de>
parents: 5676
diff changeset
  2717
!
958a0643496d compatibility
Claus Gittinger <cg@exept.de>
parents: 5676
diff changeset
  2718
5584
b175797a8c4d #messagesDo: (VW compatibility)
Claus Gittinger <cg@exept.de>
parents: 5582
diff changeset
  2719
messagesDo:aBlock
b175797a8c4d #messagesDo: (VW compatibility)
Claus Gittinger <cg@exept.de>
parents: 5582
diff changeset
  2720
    "evaluate aBlock for each message-selector sent by this method.
b175797a8c4d #messagesDo: (VW compatibility)
Claus Gittinger <cg@exept.de>
parents: 5582
diff changeset
  2721
     Uses Parser to parse methods source and extract the names."
b175797a8c4d #messagesDo: (VW compatibility)
Claus Gittinger <cg@exept.de>
parents: 5582
diff changeset
  2722
b175797a8c4d #messagesDo: (VW compatibility)
Claus Gittinger <cg@exept.de>
parents: 5582
diff changeset
  2723
    ^ self messagesSent do:aBlock
b175797a8c4d #messagesDo: (VW compatibility)
Claus Gittinger <cg@exept.de>
parents: 5582
diff changeset
  2724
!
b175797a8c4d #messagesDo: (VW compatibility)
Claus Gittinger <cg@exept.de>
parents: 5582
diff changeset
  2725
14402
Claus Gittinger <cg@exept.de>
parents: 14375
diff changeset
  2726
messagesPossiblySent
Claus Gittinger <cg@exept.de>
parents: 14375
diff changeset
  2727
    "return a collection with the message selectors possibly sent to by the receiver.
Claus Gittinger <cg@exept.de>
parents: 14375
diff changeset
  2728
     Uses Parser to parse methods source and extract the names.
Claus Gittinger <cg@exept.de>
parents: 14375
diff changeset
  2729
     The returned collection includes perform-like and possibly performed messages"
Claus Gittinger <cg@exept.de>
parents: 14375
diff changeset
  2730
Claus Gittinger <cg@exept.de>
parents: 14375
diff changeset
  2731
    ^ self parse:#'parseMethodSilent:in:' with:self mclass return:#messagesPossiblySent or:#()
Claus Gittinger <cg@exept.de>
parents: 14375
diff changeset
  2732
Claus Gittinger <cg@exept.de>
parents: 14375
diff changeset
  2733
    "
Claus Gittinger <cg@exept.de>
parents: 14375
diff changeset
  2734
     (Method compiledMethodAt:#printOn:) messagesSent
Claus Gittinger <cg@exept.de>
parents: 14375
diff changeset
  2735
     (Point compiledMethodAt:#x:) messagesSent
Claus Gittinger <cg@exept.de>
parents: 14375
diff changeset
  2736
    "
Claus Gittinger <cg@exept.de>
parents: 14375
diff changeset
  2737
!
Claus Gittinger <cg@exept.de>
parents: 14375
diff changeset
  2738
5582
737d121ae7de *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5564
diff changeset
  2739
messagesSent
737d121ae7de *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5564
diff changeset
  2740
    "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
  2741
     Uses Parser to parse methods source and extract the names.
737d121ae7de *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5564
diff changeset
  2742
     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
  2743
12854
3a3d3c02c3bd *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 12695
diff changeset
  2744
    ^ self parse:#'parseMethodSilent:in:' with:self mclass return:#messagesSent or:#()
5582
737d121ae7de *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5564
diff changeset
  2745
737d121ae7de *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5564
diff changeset
  2746
    "
12854
3a3d3c02c3bd *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 12695
diff changeset
  2747
     (Method compiledMethodAt:#printOn:) messagesSent
3a3d3c02c3bd *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 12695
diff changeset
  2748
     (Point compiledMethodAt:#x:) messagesSent
5582
737d121ae7de *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5564
diff changeset
  2749
    "
737d121ae7de *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5564
diff changeset
  2750
!
737d121ae7de *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5564
diff changeset
  2751
737d121ae7de *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5564
diff changeset
  2752
messagesSentToSelf
737d121ae7de *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5564
diff changeset
  2753
    "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
  2754
     Uses Parser to parse methods source and extract the names."
737d121ae7de *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5564
diff changeset
  2755
12854
3a3d3c02c3bd *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 12695
diff changeset
  2756
    ^ self parse:#'parseMethodSilent:in:' with:self mclass return:#messagesSentToSelf or:#()
5652
f832f4c5cfdd messagesSentTo* fixed
Claus Gittinger <cg@exept.de>
parents: 5644
diff changeset
  2757
5582
737d121ae7de *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5564
diff changeset
  2758
!
737d121ae7de *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5564
diff changeset
  2759
737d121ae7de *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5564
diff changeset
  2760
messagesSentToSuper
737d121ae7de *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5564
diff changeset
  2761
    "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
  2762
     Uses Parser to parse methods source and extract the names."
737d121ae7de *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5564
diff changeset
  2763
12854
3a3d3c02c3bd *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 12695
diff changeset
  2764
    ^ self parse:#'parseMethodSilent:in:' with:self mclass return:#messagesSentToSuper or:#()
5652
f832f4c5cfdd messagesSentTo* fixed
Claus Gittinger <cg@exept.de>
parents: 5644
diff changeset
  2765
5582
737d121ae7de *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5564
diff changeset
  2766
!
737d121ae7de *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5564
diff changeset
  2767
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
  2768
methodArgAndVarNames
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 a collection with the methods argument and variable names.
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
     Uses Parser to parse methods source and extract the names.
15787
7ea8bff49835 class: Method
Claus Gittinger <cg@exept.de>
parents: 15768
diff changeset
  2771
     Returns an empty collection if the source is not available, or some other
7ea8bff49835 class: Method
Claus Gittinger <cg@exept.de>
parents: 15768
diff changeset
  2772
     syntax/parse error occurred. 
7ea8bff49835 class: Method
Claus Gittinger <cg@exept.de>
parents: 15768
diff changeset
  2773
     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
  2774
8427
bba41f189196 parserClass stuff
ca
parents: 8419
diff changeset
  2775
    |parserClass parser sourceString argNames varNames|
bba41f189196 parserClass stuff
ca
parents: 8419
diff changeset
  2776
bba41f189196 parserClass stuff
ca
parents: 8419
diff changeset
  2777
    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
  2778
    sourceString := self source.
8427
bba41f189196 parserClass stuff
ca
parents: 8419
diff changeset
  2779
    (parserClass notNil and:[sourceString notNil]) ifTrue:[
13662
7d7ae1e5f589 changed: #annotationAtIndex:
Claus Gittinger <cg@exept.de>
parents: 13660
diff changeset
  2780
        parser := parserClass parseMethodArgAndVarSpecificationSilent:sourceString.
7d7ae1e5f589 changed: #annotationAtIndex:
Claus Gittinger <cg@exept.de>
parents: 13660
diff changeset
  2781
        (parser isNil or:[parser == #Error]) ifTrue:[^ nil].
7d7ae1e5f589 changed: #annotationAtIndex:
Claus Gittinger <cg@exept.de>
parents: 13660
diff changeset
  2782
        argNames := parser methodArgs.
7d7ae1e5f589 changed: #annotationAtIndex:
Claus Gittinger <cg@exept.de>
parents: 13660
diff changeset
  2783
        varNames := parser methodVars.
7d7ae1e5f589 changed: #annotationAtIndex:
Claus Gittinger <cg@exept.de>
parents: 13660
diff changeset
  2784
        argNames isNil ifTrue:[^ varNames].
7d7ae1e5f589 changed: #annotationAtIndex:
Claus Gittinger <cg@exept.de>
parents: 13660
diff changeset
  2785
        varNames isNil ifTrue:[^ argNames].
7d7ae1e5f589 changed: #annotationAtIndex:
Claus Gittinger <cg@exept.de>
parents: 13660
diff changeset
  2786
        ^ (argNames , varNames)
159
514c749165c3 *** empty log message ***
claus
parents: 142
diff changeset
  2787
    ].
15787
7ea8bff49835 class: Method
Claus Gittinger <cg@exept.de>
parents: 15768
diff changeset
  2788
    ^ #()
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
  2789
159
514c749165c3 *** empty log message ***
claus
parents: 142
diff changeset
  2790
    "
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
  2791
     (Method compiledMethodAt:#printOn:) methodArgAndVarNames
159
514c749165c3 *** empty log message ***
claus
parents: 142
diff changeset
  2792
    "
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
  2793
!
d600e08a5936 handle the case where a method has a sourceFileInfo, but the class has not
Claus Gittinger <cg@exept.de>
parents: 934
diff changeset
  2794
15649
4484fd85cb9e class: Method
Stefan Vogel <sv@exept.de>
parents: 15614
diff changeset
  2795
methodArgAndVarNamesInContext: context
15727
d0ec35ce96fc class: Method
Claus Gittinger <cg@exept.de>
parents: 15649
diff changeset
  2796
    "return a collection with the method's argument and variable names.
15649
4484fd85cb9e class: Method
Stefan Vogel <sv@exept.de>
parents: 15614
diff changeset
  2797
     Uses Parser to parse methods source and extract the names.
4484fd85cb9e class: Method
Stefan Vogel <sv@exept.de>
parents: 15614
diff changeset
  2798
     Returns nil if the source is not available, or some other
4484fd85cb9e class: Method
Stefan Vogel <sv@exept.de>
parents: 15614
diff changeset
  2799
     syntax/parse error occurred. For methods with no args and no vars,
4484fd85cb9e class: Method
Stefan Vogel <sv@exept.de>
parents: 15614
diff changeset
  2800
     an empty collection is returned."
4484fd85cb9e class: Method
Stefan Vogel <sv@exept.de>
parents: 15614
diff changeset
  2801
    
4484fd85cb9e class: Method
Stefan Vogel <sv@exept.de>
parents: 15614
diff changeset
  2802
     ^self methodArgAndVarNames
4484fd85cb9e class: Method
Stefan Vogel <sv@exept.de>
parents: 15614
diff changeset
  2803
    
4484fd85cb9e class: Method
Stefan Vogel <sv@exept.de>
parents: 15614
diff changeset
  2804
     "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
  2805
!
4484fd85cb9e class: Method
Stefan Vogel <sv@exept.de>
parents: 15614
diff changeset
  2806
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
  2807
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
  2808
    "return a collection with the methods argument names.
d600e08a5936 handle the case where a method has a sourceFileInfo, but the class has not
Claus Gittinger <cg@exept.de>
parents: 934
diff changeset
  2809
     Uses Parser to parse methods source and extract the names."
d600e08a5936 handle the case where a method has a sourceFileInfo, but the class has not
Claus Gittinger <cg@exept.de>
parents: 934
diff changeset
  2810
d600e08a5936 handle the case where a method has a sourceFileInfo, but the class has not
Claus Gittinger <cg@exept.de>
parents: 934
diff changeset
  2811
    ^ self parse:#'parseMethodSpecificationSilent:' return:#methodArgs 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
  2812
d600e08a5936 handle the case where a method has a sourceFileInfo, but the class has not
Claus Gittinger <cg@exept.de>
parents: 934
diff changeset
  2813
    "
d600e08a5936 handle the case where a method has a sourceFileInfo, but the class has not
Claus Gittinger <cg@exept.de>
parents: 934
diff changeset
  2814
     (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
  2815
    "
d600e08a5936 handle the case where a method has a sourceFileInfo, but the class has not
Claus Gittinger <cg@exept.de>
parents: 934
diff changeset
  2816
d600e08a5936 handle the case where a method has a sourceFileInfo, but the class has not
Claus Gittinger <cg@exept.de>
parents: 934
diff changeset
  2817
    "Modified: 31.10.1995 / 14:36:46 / cg"
872
af04035b443d binary class storage support
Claus Gittinger <cg@exept.de>
parents: 829
diff changeset
  2818
!
af04035b443d binary class storage support
Claus Gittinger <cg@exept.de>
parents: 829
diff changeset
  2819
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
  2820
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
  2821
    "return the methods first comment, nil if there is none.
d600e08a5936 handle the case where a method has a sourceFileInfo, but the class has not
Claus Gittinger <cg@exept.de>
parents: 934
diff changeset
  2822
     This is a somewhat stupid implementation."
872
af04035b443d binary class storage support
Claus Gittinger <cg@exept.de>
parents: 829
diff changeset
  2823
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
  2824
    |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
  2825
d600e08a5936 handle the case where a method has a sourceFileInfo, but the class has not
Claus Gittinger <cg@exept.de>
parents: 934
diff changeset
  2826
    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
  2827
    (text size < 2) ifTrue:[^nil].
872
af04035b443d binary class storage support
Claus Gittinger <cg@exept.de>
parents: 829
diff changeset
  2828
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
  2829
    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
  2830
    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
  2831
    (nQuote == 2) ifTrue:[
13662
7d7ae1e5f589 changed: #annotationAtIndex:
Claus Gittinger <cg@exept.de>
parents: 13660
diff changeset
  2832
        qIndex := line indexOf:(Character doubleQuote).
7d7ae1e5f589 changed: #annotationAtIndex:
Claus Gittinger <cg@exept.de>
parents: 13660
diff changeset
  2833
        qIndex2 := line indexOf:(Character doubleQuote) startingAt:(qIndex + 1).
7d7ae1e5f589 changed: #annotationAtIndex:
Claus Gittinger <cg@exept.de>
parents: 13660
diff changeset
  2834
        ^ line copyFrom:(qIndex + 1) to:(qIndex2 - 1)
872
af04035b443d binary class storage support
Claus Gittinger <cg@exept.de>
parents: 829
diff changeset
  2835
    ].
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
  2836
    (nQuote == 1) ifTrue:[
13662
7d7ae1e5f589 changed: #annotationAtIndex:
Claus Gittinger <cg@exept.de>
parents: 13660
diff changeset
  2837
        qIndex := line indexOf:(Character doubleQuote).
7d7ae1e5f589 changed: #annotationAtIndex:
Claus Gittinger <cg@exept.de>
parents: 13660
diff changeset
  2838
        comment := line copyFrom:(qIndex + 1).
7d7ae1e5f589 changed: #annotationAtIndex:
Claus Gittinger <cg@exept.de>
parents: 13660
diff changeset
  2839
        (line indexOf:$/ startingAt:qIndex) == (qIndex+1) ifTrue:[
7d7ae1e5f589 changed: #annotationAtIndex:
Claus Gittinger <cg@exept.de>
parents: 13660
diff changeset
  2840
            "/ an EOL comment
7d7ae1e5f589 changed: #annotationAtIndex:
Claus Gittinger <cg@exept.de>
parents: 13660
diff changeset
  2841
            ^ (comment copyFrom:2) withoutSeparators
7d7ae1e5f589 changed: #annotationAtIndex:
Claus Gittinger <cg@exept.de>
parents: 13660
diff changeset
  2842
        ].
7d7ae1e5f589 changed: #annotationAtIndex:
Claus Gittinger <cg@exept.de>
parents: 13660
diff changeset
  2843
7d7ae1e5f589 changed: #annotationAtIndex:
Claus Gittinger <cg@exept.de>
parents: 13660
diff changeset
  2844
        "/ not an EOL comment
7d7ae1e5f589 changed: #annotationAtIndex:
Claus Gittinger <cg@exept.de>
parents: 13660
diff changeset
  2845
        index := 3.
7d7ae1e5f589 changed: #annotationAtIndex:
Claus Gittinger <cg@exept.de>
parents: 13660
diff changeset
  2846
        line := text at:index.
7d7ae1e5f589 changed: #annotationAtIndex:
Claus Gittinger <cg@exept.de>
parents: 13660
diff changeset
  2847
        nQuote := line occurrencesOf:(Character doubleQuote).
7d7ae1e5f589 changed: #annotationAtIndex:
Claus Gittinger <cg@exept.de>
parents: 13660
diff changeset
  2848
        [nQuote ~~ 1] whileTrue:[
7d7ae1e5f589 changed: #annotationAtIndex:
Claus Gittinger <cg@exept.de>
parents: 13660
diff changeset
  2849
            comment := comment , Character cr asString , line withoutSpaces.
7d7ae1e5f589 changed: #annotationAtIndex:
Claus Gittinger <cg@exept.de>
parents: 13660
diff changeset
  2850
            index := index + 1.
7d7ae1e5f589 changed: #annotationAtIndex:
Claus Gittinger <cg@exept.de>
parents: 13660
diff changeset
  2851
            line := text at:index.
7d7ae1e5f589 changed: #annotationAtIndex:
Claus Gittinger <cg@exept.de>
parents: 13660
diff changeset
  2852
            nQuote := line occurrencesOf:(Character doubleQuote)
7d7ae1e5f589 changed: #annotationAtIndex:
Claus Gittinger <cg@exept.de>
parents: 13660
diff changeset
  2853
        ].
7d7ae1e5f589 changed: #annotationAtIndex:
Claus Gittinger <cg@exept.de>
parents: 13660
diff changeset
  2854
        qIndex := line indexOf:(Character doubleQuote).
7d7ae1e5f589 changed: #annotationAtIndex:
Claus Gittinger <cg@exept.de>
parents: 13660
diff changeset
  2855
        ^ 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
  2856
    ].
d600e08a5936 handle the case where a method has a sourceFileInfo, but the class has not
Claus Gittinger <cg@exept.de>
parents: 934
diff changeset
  2857
    ^ 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
  2858
d600e08a5936 handle the case where a method has a sourceFileInfo, but the class has not
Claus Gittinger <cg@exept.de>
parents: 934
diff changeset
  2859
    "
d600e08a5936 handle the case where a method has a sourceFileInfo, but the class has not
Claus Gittinger <cg@exept.de>
parents: 934
diff changeset
  2860
     (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
  2861
    "
d600e08a5936 handle the case where a method has a sourceFileInfo, but the class has not
Claus Gittinger <cg@exept.de>
parents: 934
diff changeset
  2862
!
872
af04035b443d binary class storage support
Claus Gittinger <cg@exept.de>
parents: 829
diff changeset
  2863
9364
beef5f0aa8bb New: #methodDefinitionTemplate
Stefan Vogel <sv@exept.de>
parents: 9288
diff changeset
  2864
methodDefinitionTemplate
beef5f0aa8bb New: #methodDefinitionTemplate
Stefan Vogel <sv@exept.de>
parents: 9288
diff changeset
  2865
    "return the string that defines the method and the arguments"
beef5f0aa8bb New: #methodDefinitionTemplate
Stefan Vogel <sv@exept.de>
parents: 9288
diff changeset
  2866
16261
52a0604a7b95 class: Method
Stefan Vogel <sv@exept.de>
parents: 16221
diff changeset
  2867
    ^ self class
13662
7d7ae1e5f589 changed: #annotationAtIndex:
Claus Gittinger <cg@exept.de>
parents: 13660
diff changeset
  2868
        methodDefinitionTemplateForSelector:self selector
7d7ae1e5f589 changed: #annotationAtIndex:
Claus Gittinger <cg@exept.de>
parents: 13660
diff changeset
  2869
        andArgumentNames:self methodArgNames
9364
beef5f0aa8bb New: #methodDefinitionTemplate
Stefan Vogel <sv@exept.de>
parents: 9288
diff changeset
  2870
beef5f0aa8bb New: #methodDefinitionTemplate
Stefan Vogel <sv@exept.de>
parents: 9288
diff changeset
  2871
    "
beef5f0aa8bb New: #methodDefinitionTemplate
Stefan Vogel <sv@exept.de>
parents: 9288
diff changeset
  2872
      (self compiledMethodAt:#printOn:) methodDefinitionTemplate
beef5f0aa8bb New: #methodDefinitionTemplate
Stefan Vogel <sv@exept.de>
parents: 9288
diff changeset
  2873
    "
beef5f0aa8bb New: #methodDefinitionTemplate
Stefan Vogel <sv@exept.de>
parents: 9288
diff changeset
  2874
!
beef5f0aa8bb New: #methodDefinitionTemplate
Stefan Vogel <sv@exept.de>
parents: 9288
diff changeset
  2875
12900
4cda19285039 category of: #methodInvocationInfo
Claus Gittinger <cg@exept.de>
parents: 12899
diff changeset
  2876
methodInvocationInfo
13567
fe6564553977 comment: #methodInvocationInfo
Claus Gittinger <cg@exept.de>
parents: 13463
diff changeset
  2877
    "redefined by InstrumentedMethod, to return the collected info"
fe6564553977 comment: #methodInvocationInfo
Claus Gittinger <cg@exept.de>
parents: 13463
diff changeset
  2878
12900
4cda19285039 category of: #methodInvocationInfo
Claus Gittinger <cg@exept.de>
parents: 12899
diff changeset
  2879
    ^ nil
4cda19285039 category of: #methodInvocationInfo
Claus Gittinger <cg@exept.de>
parents: 12899
diff changeset
  2880
4cda19285039 category of: #methodInvocationInfo
Claus Gittinger <cg@exept.de>
parents: 12899
diff changeset
  2881
    "Created: / 27-04-2010 / 13:36:12 / cg"
4cda19285039 category of: #methodInvocationInfo
Claus Gittinger <cg@exept.de>
parents: 12899
diff changeset
  2882
!
4cda19285039 category of: #methodInvocationInfo
Claus Gittinger <cg@exept.de>
parents: 12899
diff changeset
  2883
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
  2884
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
  2885
    "return a collection with the methods local-variable names.
d600e08a5936 handle the case where a method has a sourceFileInfo, but the class has not
Claus Gittinger <cg@exept.de>
parents: 934
diff changeset
  2886
     Uses Parser to parse methods source and extract the names."
d600e08a5936 handle the case where a method has a sourceFileInfo, but the class has not
Claus Gittinger <cg@exept.de>
parents: 934
diff changeset
  2887
d600e08a5936 handle the case where a method has a sourceFileInfo, but the class has not
Claus Gittinger <cg@exept.de>
parents: 934
diff changeset
  2888
    ^ 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
  2889
d600e08a5936 handle the case where a method has a sourceFileInfo, but the class has not
Claus Gittinger <cg@exept.de>
parents: 934
diff changeset
  2890
    "
d600e08a5936 handle the case where a method has a sourceFileInfo, but the class has not
Claus Gittinger <cg@exept.de>
parents: 934
diff changeset
  2891
     (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
  2892
    "
d600e08a5936 handle the case where a method has a sourceFileInfo, but the class has not
Claus Gittinger <cg@exept.de>
parents: 934
diff changeset
  2893
d600e08a5936 handle the case where a method has a sourceFileInfo, but the class has not
Claus Gittinger <cg@exept.de>
parents: 934
diff changeset
  2894
    "Modified: 31.10.1995 / 14:36:49 / cg"
d600e08a5936 handle the case where a method has a sourceFileInfo, but the class has not
Claus Gittinger <cg@exept.de>
parents: 934
diff changeset
  2895
!
d600e08a5936 handle the case where a method has a sourceFileInfo, but the class has not
Claus Gittinger <cg@exept.de>
parents: 934
diff changeset
  2896
d600e08a5936 handle the case where a method has a sourceFileInfo, but the class has not
Claus Gittinger <cg@exept.de>
parents: 934
diff changeset
  2897
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
  2898
    "try to extract the modificationTime as a timeStamp from
12854
3a3d3c02c3bd *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 12695
diff changeset
  2899
     the receivers 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
  2900
     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
  2901
d600e08a5936 handle the case where a method has a sourceFileInfo, but the class has not
Claus Gittinger <cg@exept.de>
parents: 934
diff changeset
  2902
    |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
  2903
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
  2904
    HistoryManager isNil ifTrue:[^ nil].
1873
3544a4a94a2a checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1870
diff changeset
  2905
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
  2906
    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
  2907
    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
  2908
    list := HistoryManager getAllHistoriesFrom:s.
16261
52a0604a7b95 class: Method
Stefan Vogel <sv@exept.de>
parents: 16221
diff changeset
  2909
    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
  2910
    histLine := list last.
12854
3a3d3c02c3bd *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 12695
diff changeset
  2911
    ^ Timestamp
13662
7d7ae1e5f589 changed: #annotationAtIndex:
Claus Gittinger <cg@exept.de>
parents: 13660
diff changeset
  2912
        fromDate:histLine date
7d7ae1e5f589 changed: #annotationAtIndex:
Claus Gittinger <cg@exept.de>
parents: 13660
diff changeset
  2913
        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
  2914
d600e08a5936 handle the case where a method has a sourceFileInfo, but the class has not
Claus Gittinger <cg@exept.de>
parents: 934
diff changeset
  2915
    "
d600e08a5936 handle the case where a method has a sourceFileInfo, but the class has not
Claus Gittinger <cg@exept.de>
parents: 934
diff changeset
  2916
     (Method compiledMethodAt:#modificationTime) modificationTime
12854
3a3d3c02c3bd *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 12695
diff changeset
  2917
     (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
  2918
    "
d600e08a5936 handle the case where a method has a sourceFileInfo, but the class has not
Claus Gittinger <cg@exept.de>
parents: 934
diff changeset
  2919
d600e08a5936 handle the case where a method has a sourceFileInfo, but the class has not
Claus Gittinger <cg@exept.de>
parents: 934
diff changeset
  2920
    "Modified: 8.9.1995 / 15:08:22 / claus"
1873
3544a4a94a2a checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1870
diff changeset
  2921
    "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
  2922
!
d600e08a5936 handle the case where a method has a sourceFileInfo, but the class has not
Claus Gittinger <cg@exept.de>
parents: 934
diff changeset
  2923
15424
143d8fdfa609 class: Method
Claus Gittinger <cg@exept.de>
parents: 15416
diff changeset
  2924
modifiedInstVars
143d8fdfa609 class: Method
Claus Gittinger <cg@exept.de>
parents: 15416
diff changeset
  2925
    "returns a collection of instance variables which are modified by this method.
143d8fdfa609 class: Method
Claus Gittinger <cg@exept.de>
parents: 15416
diff changeset
  2926
     Uses parser (for now); could look at bytecode as well here..."
143d8fdfa609 class: Method
Claus Gittinger <cg@exept.de>
parents: 15416
diff changeset
  2927
143d8fdfa609 class: Method
Claus Gittinger <cg@exept.de>
parents: 15416
diff changeset
  2928
    ^ self parse:#'parseMethodSilent:in:' with:self mclass  return:#modifiedInstVars or:#().
143d8fdfa609 class: Method
Claus Gittinger <cg@exept.de>
parents: 15416
diff changeset
  2929
!
143d8fdfa609 class: Method
Claus Gittinger <cg@exept.de>
parents: 15416
diff changeset
  2930
3845
729fda604d59 added #name (for javaMethod compatibility)
Claus Gittinger <cg@exept.de>
parents: 3697
diff changeset
  2931
name
729fda604d59 added #name (for javaMethod compatibility)
Claus Gittinger <cg@exept.de>
parents: 3697
diff changeset
  2932
    "for compatibility with javaMethods"
729fda604d59 added #name (for javaMethod compatibility)
Claus Gittinger <cg@exept.de>
parents: 3697
diff changeset
  2933
729fda604d59 added #name (for javaMethod compatibility)
Claus Gittinger <cg@exept.de>
parents: 3697
diff changeset
  2934
    ^ self selector
729fda604d59 added #name (for javaMethod compatibility)
Claus Gittinger <cg@exept.de>
parents: 3697
diff changeset
  2935
729fda604d59 added #name (for javaMethod compatibility)
Claus Gittinger <cg@exept.de>
parents: 3697
diff changeset
  2936
    "Created: / 9.11.1998 / 06:15:08 / cg"
729fda604d59 added #name (for javaMethod compatibility)
Claus Gittinger <cg@exept.de>
parents: 3697
diff changeset
  2937
!
729fda604d59 added #name (for javaMethod compatibility)
Claus Gittinger <cg@exept.de>
parents: 3697
diff changeset
  2938
13422
b43a8a47037c Jan's changes
vrany
parents: 13390
diff changeset
  2939
overrides: aMethod
15952
e55b89f8d241 class: Method
Claus Gittinger <cg@exept.de>
parents: 15787
diff changeset
  2940
    <resource: #obsolete>
e55b89f8d241 class: Method
Claus Gittinger <cg@exept.de>
parents: 15787
diff changeset
  2941
e55b89f8d241 class: Method
Claus Gittinger <cg@exept.de>
parents: 15787
diff changeset
  2942
    self obsoleteMethodWarning: 'Use overwrites: instead, stupid naming'.
e55b89f8d241 class: Method
Claus Gittinger <cg@exept.de>
parents: 15787
diff changeset
  2943
    self overwrites: aMethod.
e55b89f8d241 class: Method
Claus Gittinger <cg@exept.de>
parents: 15787
diff changeset
  2944
e55b89f8d241 class: Method
Claus Gittinger <cg@exept.de>
parents: 15787
diff changeset
  2945
    "Modified: / 18-06-2009 / 12:15:53 / Jan Vrany <vranyj1@fel.cvut.cz>"
e55b89f8d241 class: Method
Claus Gittinger <cg@exept.de>
parents: 15787
diff changeset
  2946
    "Modified: / 05-07-2012 / 10:52:38 / Jan Vrany <jan.vrany@fit.cvut.cz>"
e55b89f8d241 class: Method
Claus Gittinger <cg@exept.de>
parents: 15787
diff changeset
  2947
!
e55b89f8d241 class: Method
Claus Gittinger <cg@exept.de>
parents: 15787
diff changeset
  2948
e55b89f8d241 class: Method
Claus Gittinger <cg@exept.de>
parents: 15787
diff changeset
  2949
overwrites: aMethod
13422
b43a8a47037c Jan's changes
vrany
parents: 13390
diff changeset
  2950
b43a8a47037c Jan's changes
vrany
parents: 13390
diff changeset
  2951
    | mth |
15952
e55b89f8d241 class: Method
Claus Gittinger <cg@exept.de>
parents: 15787
diff changeset
  2952
    mth := self overwrittenMethod.
13422
b43a8a47037c Jan's changes
vrany
parents: 13390
diff changeset
  2953
    [ mth notNil ] whileTrue:
13662
7d7ae1e5f589 changed: #annotationAtIndex:
Claus Gittinger <cg@exept.de>
parents: 13660
diff changeset
  2954
        [mth == aMethod ifTrue:[^true].
15952
e55b89f8d241 class: Method
Claus Gittinger <cg@exept.de>
parents: 15787
diff changeset
  2955
        mth := mth overwrittenMethod].
13422
b43a8a47037c Jan's changes
vrany
parents: 13390
diff changeset
  2956
    ^false
b43a8a47037c Jan's changes
vrany
parents: 13390
diff changeset
  2957
15952
e55b89f8d241 class: Method
Claus Gittinger <cg@exept.de>
parents: 15787
diff changeset
  2958
    "Created: / 05-07-2012 / 10:52:04 / Jan Vrany <jan.vrany@fit.cvut.cz>"
13422
b43a8a47037c Jan's changes
vrany
parents: 13390
diff changeset
  2959
!
b43a8a47037c Jan's changes
vrany
parents: 13390
diff changeset
  2960
12854
3a3d3c02c3bd *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 12695
diff changeset
  2961
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
  2962
    "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
  2963
     Get the source, let parser parse it using parseSelector,
1873
3544a4a94a2a checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1870
diff changeset
  2964
     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
  2965
5633
15b028ad5e03 #usedGlobals check was wrong sometimes
Claus Gittinger <cg@exept.de>
parents: 5584
diff changeset
  2966
    ^ self parse:parseSelector with:nil return:accessSelector or:valueIfNoSource
15b028ad5e03 #usedGlobals check was wrong sometimes
Claus Gittinger <cg@exept.de>
parents: 5584
diff changeset
  2967
15b028ad5e03 #usedGlobals check was wrong sometimes
Claus Gittinger <cg@exept.de>
parents: 5584
diff changeset
  2968
    "
15b028ad5e03 #usedGlobals check was wrong sometimes
Claus Gittinger <cg@exept.de>
parents: 5584
diff changeset
  2969
     (Method compiledMethodAt:#parse:return:or:)
13662
7d7ae1e5f589 changed: #annotationAtIndex:
Claus Gittinger <cg@exept.de>
parents: 13660
diff changeset
  2970
        parse:#'parseMethodSilent:' return:#sentMessages or:#()
5633
15b028ad5e03 #usedGlobals check was wrong sometimes
Claus Gittinger <cg@exept.de>
parents: 5584
diff changeset
  2971
    "
15b028ad5e03 #usedGlobals check was wrong sometimes
Claus Gittinger <cg@exept.de>
parents: 5584
diff changeset
  2972
!
15b028ad5e03 #usedGlobals check was wrong sometimes
Claus Gittinger <cg@exept.de>
parents: 5584
diff changeset
  2973
12854
3a3d3c02c3bd *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 12695
diff changeset
  2974
parse:parseSelector with:arg2 return:accessSelector or:valueIfNoSource
5633
15b028ad5e03 #usedGlobals check was wrong sometimes
Claus Gittinger <cg@exept.de>
parents: 5584
diff changeset
  2975
    "helper for methodArgNames, methodVarNames etc.
15b028ad5e03 #usedGlobals check was wrong sometimes
Claus Gittinger <cg@exept.de>
parents: 5584
diff changeset
  2976
     Get the source, let parser parse it using parseSelector,
15b028ad5e03 #usedGlobals check was wrong sometimes
Claus Gittinger <cg@exept.de>
parents: 5584
diff changeset
  2977
     return parser-info using accessSelector"
15b028ad5e03 #usedGlobals check was wrong sometimes
Claus Gittinger <cg@exept.de>
parents: 5584
diff changeset
  2978
13570
382db10e848d changed: #parse:with:return:or:
Claus Gittinger <cg@exept.de>
parents: 13569
diff changeset
  2979
    |parser parserClass sourceString cachedInfo|
8427
bba41f189196 parserClass stuff
ca
parents: 8419
diff changeset
  2980
bba41f189196 parserClass stuff
ca
parents: 8419
diff changeset
  2981
    parserClass := self parserClass.
13570
382db10e848d changed: #parse:with:return:or:
Claus Gittinger <cg@exept.de>
parents: 13569
diff changeset
  2982
14039
30251b45156a added: #flushParseTreeCache
Claus Gittinger <cg@exept.de>
parents: 13847
diff changeset
  2983
    "/ 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
  2984
    "/ 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
  2985
    "/ of them. If the same is parsed soon after, we do not have to parse again.
13570
382db10e848d changed: #parse:with:return:or:
Claus Gittinger <cg@exept.de>
parents: 13569
diff changeset
  2986
    LastParseTreeCache notNil ifTrue:[
14266
2514cbdb8e29 comment/format in: #parse:with:return:or:
Claus Gittinger <cg@exept.de>
parents: 14264
diff changeset
  2987
        "/ to flush: LastParseTreeCache removeAll.
13662
7d7ae1e5f589 changed: #annotationAtIndex:
Claus Gittinger <cg@exept.de>
parents: 13660
diff changeset
  2988
        cachedInfo := LastParseTreeCache at:self ifAbsent:nil.
7d7ae1e5f589 changed: #annotationAtIndex:
Claus Gittinger <cg@exept.de>
parents: 13660
diff changeset
  2989
        cachedInfo notNil ifTrue:[
15245
84fe46f42c9f class: Method
Claus Gittinger <cg@exept.de>
parents: 15109
diff changeset
  2990
            cachedInfo method == self ifTrue:[
84fe46f42c9f class: Method
Claus Gittinger <cg@exept.de>
parents: 15109
diff changeset
  2991
                cachedInfo parserClass == parserClass ifTrue:[
84fe46f42c9f class: Method
Claus Gittinger <cg@exept.de>
parents: 15109
diff changeset
  2992
                    "/ Transcript show:'hit '; showCR:self.
84fe46f42c9f class: Method
Claus Gittinger <cg@exept.de>
parents: 15109
diff changeset
  2993
                    ^ cachedInfo parser perform:accessSelector
84fe46f42c9f class: Method
Claus Gittinger <cg@exept.de>
parents: 15109
diff changeset
  2994
                ]
84fe46f42c9f class: Method
Claus Gittinger <cg@exept.de>
parents: 15109
diff changeset
  2995
            ].
84fe46f42c9f class: Method
Claus Gittinger <cg@exept.de>
parents: 15109
diff changeset
  2996
            LastParseTreeCache removeKey:self
13662
7d7ae1e5f589 changed: #annotationAtIndex:
Claus Gittinger <cg@exept.de>
parents: 13660
diff changeset
  2997
        ]
13570
382db10e848d changed: #parse:with:return:or:
Claus Gittinger <cg@exept.de>
parents: 13569
diff changeset
  2998
    ].
382db10e848d changed: #parse:with:return:or:
Claus Gittinger <cg@exept.de>
parents: 13569
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
    sourceString := self source.
8427
bba41f189196 parserClass stuff
ca
parents: 8419
diff changeset
  3001
    (parserClass notNil and:[sourceString notNil]) ifTrue:[
13662
7d7ae1e5f589 changed: #annotationAtIndex:
Claus Gittinger <cg@exept.de>
parents: 13660
diff changeset
  3002
        parseSelector numArgs == 2 ifTrue:[
7d7ae1e5f589 changed: #annotationAtIndex:
Claus Gittinger <cg@exept.de>
parents: 13660
diff changeset
  3003
            parser := parserClass perform:parseSelector with:sourceString with:arg2.
7d7ae1e5f589 changed: #annotationAtIndex:
Claus Gittinger <cg@exept.de>
parents: 13660
diff changeset
  3004
        ] ifFalse:[
7d7ae1e5f589 changed: #annotationAtIndex:
Claus Gittinger <cg@exept.de>
parents: 13660
diff changeset
  3005
            parser := parserClass perform:parseSelector with:sourceString.
7d7ae1e5f589 changed: #annotationAtIndex:
Claus Gittinger <cg@exept.de>
parents: 13660
diff changeset
  3006
        ].
7d7ae1e5f589 changed: #annotationAtIndex:
Claus Gittinger <cg@exept.de>
parents: 13660
diff changeset
  3007
        (parser isNil or:[parser == #Error]) ifTrue:[^ valueIfNoSource].
16261
52a0604a7b95 class: Method
Stefan Vogel <sv@exept.de>
parents: 16221
diff changeset
  3008
        "do not cache the parser, if it was parsing for code - a lot of information is missing then"
52a0604a7b95 class: Method
Stefan Vogel <sv@exept.de>
parents: 16221
diff changeset
  3009
        (self mclass notNil and:[parser wasParsedForCode not]) ifTrue:[
15425
004cda0ee7a5 class: Method
Claus Gittinger <cg@exept.de>
parents: 15424
diff changeset
  3010
            LastParseTreeCache isNil ifTrue:[
004cda0ee7a5 class: Method
Claus Gittinger <cg@exept.de>
parents: 15424
diff changeset
  3011
                LastParseTreeCache := CacheDictionary new:500.
004cda0ee7a5 class: Method
Claus Gittinger <cg@exept.de>
parents: 15424
diff changeset
  3012
            ].
004cda0ee7a5 class: Method
Claus Gittinger <cg@exept.de>
parents: 15424
diff changeset
  3013
            LastParseTreeCache at:self put:(ParserCacheEntry new parserClass:parserClass method:self parser:parser).
13662
7d7ae1e5f589 changed: #annotationAtIndex:
Claus Gittinger <cg@exept.de>
parents: 13660
diff changeset
  3014
        ].
7d7ae1e5f589 changed: #annotationAtIndex:
Claus Gittinger <cg@exept.de>
parents: 13660
diff changeset
  3015
        ^ 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
  3016
    ].
1873
3544a4a94a2a checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1870
diff changeset
  3017
    ^ valueIfNoSource
3544a4a94a2a checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1870
diff changeset
  3018
5500
8bc3b30296ae more queries (sentMessages ...)
Claus Gittinger <cg@exept.de>
parents: 5406
diff changeset
  3019
    "
15579
cc4c6bae6927 class: Method
Claus Gittinger <cg@exept.de>
parents: 15445
diff changeset
  3020
     LastParseTreeCache removeAll.
cc4c6bae6927 class: Method
Claus Gittinger <cg@exept.de>
parents: 15445
diff changeset
  3021
5500
8bc3b30296ae more queries (sentMessages ...)
Claus Gittinger <cg@exept.de>
parents: 5406
diff changeset
  3022
     (Method compiledMethodAt:#parse:return:or:)
13662
7d7ae1e5f589 changed: #annotationAtIndex:
Claus Gittinger <cg@exept.de>
parents: 13660
diff changeset
  3023
        parse:#'parseMethodSilent:' return:#sentMessages or:#()
5500
8bc3b30296ae more queries (sentMessages ...)
Claus Gittinger <cg@exept.de>
parents: 5406
diff changeset
  3024
    "
13570
382db10e848d changed: #parse:with:return:or:
Claus Gittinger <cg@exept.de>
parents: 13569
diff changeset
  3025
14039
30251b45156a added: #flushParseTreeCache
Claus Gittinger <cg@exept.de>
parents: 13847
diff changeset
  3026
    "Modified: / 01-03-2012 / 14:30:50 / cg"
15579
cc4c6bae6927 class: Method
Claus Gittinger <cg@exept.de>
parents: 15445
diff changeset
  3027
    "Modified (comment): / 30-07-2013 / 15:53:41 / 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
  3028
!
159
514c749165c3 *** empty log message ***
claus
parents: 142
diff changeset
  3029
13422
b43a8a47037c Jan's changes
vrany
parents: 13390
diff changeset
  3030
parseAnnotations
b43a8a47037c Jan's changes
vrany
parents: 13390
diff changeset
  3031
b43a8a47037c Jan's changes
vrany
parents: 13390
diff changeset
  3032
    "return the methods annotations."
b43a8a47037c Jan's changes
vrany
parents: 13390
diff changeset
  3033
b43a8a47037c Jan's changes
vrany
parents: 13390
diff changeset
  3034
    |src parser|
b43a8a47037c Jan's changes
vrany
parents: 13390
diff changeset
  3035
b43a8a47037c Jan's changes
vrany
parents: 13390
diff changeset
  3036
    src := self source.
b43a8a47037c Jan's changes
vrany
parents: 13390
diff changeset
  3037
    src isNil ifTrue:[
13662
7d7ae1e5f589 changed: #annotationAtIndex:
Claus Gittinger <cg@exept.de>
parents: 13660
diff changeset
  3038
        ^ nil "/ actually: dont know
13422
b43a8a47037c Jan's changes
vrany
parents: 13390
diff changeset
  3039
    ].
b43a8a47037c Jan's changes
vrany
parents: 13390
diff changeset
  3040
b43a8a47037c Jan's changes
vrany
parents: 13390
diff changeset
  3041
    self parserClass isNil ifTrue:[
13662
7d7ae1e5f589 changed: #annotationAtIndex:
Claus Gittinger <cg@exept.de>
parents: 13660
diff changeset
  3042
        ^ nil
13422
b43a8a47037c Jan's changes
vrany
parents: 13390
diff changeset
  3043
    ].
b43a8a47037c Jan's changes
vrany
parents: 13390
diff changeset
  3044
    parser := self parserClass parseMethod: src.
b43a8a47037c Jan's changes
vrany
parents: 13390
diff changeset
  3045
    (parser isNil or: [parser == #Error]) ifTrue:[
13662
7d7ae1e5f589 changed: #annotationAtIndex:
Claus Gittinger <cg@exept.de>
parents: 13660
diff changeset
  3046
        ^ nil "/ actually error
13422
b43a8a47037c Jan's changes
vrany
parents: 13390
diff changeset
  3047
    ].
b43a8a47037c Jan's changes
vrany
parents: 13390
diff changeset
  3048
    ^ annotations := parser annotations.
b43a8a47037c Jan's changes
vrany
parents: 13390
diff changeset
  3049
b43a8a47037c Jan's changes
vrany
parents: 13390
diff changeset
  3050
    "Created: / 10-07-2010 / 21:16:46 / Jan Vrany <jan.vrany@fit.cvut.cz>"
b43a8a47037c Jan's changes
vrany
parents: 13390
diff changeset
  3051
!
b43a8a47037c Jan's changes
vrany
parents: 13390
diff changeset
  3052
5721
5f97733ff519 methods now send change-notifications when the category changes
Claus Gittinger <cg@exept.de>
parents: 5704
diff changeset
  3053
parseResources
16218
5e87a242990b class: Method
Claus Gittinger <cg@exept.de>
parents: 16193
diff changeset
  3054
    "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
  3055
     Resources are a special kind of annotation, of the form:
5e87a242990b class: Method
Claus Gittinger <cg@exept.de>
parents: 16193
diff changeset
  3056
        <resource: #symbol...>
5e87a242990b class: Method
Claus Gittinger <cg@exept.de>
parents: 16193
diff changeset
  3057
     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
  3058
5f97733ff519 methods now send change-notifications when the category changes
Claus Gittinger <cg@exept.de>
parents: 5704
diff changeset
  3059
    |src parser|
5f97733ff519 methods now send change-notifications when the category changes
Claus Gittinger <cg@exept.de>
parents: 5704
diff changeset
  3060
5f97733ff519 methods now send change-notifications when the category changes
Claus Gittinger <cg@exept.de>
parents: 5704
diff changeset
  3061
    src := self source.
5f97733ff519 methods now send change-notifications when the category changes
Claus Gittinger <cg@exept.de>
parents: 5704
diff changeset
  3062
    src isNil ifTrue:[
13662
7d7ae1e5f589 changed: #annotationAtIndex:
Claus Gittinger <cg@exept.de>
parents: 13660
diff changeset
  3063
        ^ nil "/ actually: dont know
5721
5f97733ff519 methods now send change-notifications when the category changes
Claus Gittinger <cg@exept.de>
parents: 5704
diff changeset
  3064
    ].
5f97733ff519 methods now send change-notifications when the category changes
Claus Gittinger <cg@exept.de>
parents: 5704
diff changeset
  3065
5f97733ff519 methods now send change-notifications when the category changes
Claus Gittinger <cg@exept.de>
parents: 5704
diff changeset
  3066
    (src findString:'resource:') == 0 ifTrue:[
13662
7d7ae1e5f589 changed: #annotationAtIndex:
Claus Gittinger <cg@exept.de>
parents: 13660
diff changeset
  3067
        ^ nil "/ actually: error
5721
5f97733ff519 methods now send change-notifications when the category changes
Claus Gittinger <cg@exept.de>
parents: 5704
diff changeset
  3068
    ].
5f97733ff519 methods now send change-notifications when the category changes
Claus Gittinger <cg@exept.de>
parents: 5704
diff changeset
  3069
    "/ no need to parse all - only interested in resource-info
8427
bba41f189196 parserClass stuff
ca
parents: 8419
diff changeset
  3070
    self parserClass isNil ifTrue:[
13662
7d7ae1e5f589 changed: #annotationAtIndex:
Claus Gittinger <cg@exept.de>
parents: 13660
diff changeset
  3071
        ^ nil
8427
bba41f189196 parserClass stuff
ca
parents: 8419
diff changeset
  3072
    ].
8419
42a6fd0ef3bd allow for subclasses to redefine the parserClass
ca
parents: 8364
diff changeset
  3073
    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
  3074
    parser isNil ifTrue:[
13662
7d7ae1e5f589 changed: #annotationAtIndex:
Claus Gittinger <cg@exept.de>
parents: 13660
diff changeset
  3075
        ^ nil "/ actually error
5721
5f97733ff519 methods now send change-notifications when the category changes
Claus Gittinger <cg@exept.de>
parents: 5704
diff changeset
  3076
    ].
5f97733ff519 methods now send change-notifications when the category changes
Claus Gittinger <cg@exept.de>
parents: 5704
diff changeset
  3077
    ^ parser primitiveResources.
5f97733ff519 methods now send change-notifications when the category changes
Claus Gittinger <cg@exept.de>
parents: 5704
diff changeset
  3078
!
5f97733ff519 methods now send change-notifications when the category changes
Claus Gittinger <cg@exept.de>
parents: 5704
diff changeset
  3079
14402
Claus Gittinger <cg@exept.de>
parents: 14375
diff changeset
  3080
possiblySends:aSelectorSymbol
Claus Gittinger <cg@exept.de>
parents: 14375
diff changeset
  3081
    "return true, if this method contains an indirect message-send
Claus Gittinger <cg@exept.de>
parents: 14375
diff changeset
  3082
     (such as perform) with aSelectorSymbol as selector."
Claus Gittinger <cg@exept.de>
parents: 14375
diff changeset
  3083
Claus Gittinger <cg@exept.de>
parents: 14375
diff changeset
  3084
    (self referencesLiteral:aSelectorSymbol) ifTrue:[
Claus Gittinger <cg@exept.de>
parents: 14375
diff changeset
  3085
        ^ self messagesPossiblySent includesIdentical:aSelectorSymbol
Claus Gittinger <cg@exept.de>
parents: 14375
diff changeset
  3086
    ].
Claus Gittinger <cg@exept.de>
parents: 14375
diff changeset
  3087
    ^ false
Claus Gittinger <cg@exept.de>
parents: 14375
diff changeset
  3088
!
Claus Gittinger <cg@exept.de>
parents: 14375
diff changeset
  3089
1923
97b099fef985 optionally keep a history of changed methods
Claus Gittinger <cg@exept.de>
parents: 1873
diff changeset
  3090
previousVersion
14251
c0d549a59039 added: #previousVersions:
Claus Gittinger <cg@exept.de>
parents: 14237
diff changeset
  3091
    "return the receivers previous version's source code"
c0d549a59039 added: #previousVersions:
Claus Gittinger <cg@exept.de>
parents: 14237
diff changeset
  3092
c0d549a59039 added: #previousVersions:
Claus Gittinger <cg@exept.de>
parents: 14237
diff changeset
  3093
    |previous|
c0d549a59039 added: #previousVersions:
Claus Gittinger <cg@exept.de>
parents: 14237
diff changeset
  3094
c0d549a59039 added: #previousVersions:
Claus Gittinger <cg@exept.de>
parents: 14237
diff changeset
  3095
    previous := self previousVersions:2.
c0d549a59039 added: #previousVersions:
Claus Gittinger <cg@exept.de>
parents: 14237
diff changeset
  3096
    previous isEmptyOrNil ifTrue:[^ nil].
c0d549a59039 added: #previousVersions:
Claus Gittinger <cg@exept.de>
parents: 14237
diff changeset
  3097
    ^ previous first.
c0d549a59039 added: #previousVersions:
Claus Gittinger <cg@exept.de>
parents: 14237
diff changeset
  3098
c0d549a59039 added: #previousVersions:
Claus Gittinger <cg@exept.de>
parents: 14237
diff changeset
  3099
"/    |sel cls previous|
c0d549a59039 added: #previousVersions:
Claus Gittinger <cg@exept.de>
parents: 14237
diff changeset
  3100
"/
c0d549a59039 added: #previousVersions:
Claus Gittinger <cg@exept.de>
parents: 14237
diff changeset
  3101
"/    sel := self selector.
c0d549a59039 added: #previousVersions:
Claus Gittinger <cg@exept.de>
parents: 14237
diff changeset
  3102
"/    sel isNil ifTrue:[ ^ nil ].
c0d549a59039 added: #previousVersions:
Claus Gittinger <cg@exept.de>
parents: 14237
diff changeset
  3103
"/
c0d549a59039 added: #previousVersions:
Claus Gittinger <cg@exept.de>
parents: 14237
diff changeset
  3104
"/    cls := self mclass.
c0d549a59039 added: #previousVersions:
Claus Gittinger <cg@exept.de>
parents: 14237
diff changeset
  3105
"/    cls isNil ifTrue:[ ^ nil ].
c0d549a59039 added: #previousVersions:
Claus Gittinger <cg@exept.de>
parents: 14237
diff changeset
  3106
"/
c0d549a59039 added: #previousVersions:
Claus Gittinger <cg@exept.de>
parents: 14237
diff changeset
  3107
"/    ChangeSet current reverseDo:[:change |
c0d549a59039 added: #previousVersions:
Claus Gittinger <cg@exept.de>
parents: 14237
diff changeset
  3108
"/        (change isMethodChange
c0d549a59039 added: #previousVersions:
Claus Gittinger <cg@exept.de>
parents: 14237
diff changeset
  3109
"/            and:[ (change selector == sel)
c0d549a59039 added: #previousVersions:
Claus Gittinger <cg@exept.de>
parents: 14237
diff changeset
  3110
"/            and:[ change changeClass == cls ]])
c0d549a59039 added: #previousVersions:
Claus Gittinger <cg@exept.de>
parents: 14237
diff changeset
  3111
"/        ifTrue:[
c0d549a59039 added: #previousVersions:
Claus Gittinger <cg@exept.de>
parents: 14237
diff changeset
  3112
"/            previous := change previousVersion.
c0d549a59039 added: #previousVersions:
Claus Gittinger <cg@exept.de>
parents: 14237
diff changeset
  3113
"/            previous notNil ifTrue:[
c0d549a59039 added: #previousVersions:
Claus Gittinger <cg@exept.de>
parents: 14237
diff changeset
  3114
"/                ^ previous
c0d549a59039 added: #previousVersions:
Claus Gittinger <cg@exept.de>
parents: 14237
diff changeset
  3115
"/            ]
c0d549a59039 added: #previousVersions:
Claus Gittinger <cg@exept.de>
parents: 14237
diff changeset
  3116
"/        ]
c0d549a59039 added: #previousVersions:
Claus Gittinger <cg@exept.de>
parents: 14237
diff changeset
  3117
"/    ].
c0d549a59039 added: #previousVersions:
Claus Gittinger <cg@exept.de>
parents: 14237
diff changeset
  3118
"/    ^ nil.
6644
141198d9b865 previousVersions stuff moved from NewSystemBrowser to here
Claus Gittinger <cg@exept.de>
parents: 6541
diff changeset
  3119
141198d9b865 previousVersions stuff moved from NewSystemBrowser to here
Claus Gittinger <cg@exept.de>
parents: 6541
diff changeset
  3120
"/    history := Class methodHistory.
141198d9b865 previousVersions stuff moved from NewSystemBrowser to here
Claus Gittinger <cg@exept.de>
parents: 6541
diff changeset
  3121
"/    history isNil ifTrue:[^ nil].
141198d9b865 previousVersions stuff moved from NewSystemBrowser to here
Claus Gittinger <cg@exept.de>
parents: 6541
diff changeset
  3122
"/
141198d9b865 previousVersions stuff moved from NewSystemBrowser to here
Claus Gittinger <cg@exept.de>
parents: 6541
diff changeset
  3123
"/    entry := history detect:[:entry | |type old new|
141198d9b865 previousVersions stuff moved from NewSystemBrowser to here
Claus Gittinger <cg@exept.de>
parents: 6541
diff changeset
  3124
"/                                    type := entry first.
141198d9b865 previousVersions stuff moved from NewSystemBrowser to here
Claus Gittinger <cg@exept.de>
parents: 6541
diff changeset
  3125
"/                                    type == #methodChange ifTrue:[
141198d9b865 previousVersions stuff moved from NewSystemBrowser to here
Claus Gittinger <cg@exept.de>
parents: 6541
diff changeset
  3126
"/                                        old := entry second.
141198d9b865 previousVersions stuff moved from NewSystemBrowser to here
Claus Gittinger <cg@exept.de>
parents: 6541
diff changeset
  3127
"/                                        new := entry third.
141198d9b865 previousVersions stuff moved from NewSystemBrowser to here
Claus Gittinger <cg@exept.de>
parents: 6541
diff changeset
  3128
"/                                        new == self
141198d9b865 previousVersions stuff moved from NewSystemBrowser to here
Claus Gittinger <cg@exept.de>
parents: 6541
diff changeset
  3129
"/                                    ] ifFalse:[
141198d9b865 previousVersions stuff moved from NewSystemBrowser to here
Claus Gittinger <cg@exept.de>
parents: 6541
diff changeset
  3130
"/                                        false
141198d9b865 previousVersions stuff moved from NewSystemBrowser to here
Claus Gittinger <cg@exept.de>
parents: 6541
diff changeset
  3131
"/                                    ]
12854
3a3d3c02c3bd *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 12695
diff changeset
  3132
"/                             ]
6644
141198d9b865 previousVersions stuff moved from NewSystemBrowser to here
Claus Gittinger <cg@exept.de>
parents: 6541
diff changeset
  3133
"/                     ifNone:nil.
141198d9b865 previousVersions stuff moved from NewSystemBrowser to here
Claus Gittinger <cg@exept.de>
parents: 6541
diff changeset
  3134
"/    entry isNil ifTrue:[^nil].
141198d9b865 previousVersions stuff moved from NewSystemBrowser to here
Claus Gittinger <cg@exept.de>
parents: 6541
diff changeset
  3135
"/    ^ entry second.
5339
c922450b57b5 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5324
diff changeset
  3136
"/    ^ history at:self ifAbsent:nil
1923
97b099fef985 optionally keep a history of changed methods
Claus Gittinger <cg@exept.de>
parents: 1873
diff changeset
  3137
14251
c0d549a59039 added: #previousVersions:
Claus Gittinger <cg@exept.de>
parents: 14237
diff changeset
  3138
    "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
  3139
!
97b099fef985 optionally keep a history of changed methods
Claus Gittinger <cg@exept.de>
parents: 1873
diff changeset
  3140
7210
80bb33c02780 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 7085
diff changeset
  3141
previousVersionCode
80bb33c02780 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 7085
diff changeset
  3142
    "return the receivers previous versions source code"
80bb33c02780 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 7085
diff changeset
  3143
80bb33c02780 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 7085
diff changeset
  3144
    |previous|
80bb33c02780 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 7085
diff changeset
  3145
80bb33c02780 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 7085
diff changeset
  3146
    previous := self previousVersion.
80bb33c02780 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 7085
diff changeset
  3147
    previous isNil ifTrue:[ ^ nil ].
80bb33c02780 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 7085
diff changeset
  3148
80bb33c02780 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 7085
diff changeset
  3149
    ^ previous source
80bb33c02780 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 7085
diff changeset
  3150
!
80bb33c02780 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 7085
diff changeset
  3151
6644
141198d9b865 previousVersions stuff moved from NewSystemBrowser to here
Claus Gittinger <cg@exept.de>
parents: 6541
diff changeset
  3152
previousVersions
14251
c0d549a59039 added: #previousVersions:
Claus Gittinger <cg@exept.de>
parents: 14237
diff changeset
  3153
    "return a collection of the receiver's previous versions (sources)"
c0d549a59039 added: #previousVersions:
Claus Gittinger <cg@exept.de>
parents: 14237
diff changeset
  3154
c0d549a59039 added: #previousVersions:
Claus Gittinger <cg@exept.de>
parents: 14237
diff changeset
  3155
    ^ self previousVersions:nil
c0d549a59039 added: #previousVersions:
Claus Gittinger <cg@exept.de>
parents: 14237
diff changeset
  3156
c0d549a59039 added: #previousVersions:
Claus Gittinger <cg@exept.de>
parents: 14237
diff changeset
  3157
    "Modified (comment): / 26-07-2012 / 12:04:15 / cg"
c0d549a59039 added: #previousVersions:
Claus Gittinger <cg@exept.de>
parents: 14237
diff changeset
  3158
!
c0d549a59039 added: #previousVersions:
Claus Gittinger <cg@exept.de>
parents: 14237
diff changeset
  3159
c0d549a59039 added: #previousVersions:
Claus Gittinger <cg@exept.de>
parents: 14237
diff changeset
  3160
previousVersions:count
c0d549a59039 added: #previousVersions:
Claus Gittinger <cg@exept.de>
parents: 14237
diff changeset
  3161
    "return a collection of the receiver's count previous versions (sources).
c0d549a59039 added: #previousVersions:
Claus Gittinger <cg@exept.de>
parents: 14237
diff changeset
  3162
     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
  3163
7453
48c427d125f4 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 7328
diff changeset
  3164
    |sel cls versions lastChange firstSrc last|
6644
141198d9b865 previousVersions stuff moved from NewSystemBrowser to here
Claus Gittinger <cg@exept.de>
parents: 6541
diff changeset
  3165
141198d9b865 previousVersions stuff moved from NewSystemBrowser to here
Claus Gittinger <cg@exept.de>
parents: 6541
diff changeset
  3166
    sel := self selector.
141198d9b865 previousVersions stuff moved from NewSystemBrowser to here
Claus Gittinger <cg@exept.de>
parents: 6541
diff changeset
  3167
    sel isNil ifTrue:[^ #()].
141198d9b865 previousVersions stuff moved from NewSystemBrowser to here
Claus Gittinger <cg@exept.de>
parents: 6541
diff changeset
  3168
141198d9b865 previousVersions stuff moved from NewSystemBrowser to here
Claus Gittinger <cg@exept.de>
parents: 6541
diff changeset
  3169
    cls := self mclass.
141198d9b865 previousVersions stuff moved from NewSystemBrowser to here
Claus Gittinger <cg@exept.de>
parents: 6541
diff changeset
  3170
    cls isNil ifTrue:[^ #()].
141198d9b865 previousVersions stuff moved from NewSystemBrowser to here
Claus Gittinger <cg@exept.de>
parents: 6541
diff changeset
  3171
141198d9b865 previousVersions stuff moved from NewSystemBrowser to here
Claus Gittinger <cg@exept.de>
parents: 6541
diff changeset
  3172
    versions := OrderedCollection new.
141198d9b865 previousVersions stuff moved from NewSystemBrowser to here
Claus Gittinger <cg@exept.de>
parents: 6541
diff changeset
  3173
12854
3a3d3c02c3bd *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 12695
diff changeset
  3174
    ChangeSet current reverseDo:[:change |
14251
c0d549a59039 added: #previousVersions:
Claus Gittinger <cg@exept.de>
parents: 14237
diff changeset
  3175
        (change isMethodChange
c0d549a59039 added: #previousVersions:
Claus Gittinger <cg@exept.de>
parents: 14237
diff changeset
  3176
            and:[ (change selector == sel)
c0d549a59039 added: #previousVersions:
Claus Gittinger <cg@exept.de>
parents: 14237
diff changeset
  3177
            and:[ change changeClass == cls ]])
13662
7d7ae1e5f589 changed: #annotationAtIndex:
Claus Gittinger <cg@exept.de>
parents: 13660
diff changeset
  3178
        ifTrue:[
7d7ae1e5f589 changed: #annotationAtIndex:
Claus Gittinger <cg@exept.de>
parents: 13660
diff changeset
  3179
            versions addFirst:change.
7d7ae1e5f589 changed: #annotationAtIndex:
Claus Gittinger <cg@exept.de>
parents: 13660
diff changeset
  3180
            lastChange := change.
14251
c0d549a59039 added: #previousVersions:
Claus Gittinger <cg@exept.de>
parents: 14237
diff changeset
  3181
            (count notNil and:[versions size == count]) ifTrue:[
c0d549a59039 added: #previousVersions:
Claus Gittinger <cg@exept.de>
parents: 14237
diff changeset
  3182
                ^ versions
c0d549a59039 added: #previousVersions:
Claus Gittinger <cg@exept.de>
parents: 14237
diff changeset
  3183
            ]
13662
7d7ae1e5f589 changed: #annotationAtIndex:
Claus Gittinger <cg@exept.de>
parents: 13660
diff changeset
  3184
        ]
6644
141198d9b865 previousVersions stuff moved from NewSystemBrowser to here
Claus Gittinger <cg@exept.de>
parents: 6541
diff changeset
  3185
    ].
141198d9b865 previousVersions stuff moved from NewSystemBrowser to here
Claus Gittinger <cg@exept.de>
parents: 6541
diff changeset
  3186
141198d9b865 previousVersions stuff moved from NewSystemBrowser to here
Claus Gittinger <cg@exept.de>
parents: 6541
diff changeset
  3187
    lastChange notNil ifTrue:[
13662
7d7ae1e5f589 changed: #annotationAtIndex:
Claus Gittinger <cg@exept.de>
parents: 13660
diff changeset
  3188
        last := lastChange previousVersion.
7d7ae1e5f589 changed: #annotationAtIndex:
Claus Gittinger <cg@exept.de>
parents: 13660
diff changeset
  3189
        last notNil ifTrue:[
7d7ae1e5f589 changed: #annotationAtIndex:
Claus Gittinger <cg@exept.de>
parents: 13660
diff changeset
  3190
            firstSrc := last source.
16261
52a0604a7b95 class: Method
Stefan Vogel <sv@exept.de>
parents: 16221
diff changeset
  3191
            (firstSrc notEmptyOrNil
13662
7d7ae1e5f589 changed: #annotationAtIndex:
Claus Gittinger <cg@exept.de>
parents: 13660
diff changeset
  3192
            and:[ firstSrc ~= lastChange source]) ifTrue:[
7d7ae1e5f589 changed: #annotationAtIndex:
Claus Gittinger <cg@exept.de>
parents: 13660
diff changeset
  3193
                versions addFirst:(MethodChange
7d7ae1e5f589 changed: #annotationAtIndex:
Claus Gittinger <cg@exept.de>
parents: 13660
diff changeset
  3194
                                    className:lastChange className
7d7ae1e5f589 changed: #annotationAtIndex:
Claus Gittinger <cg@exept.de>
parents: 13660
diff changeset
  3195
                                    selector:lastChange selector
7d7ae1e5f589 changed: #annotationAtIndex:
Claus Gittinger <cg@exept.de>
parents: 13660
diff changeset
  3196
                                    source:firstSrc
7d7ae1e5f589 changed: #annotationAtIndex:
Claus Gittinger <cg@exept.de>
parents: 13660
diff changeset
  3197
                                    category:lastChange category).
7d7ae1e5f589 changed: #annotationAtIndex:
Claus Gittinger <cg@exept.de>
parents: 13660
diff changeset
  3198
            ]
7d7ae1e5f589 changed: #annotationAtIndex:
Claus Gittinger <cg@exept.de>
parents: 13660
diff changeset
  3199
        ]
6644
141198d9b865 previousVersions stuff moved from NewSystemBrowser to here
Claus Gittinger <cg@exept.de>
parents: 6541
diff changeset
  3200
    ].
141198d9b865 previousVersions stuff moved from NewSystemBrowser to here
Claus Gittinger <cg@exept.de>
parents: 6541
diff changeset
  3201
    ^ versions
14251
c0d549a59039 added: #previousVersions:
Claus Gittinger <cg@exept.de>
parents: 14237
diff changeset
  3202
c0d549a59039 added: #previousVersions:
Claus Gittinger <cg@exept.de>
parents: 14237
diff changeset
  3203
    "
c0d549a59039 added: #previousVersions:
Claus Gittinger <cg@exept.de>
parents: 14237
diff changeset
  3204
     (Method compiledMethodAt:#previousVersions:) previousVersions:nil
c0d549a59039 added: #previousVersions:
Claus Gittinger <cg@exept.de>
parents: 14237
diff changeset
  3205
    "
c0d549a59039 added: #previousVersions:
Claus Gittinger <cg@exept.de>
parents: 14237
diff changeset
  3206
c0d549a59039 added: #previousVersions:
Claus Gittinger <cg@exept.de>
parents: 14237
diff changeset
  3207
    "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
  3208
!
141198d9b865 previousVersions stuff moved from NewSystemBrowser to here
Claus Gittinger <cg@exept.de>
parents: 6541
diff changeset
  3209
5564
0f513f04c50f #readsFields: and #writesField: for st80 compatibility
Claus Gittinger <cg@exept.de>
parents: 5562
diff changeset
  3210
readsField:instVarIndex
0f513f04c50f #readsFields: and #writesField: for st80 compatibility
Claus Gittinger <cg@exept.de>
parents: 5562
diff changeset
  3211
    "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
  3212
     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
  3213
14237
Claus Gittinger <cg@exept.de>
parents: 14236
diff changeset
  3214
    |instVarName|
Claus Gittinger <cg@exept.de>
parents: 14236
diff changeset
  3215
Claus Gittinger <cg@exept.de>
parents: 14236
diff changeset
  3216
    instVarName := (self mclass allInstVarNames) at:instVarIndex.
Claus Gittinger <cg@exept.de>
parents: 14236
diff changeset
  3217
    ^ self readsInstVar:instVarName
Claus Gittinger <cg@exept.de>
parents: 14236
diff changeset
  3218
Claus Gittinger <cg@exept.de>
parents: 14236
diff changeset
  3219
    "Modified: / 23-07-2012 / 11:16:08 / cg"
Claus Gittinger <cg@exept.de>
parents: 14236
diff changeset
  3220
!
Claus Gittinger <cg@exept.de>
parents: 14236
diff changeset
  3221
Claus Gittinger <cg@exept.de>
parents: 14236
diff changeset
  3222
readsInstVar:instVarName
Claus Gittinger <cg@exept.de>
parents: 14236
diff changeset
  3223
    "return true, if the named instvar is read by the receiver.
Claus Gittinger <cg@exept.de>
parents: 14236
diff changeset
  3224
     Uses parser (for now); could look at bytecode as well here..."
Claus Gittinger <cg@exept.de>
parents: 14236
diff changeset
  3225
Claus Gittinger <cg@exept.de>
parents: 14236
diff changeset
  3226
    |readInstVars|
Claus Gittinger <cg@exept.de>
parents: 14236
diff changeset
  3227
Claus Gittinger <cg@exept.de>
parents: 14236
diff changeset
  3228
    (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
  3229
    readInstVars := self parse:#'parseMethodSilent:in:' with:self mclass  return:#readInstVars or:#().
14237
Claus Gittinger <cg@exept.de>
parents: 14236
diff changeset
  3230
    ^ readInstVars includes:instVarName.
Claus Gittinger <cg@exept.de>
parents: 14236
diff changeset
  3231
Claus Gittinger <cg@exept.de>
parents: 14236
diff changeset
  3232
    "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
  3233
!
0f513f04c50f #readsFields: and #writesField: for st80 compatibility
Claus Gittinger <cg@exept.de>
parents: 5562
diff changeset
  3234
14253
Claus Gittinger <cg@exept.de>
parents: 14251
diff changeset
  3235
refersToLiteral: anObject
Claus Gittinger <cg@exept.de>
parents: 14251
diff changeset
  3236
    "redefined to search in annotations"
Claus Gittinger <cg@exept.de>
parents: 14251
diff changeset
  3237
Claus Gittinger <cg@exept.de>
parents: 14251
diff changeset
  3238
    (super refersToLiteral: anObject) ifTrue:[^ true].
Claus Gittinger <cg@exept.de>
parents: 14251
diff changeset
  3239
15387
f8f6247b071f class: Method
Claus Gittinger <cg@exept.de>
parents: 15346
diff changeset
  3240
    self annotationsDo:[:annot |
f8f6247b071f class: Method
Claus Gittinger <cg@exept.de>
parents: 15346
diff changeset
  3241
        (annot refersToLiteral: anObject) ifTrue:[
15416
0d02e659675b class: Method
Claus Gittinger <cg@exept.de>
parents: 15413
diff changeset
  3242
            "/ self halt.
15387
f8f6247b071f class: Method
Claus Gittinger <cg@exept.de>
parents: 15346
diff changeset
  3243
            ^ true
14253
Claus Gittinger <cg@exept.de>
parents: 14251
diff changeset
  3244
        ].
Claus Gittinger <cg@exept.de>
parents: 14251
diff changeset
  3245
    ].
Claus Gittinger <cg@exept.de>
parents: 14251
diff changeset
  3246
    ^ false
Claus Gittinger <cg@exept.de>
parents: 14251
diff changeset
  3247
Claus Gittinger <cg@exept.de>
parents: 14251
diff changeset
  3248
    "Created: / 26-07-2012 / 15:51:14 / cg"
Claus Gittinger <cg@exept.de>
parents: 14251
diff changeset
  3249
!
Claus Gittinger <cg@exept.de>
parents: 14251
diff changeset
  3250
Claus Gittinger <cg@exept.de>
parents: 14251
diff changeset
  3251
refersToLiteralMatching: aMatchString
Claus Gittinger <cg@exept.de>
parents: 14251
diff changeset
  3252
    (super refersToLiteralMatching: aMatchString) ifTrue:[^ true].
Claus Gittinger <cg@exept.de>
parents: 14251
diff changeset
  3253
15387
f8f6247b071f class: Method
Claus Gittinger <cg@exept.de>
parents: 15346
diff changeset
  3254
    self annotationsDo:[:annot |
f8f6247b071f class: Method
Claus Gittinger <cg@exept.de>
parents: 15346
diff changeset
  3255
        (annot refersToLiteralMatching: aMatchString) ifTrue:[
15416
0d02e659675b class: Method
Claus Gittinger <cg@exept.de>
parents: 15413
diff changeset
  3256
            "/ self halt.
15387
f8f6247b071f class: Method
Claus Gittinger <cg@exept.de>
parents: 15346
diff changeset
  3257
            ^ true
14253
Claus Gittinger <cg@exept.de>
parents: 14251
diff changeset
  3258
        ].
Claus Gittinger <cg@exept.de>
parents: 14251
diff changeset
  3259
    ].
Claus Gittinger <cg@exept.de>
parents: 14251
diff changeset
  3260
    ^ false
Claus Gittinger <cg@exept.de>
parents: 14251
diff changeset
  3261
Claus Gittinger <cg@exept.de>
parents: 14251
diff changeset
  3262
    "Created: / 26-07-2012 / 15:51:36 / cg"
Claus Gittinger <cg@exept.de>
parents: 14251
diff changeset
  3263
!
Claus Gittinger <cg@exept.de>
parents: 14251
diff changeset
  3264
3052
f384e7082ee9 more resource stuff (VW compatibility)
Claus Gittinger <cg@exept.de>
parents: 3030
diff changeset
  3265
resourceType
f384e7082ee9 more resource stuff (VW compatibility)
Claus Gittinger <cg@exept.de>
parents: 3030
diff changeset
  3266
    "ST-80 compatibility:
12854
3a3d3c02c3bd *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 12695
diff changeset
  3267
     return the methods first resource specs key.
8526
326e7dcb212a *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 8518
diff changeset
  3268
     Returns either nil, or a single symbol."
3052
f384e7082ee9 more resource stuff (VW compatibility)
Claus Gittinger <cg@exept.de>
parents: 3030
diff changeset
  3269
3387
dbe1b3cf7b83 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 3372
diff changeset
  3270
    |resources|
dbe1b3cf7b83 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 3372
diff changeset
  3271
dbe1b3cf7b83 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 3372
diff changeset
  3272
    (resources := self resources) notNil ifTrue:[
13662
7d7ae1e5f589 changed: #annotationAtIndex:
Claus Gittinger <cg@exept.de>
parents: 13660
diff changeset
  3273
        resources keysAndValuesDo:[:key :val|
7d7ae1e5f589 changed: #annotationAtIndex:
Claus Gittinger <cg@exept.de>
parents: 13660
diff changeset
  3274
            ^ key
7d7ae1e5f589 changed: #annotationAtIndex:
Claus Gittinger <cg@exept.de>
parents: 13660
diff changeset
  3275
        ].
3341
c5773eb96bd2 resource icons moved to class BrowserView
tz
parents: 3297
diff changeset
  3276
    ].
3387
dbe1b3cf7b83 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 3372
diff changeset
  3277
    ^ nil
3052
f384e7082ee9 more resource stuff (VW compatibility)
Claus Gittinger <cg@exept.de>
parents: 3030
diff changeset
  3278
!
f384e7082ee9 more resource stuff (VW compatibility)
Claus Gittinger <cg@exept.de>
parents: 3030
diff changeset
  3279
f384e7082ee9 more resource stuff (VW compatibility)
Claus Gittinger <cg@exept.de>
parents: 3030
diff changeset
  3280
resources
5894
ed6193fa6040 Define #isObsolete and fix various comments
Stefan Vogel <sv@exept.de>
parents: 5818
diff changeset
  3281
    "return the methods resource spec; either nil or a collection of symbols."
3052
f384e7082ee9 more resource stuff (VW compatibility)
Claus Gittinger <cg@exept.de>
parents: 3030
diff changeset
  3282
13422
b43a8a47037c Jan's changes
vrany
parents: 13390
diff changeset
  3283
    | resources |
13817
7d1e0e8ea364 changed:10 methods
Claus Gittinger <cg@exept.de>
parents: 13805
diff changeset
  3284
3052
f384e7082ee9 more resource stuff (VW compatibility)
Claus Gittinger <cg@exept.de>
parents: 3030
diff changeset
  3285
    self hasResource ifFalse:[^ nil].
13817
7d1e0e8ea364 changed:10 methods
Claus Gittinger <cg@exept.de>
parents: 13805
diff changeset
  3286
    annotations isNil ifTrue:[^ self parseResources].
13422
b43a8a47037c Jan's changes
vrany
parents: 13390
diff changeset
  3287
b43a8a47037c Jan's changes
vrany
parents: 13390
diff changeset
  3288
    resources := IdentityDictionary new.
13817
7d1e0e8ea364 changed:10 methods
Claus Gittinger <cg@exept.de>
parents: 13805
diff changeset
  3289
    self annotationsAt: #resource: orAt: #resource:value: do:[:annot|
7d1e0e8ea364 changed:10 methods
Claus Gittinger <cg@exept.de>
parents: 13805
diff changeset
  3290
        resources at: annot type put: annot value ? true
7d1e0e8ea364 changed:10 methods
Claus Gittinger <cg@exept.de>
parents: 13805
diff changeset
  3291
    ].
7d1e0e8ea364 changed:10 methods
Claus Gittinger <cg@exept.de>
parents: 13805
diff changeset
  3292
    ^ resources
13422
b43a8a47037c Jan's changes
vrany
parents: 13390
diff changeset
  3293
b43a8a47037c Jan's changes
vrany
parents: 13390
diff changeset
  3294
    "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
  3295
    "Modified: / 18-11-2011 / 14:48:41 / cg"
3052
f384e7082ee9 more resource stuff (VW compatibility)
Claus Gittinger <cg@exept.de>
parents: 3030
diff changeset
  3296
!
f384e7082ee9 more resource stuff (VW compatibility)
Claus Gittinger <cg@exept.de>
parents: 3030
diff changeset
  3297
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
  3298
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
  3299
    "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
  3300
     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
  3301
     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
  3302
d600e08a5936 handle the case where a method has a sourceFileInfo, but the class has not
Claus Gittinger <cg@exept.de>
parents: 934
diff changeset
  3303
    "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
  3304
1851
4accc9fafd19 change #who to return a proper object
Claus Gittinger <cg@exept.de>
parents: 1813
diff changeset
  3305
    |who|
68
59faa75185ba *** empty log message ***
claus
parents: 56
diff changeset
  3306
1851
4accc9fafd19 change #who to return a proper object
Claus Gittinger <cg@exept.de>
parents: 1813
diff changeset
  3307
    who := self who.
4accc9fafd19 change #who to return a proper object
Claus Gittinger <cg@exept.de>
parents: 1813
diff changeset
  3308
    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
  3309
    "
d600e08a5936 handle the case where a method has a sourceFileInfo, but the class has not
Claus Gittinger <cg@exept.de>
parents: 934
diff changeset
  3310
     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
  3311
    "
d600e08a5936 handle the case where a method has a sourceFileInfo, but the class has not
Claus Gittinger <cg@exept.de>
parents: 934
diff changeset
  3312
    ^ 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
  3313
d600e08a5936 handle the case where a method has a sourceFileInfo, but the class has not
Claus Gittinger <cg@exept.de>
parents: 934
diff changeset
  3314
    "
d600e08a5936 handle the case where a method has a sourceFileInfo, but the class has not
Claus Gittinger <cg@exept.de>
parents: 934
diff changeset
  3315
     |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
  3316
     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
  3317
     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
  3318
    "
1851
4accc9fafd19 change #who to return a proper object
Claus Gittinger <cg@exept.de>
parents: 1813
diff changeset
  3319
4accc9fafd19 change #who to return a proper object
Claus Gittinger <cg@exept.de>
parents: 1813
diff changeset
  3320
    "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
  3321
!
68
59faa75185ba *** empty log message ***
claus
parents: 56
diff changeset
  3322
5534
bf00d9a2dfd5 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5530
diff changeset
  3323
sends:aSelectorSymbol
bf00d9a2dfd5 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5530
diff changeset
  3324
    "return true, if this method contains a message-send
bf00d9a2dfd5 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5530
diff changeset
  3325
     with aSelectorSymbol as selector."
bf00d9a2dfd5 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5530
diff changeset
  3326
bf00d9a2dfd5 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5530
diff changeset
  3327
    (self referencesLiteral:aSelectorSymbol) ifTrue:[
15768
2b282d2c832a class: Method
Claus Gittinger <cg@exept.de>
parents: 15727
diff changeset
  3328
        ^ true.
13662
7d7ae1e5f589 changed: #annotationAtIndex:
Claus Gittinger <cg@exept.de>
parents: 13660
diff changeset
  3329
        ^ self messagesSent includesIdentical:aSelectorSymbol
5534
bf00d9a2dfd5 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5530
diff changeset
  3330
    ].
bf00d9a2dfd5 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5530
diff changeset
  3331
    ^ false
bf00d9a2dfd5 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5530
diff changeset
  3332
!
bf00d9a2dfd5 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5530
diff changeset
  3333
12363
a7251dc427bd added: #sends:or:
Claus Gittinger <cg@exept.de>
parents: 12324
diff changeset
  3334
sends:selectorSymbol1 or:selectorSymbol2
a7251dc427bd added: #sends:or:
Claus Gittinger <cg@exept.de>
parents: 12324
diff changeset
  3335
    "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
  3336
     to either selectorSymbol1 or selectorSymbol2.
82bcca38e855 comment/format in: #sends:or:
Claus Gittinger <cg@exept.de>
parents: 13567
diff changeset
  3337
     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
  3338
a7251dc427bd added: #sends:or:
Claus Gittinger <cg@exept.de>
parents: 12324
diff changeset
  3339
    |msgs|
a7251dc427bd added: #sends:or:
Claus Gittinger <cg@exept.de>
parents: 12324
diff changeset
  3340
a7251dc427bd added: #sends:or:
Claus Gittinger <cg@exept.de>
parents: 12324
diff changeset
  3341
    ((self referencesLiteral:selectorSymbol1) or:[self referencesLiteral:selectorSymbol2]) ifTrue:[
15768
2b282d2c832a class: Method
Claus Gittinger <cg@exept.de>
parents: 15727
diff changeset
  3342
        ^ true.
13662
7d7ae1e5f589 changed: #annotationAtIndex:
Claus Gittinger <cg@exept.de>
parents: 13660
diff changeset
  3343
        msgs := self messagesSent.
7d7ae1e5f589 changed: #annotationAtIndex:
Claus Gittinger <cg@exept.de>
parents: 13660
diff changeset
  3344
        ^ (msgs includesIdentical:selectorSymbol1) or:[msgs includesIdentical:selectorSymbol2]
12363
a7251dc427bd added: #sends:or:
Claus Gittinger <cg@exept.de>
parents: 12324
diff changeset
  3345
    ].
a7251dc427bd added: #sends:or:
Claus Gittinger <cg@exept.de>
parents: 12324
diff changeset
  3346
    ^ false
13569
82bcca38e855 comment/format in: #sends:or:
Claus Gittinger <cg@exept.de>
parents: 13567
diff changeset
  3347
82bcca38e855 comment/format in: #sends:or:
Claus Gittinger <cg@exept.de>
parents: 13567
diff changeset
  3348
    "Modified (comment): / 08-08-2011 / 18:43:04 / cg"
12363
a7251dc427bd added: #sends:or:
Claus Gittinger <cg@exept.de>
parents: 12324
diff changeset
  3349
!
a7251dc427bd added: #sends:or:
Claus Gittinger <cg@exept.de>
parents: 12324
diff changeset
  3350
13570
382db10e848d changed: #parse:with:return:or:
Claus Gittinger <cg@exept.de>
parents: 13569
diff changeset
  3351
sendsAny:aCollectionOfSelectorSymbols
382db10e848d changed: #parse:with:return:or:
Claus Gittinger <cg@exept.de>
parents: 13569
diff changeset
  3352
    "return true, if this method contains a message-send
382db10e848d changed: #parse:with:return:or:
Claus Gittinger <cg@exept.de>
parents: 13569
diff changeset
  3353
     to any of aCollectionOfSelectorSymbols."
382db10e848d changed: #parse:with:return:or:
Claus Gittinger <cg@exept.de>
parents: 13569
diff changeset
  3354
382db10e848d changed: #parse:with:return:or:
Claus Gittinger <cg@exept.de>
parents: 13569
diff changeset
  3355
    |msgs|
382db10e848d changed: #parse:with:return:or:
Claus Gittinger <cg@exept.de>
parents: 13569
diff changeset
  3356
382db10e848d changed: #parse:with:return:or:
Claus Gittinger <cg@exept.de>
parents: 13569
diff changeset
  3357
    (aCollectionOfSelectorSymbols contains:[:sym | self referencesLiteral:sym]) ifTrue:[
15768
2b282d2c832a class: Method
Claus Gittinger <cg@exept.de>
parents: 15727
diff changeset
  3358
        ^ true.
13662
7d7ae1e5f589 changed: #annotationAtIndex:
Claus Gittinger <cg@exept.de>
parents: 13660
diff changeset
  3359
        msgs := self messagesSent.
7d7ae1e5f589 changed: #annotationAtIndex:
Claus Gittinger <cg@exept.de>
parents: 13660
diff changeset
  3360
        ^ aCollectionOfSelectorSymbols contains:[:sym | msgs includesIdentical:sym]
13570
382db10e848d changed: #parse:with:return:or:
Claus Gittinger <cg@exept.de>
parents: 13569
diff changeset
  3361
    ].
382db10e848d changed: #parse:with:return:or:
Claus Gittinger <cg@exept.de>
parents: 13569
diff changeset
  3362
    ^ false
382db10e848d changed: #parse:with:return:or:
Claus Gittinger <cg@exept.de>
parents: 13569
diff changeset
  3363
382db10e848d changed: #parse:with:return:or:
Claus Gittinger <cg@exept.de>
parents: 13569
diff changeset
  3364
    "Created: / 08-08-2011 / 18:53:24 / cg"
382db10e848d changed: #parse:with:return:or:
Claus Gittinger <cg@exept.de>
parents: 13569
diff changeset
  3365
!
382db10e848d changed: #parse:with:return:or:
Claus Gittinger <cg@exept.de>
parents: 13569
diff changeset
  3366
11022
8dd9f699915f +shouldBeSkippedInDebuggersWalkBack
Claus Gittinger <cg@exept.de>
parents: 11016
diff changeset
  3367
shouldBeSkippedInDebuggersWalkBack
8dd9f699915f +shouldBeSkippedInDebuggersWalkBack
Claus Gittinger <cg@exept.de>
parents: 11016
diff changeset
  3368
    "return true, if this method thinks, it should be skipped in a walkback.
8dd9f699915f +shouldBeSkippedInDebuggersWalkBack
Claus Gittinger <cg@exept.de>
parents: 11016
diff changeset
  3369
     This is done by looking for a #skipInDebuggersWalkBack flag in the methods resources."
8dd9f699915f +shouldBeSkippedInDebuggersWalkBack
Claus Gittinger <cg@exept.de>
parents: 11016
diff changeset
  3370
8dd9f699915f +shouldBeSkippedInDebuggersWalkBack
Claus Gittinger <cg@exept.de>
parents: 11016
diff changeset
  3371
    |resources|
8dd9f699915f +shouldBeSkippedInDebuggersWalkBack
Claus Gittinger <cg@exept.de>
parents: 11016
diff changeset
  3372
8dd9f699915f +shouldBeSkippedInDebuggersWalkBack
Claus Gittinger <cg@exept.de>
parents: 11016
diff changeset
  3373
    resources := self resources.
8dd9f699915f +shouldBeSkippedInDebuggersWalkBack
Claus Gittinger <cg@exept.de>
parents: 11016
diff changeset
  3374
    ^ resources notNil and:[ resources includesKey:#skipInDebuggersWalkBack ].
8dd9f699915f +shouldBeSkippedInDebuggersWalkBack
Claus Gittinger <cg@exept.de>
parents: 11016
diff changeset
  3375
!
8dd9f699915f +shouldBeSkippedInDebuggersWalkBack
Claus Gittinger <cg@exept.de>
parents: 11016
diff changeset
  3376
5696
958a0643496d compatibility
Claus Gittinger <cg@exept.de>
parents: 5676
diff changeset
  3377
superMessages
958a0643496d compatibility
Claus Gittinger <cg@exept.de>
parents: 5676
diff changeset
  3378
    "return a collection of message-selectors, sent to super by this method."
958a0643496d compatibility
Claus Gittinger <cg@exept.de>
parents: 5676
diff changeset
  3379
958a0643496d compatibility
Claus Gittinger <cg@exept.de>
parents: 5676
diff changeset
  3380
    ^ self messagesSentToSuper
958a0643496d compatibility
Claus Gittinger <cg@exept.de>
parents: 5676
diff changeset
  3381
!
958a0643496d compatibility
Claus Gittinger <cg@exept.de>
parents: 5676
diff changeset
  3382
5523
86ad12f4afc9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5509
diff changeset
  3383
usedGlobals
86ad12f4afc9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5509
diff changeset
  3384
    "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
  3385
     Uses Parser to parse methods source and extract them."
86ad12f4afc9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5509
diff changeset
  3386
12854
3a3d3c02c3bd *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 12695
diff changeset
  3387
    ^ self parse:#'parseMethodSilent:in:' with:self mclass return:#usedGlobals or:#()
5523
86ad12f4afc9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5509
diff changeset
  3388
86ad12f4afc9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5509
diff changeset
  3389
    "
12854
3a3d3c02c3bd *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 12695
diff changeset
  3390
     (Method compiledMethodAt:#resources) usedGlobals
5523
86ad12f4afc9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5509
diff changeset
  3391
    "
86ad12f4afc9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5509
diff changeset
  3392
!
86ad12f4afc9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5509
diff changeset
  3393
5509
c0277123fe4a added #usedSymbols query
Claus Gittinger <cg@exept.de>
parents: 5500
diff changeset
  3394
usedSymbols
c0277123fe4a added #usedSymbols query
Claus Gittinger <cg@exept.de>
parents: 5500
diff changeset
  3395
    "return a collection with the symbols referred to by the receiver.
c0277123fe4a added #usedSymbols query
Claus Gittinger <cg@exept.de>
parents: 5500
diff changeset
  3396
     Uses Parser to parse methods source and extract them.
12854
3a3d3c02c3bd *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 12695
diff changeset
  3397
     This collection only includes implicit symbols references
8895
81e4e78ef244 comment
Claus Gittinger <cg@exept.de>
parents: 8854
diff changeset
  3398
     (i.e. not messages sent)"
5509
c0277123fe4a added #usedSymbols query
Claus Gittinger <cg@exept.de>
parents: 5500
diff changeset
  3399
12854
3a3d3c02c3bd *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 12695
diff changeset
  3400
    ^ self parse:#'parseMethodSilent:in:' with:self mclass return:#usedSymbols or:#()
5509
c0277123fe4a added #usedSymbols query
Claus Gittinger <cg@exept.de>
parents: 5500
diff changeset
  3401
c0277123fe4a added #usedSymbols query
Claus Gittinger <cg@exept.de>
parents: 5500
diff changeset
  3402
    "
12854
3a3d3c02c3bd *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 12695
diff changeset
  3403
     (Method compiledMethodAt:#usedSymbols) usedSymbols
3a3d3c02c3bd *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 12695
diff changeset
  3404
     (Method compiledMethodAt:#usedSymbols) messagesSent
5509
c0277123fe4a added #usedSymbols query
Claus Gittinger <cg@exept.de>
parents: 5500
diff changeset
  3405
    "
c0277123fe4a added #usedSymbols query
Claus Gittinger <cg@exept.de>
parents: 5500
diff changeset
  3406
!
c0277123fe4a added #usedSymbols query
Claus Gittinger <cg@exept.de>
parents: 5500
diff changeset
  3407
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
  3408
who
1851
4accc9fafd19 change #who to return a proper object
Claus Gittinger <cg@exept.de>
parents: 1813
diff changeset
  3409
    "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
  3410
     nil is returned for unbound methods.
4accc9fafd19 change #who to return a proper object
Claus Gittinger <cg@exept.de>
parents: 1813
diff changeset
  3411
12854
3a3d3c02c3bd *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 12695
diff changeset
  3412
     ST/X special notice:
13662
7d7ae1e5f589 changed: #annotationAtIndex:
Claus Gittinger <cg@exept.de>
parents: 13660
diff changeset
  3413
        returns an instance of MethodWhoInfo, which
7d7ae1e5f589 changed: #annotationAtIndex:
Claus Gittinger <cg@exept.de>
parents: 13660
diff changeset
  3414
        responds to #methodClass and #methodSelector query messages.
7d7ae1e5f589 changed: #annotationAtIndex:
Claus Gittinger <cg@exept.de>
parents: 13660
diff changeset
  3415
        For backward- (& ST-80) compatibility, the returned object also
7d7ae1e5f589 changed: #annotationAtIndex:
Claus Gittinger <cg@exept.de>
parents: 13660
diff changeset
  3416
        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
  3417
4accc9fafd19 change #who to return a proper object
Claus Gittinger <cg@exept.de>
parents: 1813
diff changeset
  3418
     Implementation notice:
13662
7d7ae1e5f589 changed: #annotationAtIndex:
Claus Gittinger <cg@exept.de>
parents: 13660
diff changeset
  3419
        Since there is no information of the containing class
7d7ae1e5f589 changed: #annotationAtIndex:
Claus Gittinger <cg@exept.de>
parents: 13660
diff changeset
  3420
        in the method, we have to do a search here.
7d7ae1e5f589 changed: #annotationAtIndex:
Claus Gittinger <cg@exept.de>
parents: 13660
diff changeset
  3421
7d7ae1e5f589 changed: #annotationAtIndex:
Claus Gittinger <cg@exept.de>
parents: 13660
diff changeset
  3422
        Normally, this is not a problem, except when a method is
7d7ae1e5f589 changed: #annotationAtIndex:
Claus Gittinger <cg@exept.de>
parents: 13660
diff changeset
  3423
        accepted in the debugger or redefined from within a method
7d7ae1e5f589 changed: #annotationAtIndex:
Claus Gittinger <cg@exept.de>
parents: 13660
diff changeset
  3424
        (maybe done indirectly, if #doIt is done recursively)
7d7ae1e5f589 changed: #annotationAtIndex:
Claus Gittinger <cg@exept.de>
parents: 13660
diff changeset
  3425
        - the information about which class the original method was
7d7ae1e5f589 changed: #annotationAtIndex:
Claus Gittinger <cg@exept.de>
parents: 13660
diff changeset
  3426
        defined in is lost in this case.
68
59faa75185ba *** empty log message ***
claus
parents: 56
diff changeset
  3427
12854
3a3d3c02c3bd *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 12695
diff changeset
  3428
     Problem:
13662
7d7ae1e5f589 changed: #annotationAtIndex:
Claus Gittinger <cg@exept.de>
parents: 13660
diff changeset
  3429
        this is heavily called for in the debugger to create
7d7ae1e5f589 changed: #annotationAtIndex:
Claus Gittinger <cg@exept.de>
parents: 13660
diff changeset
  3430
        a readable context walkback. For unbound methods, it is
7d7ae1e5f589 changed: #annotationAtIndex:
Claus Gittinger <cg@exept.de>
parents: 13660
diff changeset
  3431
        slow, since the search (over all classes) will always fail.
1851
4accc9fafd19 change #who to return a proper object
Claus Gittinger <cg@exept.de>
parents: 1813
diff changeset
  3432
12854
3a3d3c02c3bd *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 12695
diff changeset
  3433
     Q: should we add a backref from the method to the class
13662
7d7ae1e5f589 changed: #annotationAtIndex:
Claus Gittinger <cg@exept.de>
parents: 13660
diff changeset
  3434
        and/or add a subclass of Method for unbound ones ?
1851
4accc9fafd19 change #who to return a proper object
Claus Gittinger <cg@exept.de>
parents: 1813
diff changeset
  3435
     Q2: if so, what about the bad guy then, who copies methods around to
13662
7d7ae1e5f589 changed: #annotationAtIndex:
Claus Gittinger <cg@exept.de>
parents: 13660
diff changeset
  3436
         other classes ?"
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
  3437
6420
ba05391a71af *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6397
diff changeset
  3438
    |classes cls sel fn clsName checkBlock|
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
  3439
5324
5c9959ce98af make use of mclass
Claus Gittinger <cg@exept.de>
parents: 5322
diff changeset
  3440
    mclass notNil ifTrue:[
13662
7d7ae1e5f589 changed: #annotationAtIndex:
Claus Gittinger <cg@exept.de>
parents: 13660
diff changeset
  3441
        sel := mclass selectorAtMethod:self.
7d7ae1e5f589 changed: #annotationAtIndex:
Claus Gittinger <cg@exept.de>
parents: 13660
diff changeset
  3442
        sel notNil ifTrue:[
7d7ae1e5f589 changed: #annotationAtIndex:
Claus Gittinger <cg@exept.de>
parents: 13660
diff changeset
  3443
            ^ MethodWhoInfo class:mclass selector:sel
7d7ae1e5f589 changed: #annotationAtIndex:
Claus Gittinger <cg@exept.de>
parents: 13660
diff changeset
  3444
        ].
7d7ae1e5f589 changed: #annotationAtIndex:
Claus Gittinger <cg@exept.de>
parents: 13660
diff changeset
  3445
        "/ flush outdated mclass info
7d7ae1e5f589 changed: #annotationAtIndex:
Claus Gittinger <cg@exept.de>
parents: 13660
diff changeset
  3446
        mclass := nil.
5324
5c9959ce98af make use of mclass
Claus Gittinger <cg@exept.de>
parents: 5322
diff changeset
  3447
    ].
5c9959ce98af make use of mclass
Claus Gittinger <cg@exept.de>
parents: 5322
diff changeset
  3448
6420
ba05391a71af *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6397
diff changeset
  3449
    checkBlock := [:cls |
13662
7d7ae1e5f589 changed: #annotationAtIndex:
Claus Gittinger <cg@exept.de>
parents: 13660
diff changeset
  3450
        |sel|
7d7ae1e5f589 changed: #annotationAtIndex:
Claus Gittinger <cg@exept.de>
parents: 13660
diff changeset
  3451
7d7ae1e5f589 changed: #annotationAtIndex:
Claus Gittinger <cg@exept.de>
parents: 13660
diff changeset
  3452
        sel := cls selectorAtMethod:self.
7d7ae1e5f589 changed: #annotationAtIndex:
Claus Gittinger <cg@exept.de>
parents: 13660
diff changeset
  3453
        sel notNil ifTrue:[
7d7ae1e5f589 changed: #annotationAtIndex:
Claus Gittinger <cg@exept.de>
parents: 13660
diff changeset
  3454
            LastWhoClass := cls theNonMetaclass name.
7d7ae1e5f589 changed: #annotationAtIndex:
Claus Gittinger <cg@exept.de>
parents: 13660
diff changeset
  3455
            mclass isNil ifTrue:[
7d7ae1e5f589 changed: #annotationAtIndex:
Claus Gittinger <cg@exept.de>
parents: 13660
diff changeset
  3456
                mclass := cls
7d7ae1e5f589 changed: #annotationAtIndex:
Claus Gittinger <cg@exept.de>
parents: 13660
diff changeset
  3457
            ].
7d7ae1e5f589 changed: #annotationAtIndex:
Claus Gittinger <cg@exept.de>
parents: 13660
diff changeset
  3458
            ^ MethodWhoInfo class:cls selector:sel
7d7ae1e5f589 changed: #annotationAtIndex:
Claus Gittinger <cg@exept.de>
parents: 13660
diff changeset
  3459
        ].
6420
ba05391a71af *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6397
diff changeset
  3460
    ].
ba05391a71af *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6397
diff changeset
  3461
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
  3462
    "
5294
f2d689cf7be4 speedup #who (guess className from sourceFileName)
Claus Gittinger <cg@exept.de>
parents: 5284
diff changeset
  3463
     speedup kludge: if my sourceFileName is valid,
f2d689cf7be4 speedup #who (guess className from sourceFileName)
Claus Gittinger <cg@exept.de>
parents: 5284
diff changeset
  3464
     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
  3465
    "
f2d689cf7be4 speedup #who (guess className from sourceFileName)
Claus Gittinger <cg@exept.de>
parents: 5284
diff changeset
  3466
    (fn := self sourceFilename) notNil ifTrue:[
13662
7d7ae1e5f589 changed: #annotationAtIndex:
Claus Gittinger <cg@exept.de>
parents: 13660
diff changeset
  3467
        clsName := fn asFilename nameWithoutSuffix.
7d7ae1e5f589 changed: #annotationAtIndex:
Claus Gittinger <cg@exept.de>
parents: 13660
diff changeset
  3468
        clsName := clsName asSymbolIfInterned.
7d7ae1e5f589 changed: #annotationAtIndex:
Claus Gittinger <cg@exept.de>
parents: 13660
diff changeset
  3469
        clsName notNil ifTrue:[
7d7ae1e5f589 changed: #annotationAtIndex:
Claus Gittinger <cg@exept.de>
parents: 13660
diff changeset
  3470
            cls := Smalltalk at:clsName ifAbsent:nil.
7d7ae1e5f589 changed: #annotationAtIndex:
Claus Gittinger <cg@exept.de>
parents: 13660
diff changeset
  3471
            cls notNil ifTrue:[
7d7ae1e5f589 changed: #annotationAtIndex:
Claus Gittinger <cg@exept.de>
parents: 13660
diff changeset
  3472
                checkBlock value:cls theNonMetaclass.
7d7ae1e5f589 changed: #annotationAtIndex:
Claus Gittinger <cg@exept.de>
parents: 13660
diff changeset
  3473
                checkBlock value:cls theMetaclass.
7d7ae1e5f589 changed: #annotationAtIndex:
Claus Gittinger <cg@exept.de>
parents: 13660
diff changeset
  3474
            ]
7d7ae1e5f589 changed: #annotationAtIndex:
Claus Gittinger <cg@exept.de>
parents: 13660
diff changeset
  3475
        ].
5294
f2d689cf7be4 speedup #who (guess className from sourceFileName)
Claus Gittinger <cg@exept.de>
parents: 5284
diff changeset
  3476
    ].
f2d689cf7be4 speedup #who (guess className from sourceFileName)
Claus Gittinger <cg@exept.de>
parents: 5284
diff changeset
  3477
f2d689cf7be4 speedup #who (guess className from sourceFileName)
Claus Gittinger <cg@exept.de>
parents: 5284
diff changeset
  3478
    "
f2d689cf7be4 speedup #who (guess className from sourceFileName)
Claus Gittinger <cg@exept.de>
parents: 5284
diff changeset
  3479
     then, look in the class we found something the last 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
  3480
     this may often give a hit, when asking who repeatingly 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
  3481
     a context chain. (keep last by its name, to not keep classes from
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
     being garbage collected)
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
    LastWhoClass notNil ifTrue:[
13662
7d7ae1e5f589 changed: #annotationAtIndex:
Claus Gittinger <cg@exept.de>
parents: 13660
diff changeset
  3485
        cls := Smalltalk at:LastWhoClass ifAbsent:nil.
7d7ae1e5f589 changed: #annotationAtIndex:
Claus Gittinger <cg@exept.de>
parents: 13660
diff changeset
  3486
        cls notNil ifTrue:[
7d7ae1e5f589 changed: #annotationAtIndex:
Claus Gittinger <cg@exept.de>
parents: 13660
diff changeset
  3487
            checkBlock value:cls theNonMetaclass.
7d7ae1e5f589 changed: #annotationAtIndex:
Claus Gittinger <cg@exept.de>
parents: 13660
diff changeset
  3488
            checkBlock value:cls theMetaclass.
7d7ae1e5f589 changed: #annotationAtIndex:
Claus Gittinger <cg@exept.de>
parents: 13660
diff changeset
  3489
        ]
68
59faa75185ba *** empty log message ***
claus
parents: 56
diff changeset
  3490
    ].
227
23b1c4de3402 package & cleanup
claus
parents: 216
diff changeset
  3491
142
c7844287bddf *** empty log message ***
claus
parents: 109
diff changeset
  3492
    "
12854
3a3d3c02c3bd *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 12695
diff changeset
  3493
     first, 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
  3494
     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
  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
    classes := Smalltalk allClasses.
142
c7844287bddf *** empty log message ***
claus
parents: 109
diff changeset
  3497
    "
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
  3498
     instance methods are usually more common - search those first
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
    "
6420
ba05391a71af *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6397
diff changeset
  3500
    classes do:[:cls |
13662
7d7ae1e5f589 changed: #annotationAtIndex:
Claus Gittinger <cg@exept.de>
parents: 13660
diff changeset
  3501
        checkBlock value:cls theNonMetaclass.
7d7ae1e5f589 changed: #annotationAtIndex:
Claus Gittinger <cg@exept.de>
parents: 13660
diff changeset
  3502
        checkBlock value:cls theMetaclass.
142
c7844287bddf *** empty log message ***
claus
parents: 109
diff changeset
  3503
    ].
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
  3504
d600e08a5936 handle the case where a method has a sourceFileInfo, but the class has not
Claus Gittinger <cg@exept.de>
parents: 934
diff changeset
  3505
    LastWhoClass := nil.
6397
311358bdeed6 do not search for anonymous classes in #who
Claus Gittinger <cg@exept.de>
parents: 6365
diff changeset
  3506
"/    "
311358bdeed6 do not search for anonymous classes in #who
Claus Gittinger <cg@exept.de>
parents: 6365
diff changeset
  3507
"/     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
  3508
"/     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
  3509
"/    "
6420
ba05391a71af *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6397
diff changeset
  3510
"/    Behavior allSubInstancesDo:[:someClassLikeThingy |
ba05391a71af *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6397
diff changeset
  3511
"/        (classes includes:someClassLikeThingy) ifFalse:[
ba05391a71af *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6397
diff changeset
  3512
"/            checkBlock value:someClassLikeThingy.
6397
311358bdeed6 do not search for anonymous classes in #who
Claus Gittinger <cg@exept.de>
parents: 6365
diff changeset
  3513
"/        ]
311358bdeed6 do not search for anonymous classes in #who
Claus Gittinger <cg@exept.de>
parents: 6365
diff changeset
  3514
"/    ].
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
  3515
    "
d600e08a5936 handle the case where a method has a sourceFileInfo, but the class has not
Claus Gittinger <cg@exept.de>
parents: 934
diff changeset
  3516
     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
  3517
    "
d600e08a5936 handle the case where a method has a sourceFileInfo, but the class has not
Claus Gittinger <cg@exept.de>
parents: 934
diff changeset
  3518
    ^ nil
444
071b4f32272c *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 443
diff changeset
  3519
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
  3520
    "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
  3521
    "
d600e08a5936 handle the case where a method has a sourceFileInfo, but the class has not
Claus Gittinger <cg@exept.de>
parents: 934
diff changeset
  3522
     |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
  3523
     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
  3524
     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
  3525
    "
d600e08a5936 handle the case where a method has a sourceFileInfo, but the class has not
Claus Gittinger <cg@exept.de>
parents: 934
diff changeset
  3526
d600e08a5936 handle the case where a method has a sourceFileInfo, but the class has not
Claus Gittinger <cg@exept.de>
parents: 934
diff changeset
  3527
    "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
  3528
    "
d600e08a5936 handle the case where a method has a sourceFileInfo, but the class has not
Claus Gittinger <cg@exept.de>
parents: 934
diff changeset
  3529
     |m cls|
444
071b4f32272c *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 443
diff changeset
  3530
12854
3a3d3c02c3bd *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 12695
diff changeset
  3531
     Object
13662
7d7ae1e5f589 changed: #annotationAtIndex:
Claus Gittinger <cg@exept.de>
parents: 13660
diff changeset
  3532
        subclass:#FunnyClass
7d7ae1e5f589 changed: #annotationAtIndex:
Claus Gittinger <cg@exept.de>
parents: 13660
diff changeset
  3533
        instanceVariableNames:'foo'
7d7ae1e5f589 changed: #annotationAtIndex:
Claus Gittinger <cg@exept.de>
parents: 13660
diff changeset
  3534
        classVariableNames:''
7d7ae1e5f589 changed: #annotationAtIndex:
Claus Gittinger <cg@exept.de>
parents: 13660
diff changeset
  3535
        poolDictionaries:''
7d7ae1e5f589 changed: #annotationAtIndex:
Claus Gittinger <cg@exept.de>
parents: 13660
diff changeset
  3536
        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
  3537
     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
  3538
     Smalltalk removeClass:cls.
444
071b4f32272c *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 443
diff changeset
  3539
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
  3540
     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
  3541
     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
  3542
     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
  3543
d600e08a5936 handle the case where a method has a sourceFileInfo, but the class has not
Claus Gittinger <cg@exept.de>
parents: 934
diff changeset
  3544
     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
  3545
    "
1851
4accc9fafd19 change #who to return a proper object
Claus Gittinger <cg@exept.de>
parents: 1813
diff changeset
  3546
10156
d35f30a7fde5 changed #who
Claus Gittinger <cg@exept.de>
parents: 10083
diff changeset
  3547
    "Modified: / 07-11-2006 / 13:58:50 / cg"
68
59faa75185ba *** empty log message ***
claus
parents: 56
diff changeset
  3548
!
59faa75185ba *** empty log message ***
claus
parents: 56
diff changeset
  3549
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
  3550
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
  3551
    "only for wrapped methods: return the wrapper.
14419
eef0be88cb60 comment/format in: #wrapper
Claus Gittinger <cg@exept.de>
parents: 14402
diff changeset
  3552
     That's the WrapperMethod which contains myself."
159
514c749165c3 *** empty log message ***
claus
parents: 142
diff changeset
  3553
13847
c1552e51c27a changed: #wrapper
Claus Gittinger <cg@exept.de>
parents: 13817
diff changeset
  3554
    WrappedMethod notNil ifTrue:[
c1552e51c27a changed: #wrapper
Claus Gittinger <cg@exept.de>
parents: 13817
diff changeset
  3555
        WrappedMethod allInstancesDo:[:m |
c1552e51c27a changed: #wrapper
Claus Gittinger <cg@exept.de>
parents: 13817
diff changeset
  3556
            m originalMethod == self ifTrue:[^ m].
c1552e51c27a changed: #wrapper
Claus Gittinger <cg@exept.de>
parents: 13817
diff changeset
  3557
        ].
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
  3558
    ].
d600e08a5936 handle the case where a method has a sourceFileInfo, but the class has not
Claus Gittinger <cg@exept.de>
parents: 934
diff changeset
  3559
    ^ nil
13847
c1552e51c27a changed: #wrapper
Claus Gittinger <cg@exept.de>
parents: 13817
diff changeset
  3560
c1552e51c27a changed: #wrapper
Claus Gittinger <cg@exept.de>
parents: 13817
diff changeset
  3561
    "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
  3562
!
0f513f04c50f #readsFields: and #writesField: for st80 compatibility
Claus Gittinger <cg@exept.de>
parents: 5562
diff changeset
  3563
0f513f04c50f #readsFields: and #writesField: for st80 compatibility
Claus Gittinger <cg@exept.de>
parents: 5562
diff changeset
  3564
writesField:instVarIndex
0f513f04c50f #readsFields: and #writesField: for st80 compatibility
Claus Gittinger <cg@exept.de>
parents: 5562
diff changeset
  3565
    "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
  3566
     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
  3567
14237
Claus Gittinger <cg@exept.de>
parents: 14236
diff changeset
  3568
    |instVarName|
Claus Gittinger <cg@exept.de>
parents: 14236
diff changeset
  3569
Claus Gittinger <cg@exept.de>
parents: 14236
diff changeset
  3570
    instVarName := (self mclass allInstVarNames) at:instVarIndex.
Claus Gittinger <cg@exept.de>
parents: 14236
diff changeset
  3571
    ^ self writesInstVar:instVarName
Claus Gittinger <cg@exept.de>
parents: 14236
diff changeset
  3572
Claus Gittinger <cg@exept.de>
parents: 14236
diff changeset
  3573
    "Modified: / 23-07-2012 / 11:16:51 / cg"
Claus Gittinger <cg@exept.de>
parents: 14236
diff changeset
  3574
!
Claus Gittinger <cg@exept.de>
parents: 14236
diff changeset
  3575
Claus Gittinger <cg@exept.de>
parents: 14236
diff changeset
  3576
writesInstVar:instVarName
Claus Gittinger <cg@exept.de>
parents: 14236
diff changeset
  3577
    "return true, if the named instvar is written (modified) by the receiver.
Claus Gittinger <cg@exept.de>
parents: 14236
diff changeset
  3578
     Uses parser (for now); could look at bytecode as well here..."
Claus Gittinger <cg@exept.de>
parents: 14236
diff changeset
  3579
Claus Gittinger <cg@exept.de>
parents: 14236
diff changeset
  3580
    |modifiedInstVars|
Claus Gittinger <cg@exept.de>
parents: 14236
diff changeset
  3581
Claus Gittinger <cg@exept.de>
parents: 14236
diff changeset
  3582
    (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
  3583
    modifiedInstVars := self parse:#'parseMethodSilent:in:' with:self mclass return:#modifiedInstVars or:#().
14237
Claus Gittinger <cg@exept.de>
parents: 14236
diff changeset
  3584
    ^ modifiedInstVars includes:instVarName.
Claus Gittinger <cg@exept.de>
parents: 14236
diff changeset
  3585
Claus Gittinger <cg@exept.de>
parents: 14236
diff changeset
  3586
    "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
  3587
! !
13
62303f84ff5f *** empty log message ***
claus
parents: 10
diff changeset
  3588
14863
49e50305f097 class: Method
Claus Gittinger <cg@exept.de>
parents: 14595
diff changeset
  3589
!Method methodsFor:'source management'!
49e50305f097 class: Method
Claus Gittinger <cg@exept.de>
parents: 14595
diff changeset
  3590
49e50305f097 class: Method
Claus Gittinger <cg@exept.de>
parents: 14595
diff changeset
  3591
revisionInfo
14864
d9d92fd69ae9 class: Method
Claus Gittinger <cg@exept.de>
parents: 14863
diff changeset
  3592
    "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
  3593
49e50305f097 class: Method
Claus Gittinger <cg@exept.de>
parents: 14595
diff changeset
  3594
    ^self containingClass theNonMetaclass revisionInfo
49e50305f097 class: Method
Claus Gittinger <cg@exept.de>
parents: 14595
diff changeset
  3595
49e50305f097 class: Method
Claus Gittinger <cg@exept.de>
parents: 14595
diff changeset
  3596
    "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
  3597
    "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
  3598
! !
49e50305f097 class: Method
Claus Gittinger <cg@exept.de>
parents: 14595
diff changeset
  3599
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
  3600
!Method methodsFor:'trap methods'!
13
62303f84ff5f *** empty log message ***
claus
parents: 10
diff changeset
  3601
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
  3602
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
  3603
    "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
  3604
     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
  3605
     the objectFileLoader to invalidate methods whose code is unloaded."
1
a27a279701f8 Initial revision
claus
parents:
diff changeset
  3606
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
  3607
    |invldMethod|
159
514c749165c3 *** empty log message ***
claus
parents: 142
diff changeset
  3608
1873
3544a4a94a2a checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1870
diff changeset
  3609
    invldMethod := self trapMethodForNumArgs:(self numArgs).
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
  3610
    self code:invldMethod code.
1873
3544a4a94a2a checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1870
diff changeset
  3611
    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
  3612
d600e08a5936 handle the case where a method has a sourceFileInfo, but the class has not
Claus Gittinger <cg@exept.de>
parents: 934
diff changeset
  3613
    "Created: 17.9.1995 / 15:00:52 / claus"
1873
3544a4a94a2a checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1870
diff changeset
  3614
    "Modified: 4.11.1996 / 23:04:34 / cg"
1
a27a279701f8 Initial revision
claus
parents:
diff changeset
  3615
!
a27a279701f8 Initial revision
claus
parents:
diff changeset
  3616
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
  3617
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
  3618
    "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
  3619
     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
  3620
     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
  3621
     after a class definition change (for example: instvars are no longer there)."
1
a27a279701f8 Initial revision
claus
parents:
diff changeset
  3622
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
  3623
    |invldMethod|
872
af04035b443d binary class storage support
Claus Gittinger <cg@exept.de>
parents: 829
diff changeset
  3624
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
  3625
    invldMethod := self class compiledMethodAt:#uncompiledCodeObject.
d600e08a5936 handle the case where a method has a sourceFileInfo, but the class has not
Claus Gittinger <cg@exept.de>
parents: 934
diff changeset
  3626
    self code:invldMethod code.
1873
3544a4a94a2a checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1870
diff changeset
  3627
    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
  3628
d600e08a5936 handle the case where a method has a sourceFileInfo, but the class has not
Claus Gittinger <cg@exept.de>
parents: 934
diff changeset
  3629
    "Created: 17.9.1995 / 15:01:14 / claus"
1873
3544a4a94a2a checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1870
diff changeset
  3630
    "Modified: 4.11.1996 / 23:04:46 / cg"
3544a4a94a2a checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1870
diff changeset
  3631
!
3544a4a94a2a checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1870
diff changeset
  3632
3544a4a94a2a checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1870
diff changeset
  3633
makeUnloaded
3544a4a94a2a checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1870
diff changeset
  3634
    "make the receiver an unloaded method, which raises an invalidCodeObject
3544a4a94a2a checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1870
diff changeset
  3635
     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
  3636
     the objectFileLoader to invalidate methods for which a shared library has
3544a4a94a2a checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1870
diff changeset
  3637
     been removed."
3544a4a94a2a checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1870
diff changeset
  3638
3544a4a94a2a checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1870
diff changeset
  3639
    |invldMethod|
3544a4a94a2a checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1870
diff changeset
  3640
3544a4a94a2a checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1870
diff changeset
  3641
    invldMethod := self class compiledMethodAt:#unloadedCodeObject.
3544a4a94a2a checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1870
diff changeset
  3642
    self code:invldMethod code.
3544a4a94a2a checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1870
diff changeset
  3643
    self byteCode:nil.
3544a4a94a2a checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1870
diff changeset
  3644
3544a4a94a2a checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1870
diff changeset
  3645
    "Created: 4.11.1996 / 22:59:21 / cg"
3544a4a94a2a checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1870
diff changeset
  3646
    "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
  3647
!
2623b60c27e1 lifted numVars; added access for invalidCodeObject-trappers
Claus Gittinger <cg@exept.de>
parents: 1855
diff changeset
  3648
2623b60c27e1 lifted numVars; added access for invalidCodeObject-trappers
Claus Gittinger <cg@exept.de>
parents: 1855
diff changeset
  3649
trapMethodForNumArgs:numArgs
13657
206c6696707b added: #trapMethodForNumArgs:
Claus Gittinger <cg@exept.de>
parents: 13651
diff changeset
  3650
    ^ self class trapMethodForNumArgs:numArgs
206c6696707b added: #trapMethodForNumArgs:
Claus Gittinger <cg@exept.de>
parents: 13651
diff changeset
  3651
206c6696707b added: #trapMethodForNumArgs:
Claus Gittinger <cg@exept.de>
parents: 13651
diff changeset
  3652
    "Created: / 04-11-1996 / 21:58:58 / cg"
206c6696707b added: #trapMethodForNumArgs:
Claus Gittinger <cg@exept.de>
parents: 13651
diff changeset
  3653
    "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
  3654
! !
872
af04035b443d binary class storage support
Claus Gittinger <cg@exept.de>
parents: 829
diff changeset
  3655
2022
24529e2b7cee commentary for MethodWhoInfo
Claus Gittinger <cg@exept.de>
parents: 1995
diff changeset
  3656
!Method::MethodWhoInfo class methodsFor:'documentation'!
24529e2b7cee commentary for MethodWhoInfo
Claus Gittinger <cg@exept.de>
parents: 1995
diff changeset
  3657
24529e2b7cee commentary for MethodWhoInfo
Claus Gittinger <cg@exept.de>
parents: 1995
diff changeset
  3658
documentation
24529e2b7cee commentary for MethodWhoInfo
Claus Gittinger <cg@exept.de>
parents: 1995
diff changeset
  3659
"
24529e2b7cee commentary for MethodWhoInfo
Claus Gittinger <cg@exept.de>
parents: 1995
diff changeset
  3660
    In earlier times, Method>>who returned an array filled
24529e2b7cee commentary for MethodWhoInfo
Claus Gittinger <cg@exept.de>
parents: 1995
diff changeset
  3661
    with the methods class and selector.
24529e2b7cee commentary for MethodWhoInfo
Claus Gittinger <cg@exept.de>
parents: 1995
diff changeset
  3662
    This was done, since a smalltalk method cannot return multiple
24529e2b7cee commentary for MethodWhoInfo
Claus Gittinger <cg@exept.de>
parents: 1995
diff changeset
  3663
    values, but 2 values had to be returned from that method.
24529e2b7cee commentary for MethodWhoInfo
Claus Gittinger <cg@exept.de>
parents: 1995
diff changeset
  3664
    Thus, the who-interface was used as:
13662
7d7ae1e5f589 changed: #annotationAtIndex:
Claus Gittinger <cg@exept.de>
parents: 13660
diff changeset
  3665
        info := <someMethod> who.
7d7ae1e5f589 changed: #annotationAtIndex:
Claus Gittinger <cg@exept.de>
parents: 13660
diff changeset
  3666
        class := info at:1.
7d7ae1e5f589 changed: #annotationAtIndex:
Claus Gittinger <cg@exept.de>
parents: 13660
diff changeset
  3667
        sel := info at:2.
2022
24529e2b7cee commentary for MethodWhoInfo
Claus Gittinger <cg@exept.de>
parents: 1995
diff changeset
  3668
24529e2b7cee commentary for MethodWhoInfo
Claus Gittinger <cg@exept.de>
parents: 1995
diff changeset
  3669
    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
  3670
    an object (an instance of MethodWhoInfo) which responds to the two
24529e2b7cee commentary for MethodWhoInfo
Claus Gittinger <cg@exept.de>
parents: 1995
diff changeset
  3671
    messages: #methodClass and #methodSelector.
24529e2b7cee commentary for MethodWhoInfo
Claus Gittinger <cg@exept.de>
parents: 1995
diff changeset
  3672
    This allows to write things much more intuitive:
13662
7d7ae1e5f589 changed: #annotationAtIndex:
Claus Gittinger <cg@exept.de>
parents: 13660
diff changeset
  3673
        info := <someMethod> who.
7d7ae1e5f589 changed: #annotationAtIndex:
Claus Gittinger <cg@exept.de>
parents: 13660
diff changeset
  3674
        class := info methodClass.
7d7ae1e5f589 changed: #annotationAtIndex:
Claus Gittinger <cg@exept.de>
parents: 13660
diff changeset
  3675
        sel := info methodSelector.
2022
24529e2b7cee commentary for MethodWhoInfo
Claus Gittinger <cg@exept.de>
parents: 1995
diff changeset
  3676
24529e2b7cee commentary for MethodWhoInfo
Claus Gittinger <cg@exept.de>
parents: 1995
diff changeset
  3677
    However, to be backward compatible, the returned object still responds to
24529e2b7cee commentary for MethodWhoInfo
Claus Gittinger <cg@exept.de>
parents: 1995
diff changeset
  3678
    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
  3679
24529e2b7cee commentary for MethodWhoInfo
Claus Gittinger <cg@exept.de>
parents: 1995
diff changeset
  3680
    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
  3681
    classes.
2242
5037033b8002 commentary
Claus Gittinger <cg@exept.de>
parents: 2218
diff changeset
  3682
5037033b8002 commentary
Claus Gittinger <cg@exept.de>
parents: 2218
diff changeset
  3683
    [author:]
13662
7d7ae1e5f589 changed: #annotationAtIndex:
Claus Gittinger <cg@exept.de>
parents: 13660
diff changeset
  3684
        Claus Gittinger
2242
5037033b8002 commentary
Claus Gittinger <cg@exept.de>
parents: 2218
diff changeset
  3685
5037033b8002 commentary
Claus Gittinger <cg@exept.de>
parents: 2218
diff changeset
  3686
    [see also:]
13662
7d7ae1e5f589 changed: #annotationAtIndex:
Claus Gittinger <cg@exept.de>
parents: 13660
diff changeset
  3687
        Method
2022
24529e2b7cee commentary for MethodWhoInfo
Claus Gittinger <cg@exept.de>
parents: 1995
diff changeset
  3688
"
24529e2b7cee commentary for MethodWhoInfo
Claus Gittinger <cg@exept.de>
parents: 1995
diff changeset
  3689
! !
24529e2b7cee commentary for MethodWhoInfo
Claus Gittinger <cg@exept.de>
parents: 1995
diff changeset
  3690
1851
4accc9fafd19 change #who to return a proper object
Claus Gittinger <cg@exept.de>
parents: 1813
diff changeset
  3691
!Method::MethodWhoInfo class methodsFor:'instance creation'!
4accc9fafd19 change #who to return a proper object
Claus Gittinger <cg@exept.de>
parents: 1813
diff changeset
  3692
4accc9fafd19 change #who to return a proper object
Claus Gittinger <cg@exept.de>
parents: 1813
diff changeset
  3693
class:cls selector:sel
2023
4c6416d1a54d checkin from browser
Claus Gittinger <cg@exept.de>
parents: 2022
diff changeset
  3694
    "return a new MethodWhoInfo object;
4c6416d1a54d checkin from browser
Claus Gittinger <cg@exept.de>
parents: 2022
diff changeset
  3695
     this is a private interface for Method"
4c6416d1a54d checkin from browser
Claus Gittinger <cg@exept.de>
parents: 2022
diff changeset
  3696
1851
4accc9fafd19 change #who to return a proper object
Claus Gittinger <cg@exept.de>
parents: 1813
diff changeset
  3697
    ^ self basicNew class:cls selector:sel
2023
4c6416d1a54d checkin from browser
Claus Gittinger <cg@exept.de>
parents: 2022
diff changeset
  3698
4c6416d1a54d checkin from browser
Claus Gittinger <cg@exept.de>
parents: 2022
diff changeset
  3699
    "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
  3700
! !
4accc9fafd19 change #who to return a proper object
Claus Gittinger <cg@exept.de>
parents: 1813
diff changeset
  3701
4accc9fafd19 change #who to return a proper object
Claus Gittinger <cg@exept.de>
parents: 1813
diff changeset
  3702
!Method::MethodWhoInfo methodsFor:'accessing'!
4accc9fafd19 change #who to return a proper object
Claus Gittinger <cg@exept.de>
parents: 1813
diff changeset
  3703
4669
828addb1c376 source code access - care for package different from my classes
Claus Gittinger <cg@exept.de>
parents: 4595
diff changeset
  3704
method
828addb1c376 source code access - care for package different from my classes
Claus Gittinger <cg@exept.de>
parents: 4595
diff changeset
  3705
    ^ myClass compiledMethodAt:mySelector
828addb1c376 source code access - care for package different from my classes
Claus Gittinger <cg@exept.de>
parents: 4595
diff changeset
  3706
!
828addb1c376 source code access - care for package different from my classes
Claus Gittinger <cg@exept.de>
parents: 4595
diff changeset
  3707
1851
4accc9fafd19 change #who to return a proper object
Claus Gittinger <cg@exept.de>
parents: 1813
diff changeset
  3708
methodClass
2022
24529e2b7cee commentary for MethodWhoInfo
Claus Gittinger <cg@exept.de>
parents: 1995
diff changeset
  3709
    "return the class which contains the method represented by myself"
24529e2b7cee commentary for MethodWhoInfo
Claus Gittinger <cg@exept.de>
parents: 1995
diff changeset
  3710
1851
4accc9fafd19 change #who to return a proper object
Claus Gittinger <cg@exept.de>
parents: 1813
diff changeset
  3711
    ^ myClass
2022
24529e2b7cee commentary for MethodWhoInfo
Claus Gittinger <cg@exept.de>
parents: 1995
diff changeset
  3712
24529e2b7cee commentary for MethodWhoInfo
Claus Gittinger <cg@exept.de>
parents: 1995
diff changeset
  3713
    "
24529e2b7cee commentary for MethodWhoInfo
Claus Gittinger <cg@exept.de>
parents: 1995
diff changeset
  3714
     (Method compiledMethodAt:#who) who methodClass
24529e2b7cee commentary for MethodWhoInfo
Claus Gittinger <cg@exept.de>
parents: 1995
diff changeset
  3715
     (Method::MethodWhoInfo compiledMethodAt:#methodClass) who methodClass
24529e2b7cee commentary for MethodWhoInfo
Claus Gittinger <cg@exept.de>
parents: 1995
diff changeset
  3716
    "
24529e2b7cee commentary for MethodWhoInfo
Claus Gittinger <cg@exept.de>
parents: 1995
diff changeset
  3717
24529e2b7cee commentary for MethodWhoInfo
Claus Gittinger <cg@exept.de>
parents: 1995
diff changeset
  3718
    "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
  3719
!
4accc9fafd19 change #who to return a proper object
Claus Gittinger <cg@exept.de>
parents: 1813
diff changeset
  3720
4accc9fafd19 change #who to return a proper object
Claus Gittinger <cg@exept.de>
parents: 1813
diff changeset
  3721
methodSelector
2022
24529e2b7cee commentary for MethodWhoInfo
Claus Gittinger <cg@exept.de>
parents: 1995
diff changeset
  3722
    "return the selector under which the the method represented by myself
24529e2b7cee commentary for MethodWhoInfo
Claus Gittinger <cg@exept.de>
parents: 1995
diff changeset
  3723
     is found in the class"
24529e2b7cee commentary for MethodWhoInfo
Claus Gittinger <cg@exept.de>
parents: 1995
diff changeset
  3724
1851
4accc9fafd19 change #who to return a proper object
Claus Gittinger <cg@exept.de>
parents: 1813
diff changeset
  3725
    ^ mySelector
2022
24529e2b7cee commentary for MethodWhoInfo
Claus Gittinger <cg@exept.de>
parents: 1995
diff changeset
  3726
24529e2b7cee commentary for MethodWhoInfo
Claus Gittinger <cg@exept.de>
parents: 1995
diff changeset
  3727
    "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
  3728
! !
4accc9fafd19 change #who to return a proper object
Claus Gittinger <cg@exept.de>
parents: 1813
diff changeset
  3729
4accc9fafd19 change #who to return a proper object
Claus Gittinger <cg@exept.de>
parents: 1813
diff changeset
  3730
!Method::MethodWhoInfo methodsFor:'compatibility'!
4accc9fafd19 change #who to return a proper object
Claus Gittinger <cg@exept.de>
parents: 1813
diff changeset
  3731
4accc9fafd19 change #who to return a proper object
Claus Gittinger <cg@exept.de>
parents: 1813
diff changeset
  3732
at:index
4accc9fafd19 change #who to return a proper object
Claus Gittinger <cg@exept.de>
parents: 1813
diff changeset
  3733
    "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
  3734
4accc9fafd19 change #who to return a proper object
Claus Gittinger <cg@exept.de>
parents: 1813
diff changeset
  3735
    index == 1 ifTrue:[
13662
7d7ae1e5f589 changed: #annotationAtIndex:
Claus Gittinger <cg@exept.de>
parents: 13660
diff changeset
  3736
        ^ myClass
1851
4accc9fafd19 change #who to return a proper object
Claus Gittinger <cg@exept.de>
parents: 1813
diff changeset
  3737
    ].
4accc9fafd19 change #who to return a proper object
Claus Gittinger <cg@exept.de>
parents: 1813
diff changeset
  3738
    index == 2 ifTrue:[
13662
7d7ae1e5f589 changed: #annotationAtIndex:
Claus Gittinger <cg@exept.de>
parents: 13660
diff changeset
  3739
        ^ mySelector
1851
4accc9fafd19 change #who to return a proper object
Claus Gittinger <cg@exept.de>
parents: 1813
diff changeset
  3740
    ].
4accc9fafd19 change #who to return a proper object
Claus Gittinger <cg@exept.de>
parents: 1813
diff changeset
  3741
4accc9fafd19 change #who to return a proper object
Claus Gittinger <cg@exept.de>
parents: 1813
diff changeset
  3742
    "/ sigh - full compatibility ?
7219
7c7b9d76af21 subscriptBoundsError -> subscriptBoundsError:
Claus Gittinger <cg@exept.de>
parents: 7210
diff changeset
  3743
    ^ self indexNotIntegerOrOutOfBounds:index
1851
4accc9fafd19 change #who to return a proper object
Claus Gittinger <cg@exept.de>
parents: 1813
diff changeset
  3744
! !
4accc9fafd19 change #who to return a proper object
Claus Gittinger <cg@exept.de>
parents: 1813
diff changeset
  3745
7258
9ccdbee7d1ad method category rename
Claus Gittinger <cg@exept.de>
parents: 7219
diff changeset
  3746
!Method::MethodWhoInfo methodsFor:'private-accessing'!
1851
4accc9fafd19 change #who to return a proper object
Claus Gittinger <cg@exept.de>
parents: 1813
diff changeset
  3747
4accc9fafd19 change #who to return a proper object
Claus Gittinger <cg@exept.de>
parents: 1813
diff changeset
  3748
class:cls selector:sel
4accc9fafd19 change #who to return a proper object
Claus Gittinger <cg@exept.de>
parents: 1813
diff changeset
  3749
    myClass := cls.
4accc9fafd19 change #who to return a proper object
Claus Gittinger <cg@exept.de>
parents: 1813
diff changeset
  3750
    mySelector := sel
4accc9fafd19 change #who to return a proper object
Claus Gittinger <cg@exept.de>
parents: 1813
diff changeset
  3751
4accc9fafd19 change #who to return a proper object
Claus Gittinger <cg@exept.de>
parents: 1813
diff changeset
  3752
4accc9fafd19 change #who to return a proper object
Claus Gittinger <cg@exept.de>
parents: 1813
diff changeset
  3753
! !
4accc9fafd19 change #who to return a proper object
Claus Gittinger <cg@exept.de>
parents: 1813
diff changeset
  3754
13570
382db10e848d changed: #parse:with:return:or:
Claus Gittinger <cg@exept.de>
parents: 13569
diff changeset
  3755
!Method::ParseTreeCacheEntry methodsFor:'accessing'!
382db10e848d changed: #parse:with:return:or:
Claus Gittinger <cg@exept.de>
parents: 13569
diff changeset
  3756
382db10e848d changed: #parse:with:return:or:
Claus Gittinger <cg@exept.de>
parents: 13569
diff changeset
  3757
method
382db10e848d changed: #parse:with:return:or:
Claus Gittinger <cg@exept.de>
parents: 13569
diff changeset
  3758
    ^ method
382db10e848d changed: #parse:with:return:or:
Claus Gittinger <cg@exept.de>
parents: 13569
diff changeset
  3759
!
382db10e848d changed: #parse:with:return:or:
Claus Gittinger <cg@exept.de>
parents: 13569
diff changeset
  3760
382db10e848d changed: #parse:with:return:or:
Claus Gittinger <cg@exept.de>
parents: 13569
diff changeset
  3761
method:something
382db10e848d changed: #parse:with:return:or:
Claus Gittinger <cg@exept.de>
parents: 13569
diff changeset
  3762
    method := something.
382db10e848d changed: #parse:with:return:or:
Claus Gittinger <cg@exept.de>
parents: 13569
diff changeset
  3763
!
382db10e848d changed: #parse:with:return:or:
Claus Gittinger <cg@exept.de>
parents: 13569
diff changeset
  3764
382db10e848d changed: #parse:with:return:or:
Claus Gittinger <cg@exept.de>
parents: 13569
diff changeset
  3765
parser
382db10e848d changed: #parse:with:return:or:
Claus Gittinger <cg@exept.de>
parents: 13569
diff changeset
  3766
    ^ parser
382db10e848d changed: #parse:with:return:or:
Claus Gittinger <cg@exept.de>
parents: 13569
diff changeset
  3767
!
382db10e848d changed: #parse:with:return:or:
Claus Gittinger <cg@exept.de>
parents: 13569
diff changeset
  3768
382db10e848d changed: #parse:with:return:or:
Claus Gittinger <cg@exept.de>
parents: 13569
diff changeset
  3769
parser:something
382db10e848d changed: #parse:with:return:or:
Claus Gittinger <cg@exept.de>
parents: 13569
diff changeset
  3770
    parser := something.
382db10e848d changed: #parse:with:return:or:
Claus Gittinger <cg@exept.de>
parents: 13569
diff changeset
  3771
!
382db10e848d changed: #parse:with:return:or:
Claus Gittinger <cg@exept.de>
parents: 13569
diff changeset
  3772
382db10e848d changed: #parse:with:return:or:
Claus Gittinger <cg@exept.de>
parents: 13569
diff changeset
  3773
parserClass
382db10e848d changed: #parse:with:return:or:
Claus Gittinger <cg@exept.de>
parents: 13569
diff changeset
  3774
    ^ parserClass
382db10e848d changed: #parse:with:return:or:
Claus Gittinger <cg@exept.de>
parents: 13569
diff changeset
  3775
!
382db10e848d changed: #parse:with:return:or:
Claus Gittinger <cg@exept.de>
parents: 13569
diff changeset
  3776
382db10e848d changed: #parse:with:return:or:
Claus Gittinger <cg@exept.de>
parents: 13569
diff changeset
  3777
parserClass:something
382db10e848d changed: #parse:with:return:or:
Claus Gittinger <cg@exept.de>
parents: 13569
diff changeset
  3778
    parserClass := something.
382db10e848d changed: #parse:with:return:or:
Claus Gittinger <cg@exept.de>
parents: 13569
diff changeset
  3779
!
382db10e848d changed: #parse:with:return:or:
Claus Gittinger <cg@exept.de>
parents: 13569
diff changeset
  3780
13660
Claus Gittinger <cg@exept.de>
parents: 13659
diff changeset
  3781
parserClass:parserClassArg method:methodArg
13570
382db10e848d changed: #parse:with:return:or:
Claus Gittinger <cg@exept.de>
parents: 13569
diff changeset
  3782
    parserClass := parserClassArg.
382db10e848d changed: #parse:with:return:or:
Claus Gittinger <cg@exept.de>
parents: 13569
diff changeset
  3783
    method := methodArg.
382db10e848d changed: #parse:with:return:or:
Claus Gittinger <cg@exept.de>
parents: 13569
diff changeset
  3784
!
382db10e848d changed: #parse:with:return:or:
Claus Gittinger <cg@exept.de>
parents: 13569
diff changeset
  3785
13660
Claus Gittinger <cg@exept.de>
parents: 13659
diff changeset
  3786
parserClass:parserClassArg method:methodArg parser:parserArg
13570
382db10e848d changed: #parse:with:return:or:
Claus Gittinger <cg@exept.de>
parents: 13569
diff changeset
  3787
    parserClass := parserClassArg.
382db10e848d changed: #parse:with:return:or:
Claus Gittinger <cg@exept.de>
parents: 13569
diff changeset
  3788
    method := methodArg.
382db10e848d changed: #parse:with:return:or:
Claus Gittinger <cg@exept.de>
parents: 13569
diff changeset
  3789
    parser := parserArg.
382db10e848d changed: #parse:with:return:or:
Claus Gittinger <cg@exept.de>
parents: 13569
diff changeset
  3790
382db10e848d changed: #parse:with:return:or:
Claus Gittinger <cg@exept.de>
parents: 13569
diff changeset
  3791
    "Created: / 08-08-2011 / 19:05:02 / cg"
382db10e848d changed: #parse:with:return:or:
Claus Gittinger <cg@exept.de>
parents: 13569
diff changeset
  3792
! !
382db10e848d changed: #parse:with:return:or:
Claus Gittinger <cg@exept.de>
parents: 13569
diff changeset
  3793
382db10e848d changed: #parse:with:return:or:
Claus Gittinger <cg@exept.de>
parents: 13569
diff changeset
  3794
!Method::ParserCacheEntry methodsFor:'accessing'!
382db10e848d changed: #parse:with:return:or:
Claus Gittinger <cg@exept.de>
parents: 13569
diff changeset
  3795
382db10e848d changed: #parse:with:return:or:
Claus Gittinger <cg@exept.de>
parents: 13569
diff changeset
  3796
method
382db10e848d changed: #parse:with:return:or:
Claus Gittinger <cg@exept.de>
parents: 13569
diff changeset
  3797
    ^ method
382db10e848d changed: #parse:with:return:or:
Claus Gittinger <cg@exept.de>
parents: 13569
diff changeset
  3798
!
382db10e848d changed: #parse:with:return:or:
Claus Gittinger <cg@exept.de>
parents: 13569
diff changeset
  3799
382db10e848d changed: #parse:with:return:or:
Claus Gittinger <cg@exept.de>
parents: 13569
diff changeset
  3800
method:something
382db10e848d changed: #parse:with:return:or:
Claus Gittinger <cg@exept.de>
parents: 13569
diff changeset
  3801
    method := something.
382db10e848d changed: #parse:with:return:or:
Claus Gittinger <cg@exept.de>
parents: 13569
diff changeset
  3802
!
382db10e848d changed: #parse:with:return:or:
Claus Gittinger <cg@exept.de>
parents: 13569
diff changeset
  3803
382db10e848d changed: #parse:with:return:or:
Claus Gittinger <cg@exept.de>
parents: 13569
diff changeset
  3804
parser
382db10e848d changed: #parse:with:return:or:
Claus Gittinger <cg@exept.de>
parents: 13569
diff changeset
  3805
    ^ parser
382db10e848d changed: #parse:with:return:or:
Claus Gittinger <cg@exept.de>
parents: 13569
diff changeset
  3806
!
382db10e848d changed: #parse:with:return:or:
Claus Gittinger <cg@exept.de>
parents: 13569
diff changeset
  3807
382db10e848d changed: #parse:with:return:or:
Claus Gittinger <cg@exept.de>
parents: 13569
diff changeset
  3808
parser:something
382db10e848d changed: #parse:with:return:or:
Claus Gittinger <cg@exept.de>
parents: 13569
diff changeset
  3809
    parser := something.
382db10e848d changed: #parse:with:return:or:
Claus Gittinger <cg@exept.de>
parents: 13569
diff changeset
  3810
!
382db10e848d changed: #parse:with:return:or:
Claus Gittinger <cg@exept.de>
parents: 13569
diff changeset
  3811
382db10e848d changed: #parse:with:return:or:
Claus Gittinger <cg@exept.de>
parents: 13569
diff changeset
  3812
parserClass
382db10e848d changed: #parse:with:return:or:
Claus Gittinger <cg@exept.de>
parents: 13569
diff changeset
  3813
    ^ parserClass
382db10e848d changed: #parse:with:return:or:
Claus Gittinger <cg@exept.de>
parents: 13569
diff changeset
  3814
!
382db10e848d changed: #parse:with:return:or:
Claus Gittinger <cg@exept.de>
parents: 13569
diff changeset
  3815
382db10e848d changed: #parse:with:return:or:
Claus Gittinger <cg@exept.de>
parents: 13569
diff changeset
  3816
parserClass:something
382db10e848d changed: #parse:with:return:or:
Claus Gittinger <cg@exept.de>
parents: 13569
diff changeset
  3817
    parserClass := something.
382db10e848d changed: #parse:with:return:or:
Claus Gittinger <cg@exept.de>
parents: 13569
diff changeset
  3818
!
382db10e848d changed: #parse:with:return:or:
Claus Gittinger <cg@exept.de>
parents: 13569
diff changeset
  3819
13660
Claus Gittinger <cg@exept.de>
parents: 13659
diff changeset
  3820
parserClass:parserClassArg method:methodArg
13570
382db10e848d changed: #parse:with:return:or:
Claus Gittinger <cg@exept.de>
parents: 13569
diff changeset
  3821
    parserClass := parserClassArg.
382db10e848d changed: #parse:with:return:or:
Claus Gittinger <cg@exept.de>
parents: 13569
diff changeset
  3822
    method := methodArg.
382db10e848d changed: #parse:with:return:or:
Claus Gittinger <cg@exept.de>
parents: 13569
diff changeset
  3823
!
382db10e848d changed: #parse:with:return:or:
Claus Gittinger <cg@exept.de>
parents: 13569
diff changeset
  3824
13660
Claus Gittinger <cg@exept.de>
parents: 13659
diff changeset
  3825
parserClass:parserClassArg method:methodArg parser:parserArg
13570
382db10e848d changed: #parse:with:return:or:
Claus Gittinger <cg@exept.de>
parents: 13569
diff changeset
  3826
    parserClass := parserClassArg.
382db10e848d changed: #parse:with:return:or:
Claus Gittinger <cg@exept.de>
parents: 13569
diff changeset
  3827
    method := methodArg.
382db10e848d changed: #parse:with:return:or:
Claus Gittinger <cg@exept.de>
parents: 13569
diff changeset
  3828
    parser := parserArg.
382db10e848d changed: #parse:with:return:or:
Claus Gittinger <cg@exept.de>
parents: 13569
diff changeset
  3829
382db10e848d changed: #parse:with:return:or:
Claus Gittinger <cg@exept.de>
parents: 13569
diff changeset
  3830
    "Created: / 08-08-2011 / 19:05:02 / cg"
382db10e848d changed: #parse:with:return:or:
Claus Gittinger <cg@exept.de>
parents: 13569
diff changeset
  3831
! !
382db10e848d changed: #parse:with:return:or:
Claus Gittinger <cg@exept.de>
parents: 13569
diff changeset
  3832
1775
6892b91ddc0b F_CALLED flag is no longer present
Claus Gittinger <cg@exept.de>
parents: 1692
diff changeset
  3833
!Method class methodsFor:'documentation'!
872
af04035b443d binary class storage support
Claus Gittinger <cg@exept.de>
parents: 829
diff changeset
  3834
13569
82bcca38e855 comment/format in: #sends:or:
Claus Gittinger <cg@exept.de>
parents: 13567
diff changeset
  3835
version
16384
f36e185cbc66 class: Method
Claus Gittinger <cg@exept.de>
parents: 16271
diff changeset
  3836
    ^ '$Header: /cvs/stx/stx/libbasic/Method.st,v 1.436 2014-04-22 15:56:44 cg Exp $'
13569
82bcca38e855 comment/format in: #sends:or:
Claus Gittinger <cg@exept.de>
parents: 13567
diff changeset
  3837
!
82bcca38e855 comment/format in: #sends:or:
Claus Gittinger <cg@exept.de>
parents: 13567
diff changeset
  3838
13422
b43a8a47037c Jan's changes
vrany
parents: 13390
diff changeset
  3839
version_CVS
16384
f36e185cbc66 class: Method
Claus Gittinger <cg@exept.de>
parents: 16271
diff changeset
  3840
    ^ '$Header: /cvs/stx/stx/libbasic/Method.st,v 1.436 2014-04-22 15:56:44 cg Exp $'
12159
1768c0019100 compiler interface
fm
parents: 12017
diff changeset
  3841
!
1768c0019100 compiler interface
fm
parents: 12017
diff changeset
  3842
13422
b43a8a47037c Jan's changes
vrany
parents: 13390
diff changeset
  3843
version_SVN
15245
84fe46f42c9f class: Method
Claus Gittinger <cg@exept.de>
parents: 15109
diff changeset
  3844
    ^ '$ Id: Method.st 10648 2011-06-23 15:55:10Z vranyj1 $'
1
a27a279701f8 Initial revision
claus
parents:
diff changeset
  3845
! !
6956
23f0066163ff oops - EOL comments were handled wrong
Claus Gittinger <cg@exept.de>
parents: 6725
diff changeset
  3846
14863
49e50305f097 class: Method
Claus Gittinger <cg@exept.de>
parents: 14595
diff changeset
  3847
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
  3848
Method initialize!