Method.st
author Stefan Vogel <sv@exept.de>
Sat, 28 Jun 2008 14:17:18 +0200
changeset 11066 95bf9204e56b
parent 11022 8dd9f699915f
child 11146 553e658691d2
permissions -rw-r--r--
changed #rawSourceStream -- take care of cached streams, that are no longer open
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
10207
b5ca553d15ad localSourceFirst for extensions.
Claus Gittinger <cg@exept.de>
parents: 10201
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
10375
b1558b2e851d care for source access BEFORE being initialized.
ca
parents: 10207
diff changeset
    15
	instanceVariableNames:'source sourcePosition category package mclass'
b1558b2e851d care for source access BEFORE being initialized.
ca
parents: 10207
diff changeset
    16
	classVariableNames:'PrivateMethodSignal LastFileReference LastSourceFileName
b1558b2e851d care for source access BEFORE being initialized.
ca
parents: 10207
diff changeset
    17
		LastWhoClass LastFileLock LastMethodSources LastMethodSourcesLock
b1558b2e851d care for source access BEFORE being initialized.
ca
parents: 10207
diff changeset
    18
		CompilationLock'
b1558b2e851d care for source access BEFORE being initialized.
ca
parents: 10207
diff changeset
    19
	poolDictionaries:''
b1558b2e851d care for source access BEFORE being initialized.
ca
parents: 10207
diff changeset
    20
	category:'Kernel-Methods'
1
a27a279701f8 Initial revision
claus
parents:
diff changeset
    21
!
a27a279701f8 Initial revision
claus
parents:
diff changeset
    22
1851
4accc9fafd19 change #who to return a proper object
Claus Gittinger <cg@exept.de>
parents: 1813
diff changeset
    23
Object subclass:#MethodWhoInfo
10375
b1558b2e851d care for source access BEFORE being initialized.
ca
parents: 10207
diff changeset
    24
	instanceVariableNames:'myClass mySelector'
b1558b2e851d care for source access BEFORE being initialized.
ca
parents: 10207
diff changeset
    25
	classVariableNames:''
b1558b2e851d care for source access BEFORE being initialized.
ca
parents: 10207
diff changeset
    26
	poolDictionaries:''
b1558b2e851d care for source access BEFORE being initialized.
ca
parents: 10207
diff changeset
    27
	privateIn:Method
1851
4accc9fafd19 change #who to return a proper object
Claus Gittinger <cg@exept.de>
parents: 1813
diff changeset
    28
!
4accc9fafd19 change #who to return a proper object
Claus Gittinger <cg@exept.de>
parents: 1813
diff changeset
    29
1775
6892b91ddc0b F_CALLED flag is no longer present
Claus Gittinger <cg@exept.de>
parents: 1692
diff changeset
    30
!Method class methodsFor:'documentation'!
42
e33491f6f260 *** empty log message ***
claus
parents: 39
diff changeset
    31
88
81dacba7a63a *** empty log message ***
claus
parents: 85
diff changeset
    32
copyright
81dacba7a63a *** empty log message ***
claus
parents: 85
diff changeset
    33
"
81dacba7a63a *** empty log message ***
claus
parents: 85
diff changeset
    34
 COPYRIGHT (c) 1989 by Claus Gittinger
10207
b5ca553d15ad localSourceFirst for extensions.
Claus Gittinger <cg@exept.de>
parents: 10201
diff changeset
    35
              All Rights Reserved
88
81dacba7a63a *** empty log message ***
claus
parents: 85
diff changeset
    36
81dacba7a63a *** empty log message ***
claus
parents: 85
diff changeset
    37
 This software is furnished under a license and may be used
81dacba7a63a *** empty log message ***
claus
parents: 85
diff changeset
    38
 only in accordance with the terms of that license and with the
81dacba7a63a *** empty log message ***
claus
parents: 85
diff changeset
    39
 inclusion of the above copyright notice.   This software may not
81dacba7a63a *** empty log message ***
claus
parents: 85
diff changeset
    40
 be provided or otherwise made available to, or used by, any
81dacba7a63a *** empty log message ***
claus
parents: 85
diff changeset
    41
 other person.  No title to or ownership of the software is
81dacba7a63a *** empty log message ***
claus
parents: 85
diff changeset
    42
 hereby transferred.
81dacba7a63a *** empty log message ***
claus
parents: 85
diff changeset
    43
"
81dacba7a63a *** empty log message ***
claus
parents: 85
diff changeset
    44
!
81dacba7a63a *** empty log message ***
claus
parents: 85
diff changeset
    45
42
e33491f6f260 *** empty log message ***
claus
parents: 39
diff changeset
    46
documentation
e33491f6f260 *** empty log message ***
claus
parents: 39
diff changeset
    47
"
68
59faa75185ba *** empty log message ***
claus
parents: 56
diff changeset
    48
    this class defines protocol for executable methods;
59faa75185ba *** empty log message ***
claus
parents: 56
diff changeset
    49
    both compiled and interpreted methods are represented by this class.
59faa75185ba *** empty log message ***
claus
parents: 56
diff changeset
    50
    Compiled methods have a non-nil code field, while interpreted methods have
59faa75185ba *** empty log message ***
claus
parents: 56
diff changeset
    51
    a nil code field and non-nil byteCode field.
88
81dacba7a63a *** empty log message ***
claus
parents: 85
diff changeset
    52
    If there are both non-nil code and bytecode fields, the VM will execute
227
23b1c4de3402 package & cleanup
claus
parents: 216
diff changeset
    53
    the machine-code of a method. If both are nil when executed, a noByteCode
23b1c4de3402 package & cleanup
claus
parents: 216
diff changeset
    54
    message is sent by the VM to the method where a signal is raised.
1
a27a279701f8 Initial revision
claus
parents:
diff changeset
    55
227
23b1c4de3402 package & cleanup
claus
parents: 216
diff changeset
    56
    The methods sourcecode is represented by source and sourcePosition:
23b1c4de3402 package & cleanup
claus
parents: 216
diff changeset
    57
    - if sourcePosition is a Number, the source-field is the fileName and
23b1c4de3402 package & cleanup
claus
parents: 216
diff changeset
    58
      sourcePosition is the character offset of the source-chunk in this source file.
23b1c4de3402 package & cleanup
claus
parents: 216
diff changeset
    59
    - If sourcePosition is nil, the source is the string in the source field.
23b1c4de3402 package & cleanup
claus
parents: 216
diff changeset
    60
    (an old version used ExternalString instances here, but that lead to
23b1c4de3402 package & cleanup
claus
parents: 216
diff changeset
    61
     10000 additional little objects ...)
1
a27a279701f8 Initial revision
claus
parents:
diff changeset
    62
68
59faa75185ba *** empty log message ***
claus
parents: 56
diff changeset
    63
    The flags field defines things like the number of method-locals,
227
23b1c4de3402 package & cleanup
claus
parents: 216
diff changeset
    64
    method arguments and stack requirements (for interpreted methods).
68
59faa75185ba *** empty log message ***
claus
parents: 56
diff changeset
    65
    Do not depend on any value in the flags field - it may change without
59faa75185ba *** empty log message ***
claus
parents: 56
diff changeset
    66
    notice.
1
a27a279701f8 Initial revision
claus
parents:
diff changeset
    67
438
claus
parents: 423
diff changeset
    68
    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
    69
    identified not by being an instance of Block or Method, but instead by
438
claus
parents: 423
diff changeset
    70
    having the executable flag bit set in the class. The VM can execute anything
claus
parents: 423
diff changeset
    71
    which is identified as executable (assuming that the first instance variable
claus
parents: 423
diff changeset
    72
    is the machine-code address) - this allows for easy future extension.
claus
parents: 423
diff changeset
    73
1293
02fb05148c98 documentation
Claus Gittinger <cg@exept.de>
parents: 1264
diff changeset
    74
    [Instance variables:]
93
e31220cb391f *** empty log message ***
claus
parents: 88
diff changeset
    75
10207
b5ca553d15ad localSourceFirst for extensions.
Claus Gittinger <cg@exept.de>
parents: 10201
diff changeset
    76
        source          <String>        the source itself (if sourcePosition isNil)
b5ca553d15ad localSourceFirst for extensions.
Claus Gittinger <cg@exept.de>
parents: 10201
diff changeset
    77
                                        or the fileName where the source is found
b5ca553d15ad localSourceFirst for extensions.
Claus Gittinger <cg@exept.de>
parents: 10201
diff changeset
    78
b5ca553d15ad localSourceFirst for extensions.
Claus Gittinger <cg@exept.de>
parents: 10201
diff changeset
    79
        sourcePosition  <Integer>       the position of the methods chunk in the file
b5ca553d15ad localSourceFirst for extensions.
Claus Gittinger <cg@exept.de>
parents: 10201
diff changeset
    80
b5ca553d15ad localSourceFirst for extensions.
Claus Gittinger <cg@exept.de>
parents: 10201
diff changeset
    81
        category        <Symbol>        the methods category
b5ca553d15ad localSourceFirst for extensions.
Claus Gittinger <cg@exept.de>
parents: 10201
diff changeset
    82
        package         <Symbol>        the package, in which the methods was defined
b5ca553d15ad localSourceFirst for extensions.
Claus Gittinger <cg@exept.de>
parents: 10201
diff changeset
    83
        mclass          <Class>         the class in which I am defined
b5ca553d15ad localSourceFirst for extensions.
Claus Gittinger <cg@exept.de>
parents: 10201
diff changeset
    84
        indexed slots                   literals
227
23b1c4de3402 package & cleanup
claus
parents: 216
diff changeset
    85
1293
02fb05148c98 documentation
Claus Gittinger <cg@exept.de>
parents: 1264
diff changeset
    86
    [Class variables:]
227
23b1c4de3402 package & cleanup
claus
parents: 216
diff changeset
    87
10207
b5ca553d15ad localSourceFirst for extensions.
Claus Gittinger <cg@exept.de>
parents: 10201
diff changeset
    88
        PrivateMethodSignal             raised on privacy violation (see docu)
b5ca553d15ad localSourceFirst for extensions.
Claus Gittinger <cg@exept.de>
parents: 10201
diff changeset
    89
b5ca553d15ad localSourceFirst for extensions.
Claus Gittinger <cg@exept.de>
parents: 10201
diff changeset
    90
        LastFileReference               weak reference to the last sourceFile
b5ca553d15ad localSourceFirst for extensions.
Claus Gittinger <cg@exept.de>
parents: 10201
diff changeset
    91
        LastSourceFileName              to speedup source access via NFS
93
e31220cb391f *** empty log message ***
claus
parents: 88
diff changeset
    92
68
59faa75185ba *** empty log message ***
claus
parents: 56
diff changeset
    93
    WARNING: layout known by compiler and runtime system - dont change
1293
02fb05148c98 documentation
Claus Gittinger <cg@exept.de>
parents: 1264
diff changeset
    94
02fb05148c98 documentation
Claus Gittinger <cg@exept.de>
parents: 1264
diff changeset
    95
    [author:]
10207
b5ca553d15ad localSourceFirst for extensions.
Claus Gittinger <cg@exept.de>
parents: 10201
diff changeset
    96
        Claus Gittinger
42
e33491f6f260 *** empty log message ***
claus
parents: 39
diff changeset
    97
"
176
48061f8659aa more queries
claus
parents: 159
diff changeset
    98
!
48061f8659aa more queries
claus
parents: 159
diff changeset
    99
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
   100
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
   101
"
5277
d457937a69e5 comments & code-cleanup in #who
Claus Gittinger <cg@exept.de>
parents: 5241
diff changeset
   102
    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
   103
    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
   104
    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
   105
    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
   106
    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
   107
    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
   108
    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
   109
    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
   110
d457937a69e5 comments & code-cleanup in #who
Claus Gittinger <cg@exept.de>
parents: 5241
diff changeset
   111
    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
   112
    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
   113
    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
   114
    which is compiled by the machines native C-compiler.
d457937a69e5 comments & code-cleanup in #who
Claus Gittinger <cg@exept.de>
parents: 5241
diff changeset
   115
    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
   116
"
d600e08a5936 handle the case where a method has a sourceFileInfo, but the class has not
Claus Gittinger <cg@exept.de>
parents: 934
diff changeset
   117
!
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
176
48061f8659aa more queries
claus
parents: 159
diff changeset
   119
privacy 
48061f8659aa more queries
claus
parents: 159
diff changeset
   120
"
48061f8659aa more queries
claus
parents: 159
diff changeset
   121
    ST/X includes an EXPERIMENTAL implementation of method privacy.
48061f8659aa more queries
claus
parents: 159
diff changeset
   122
    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
   123
    privacy:#private and privacy:#protected messages. Also, categories may be
202
40ca7cc6fb9c *** empty log message ***
claus
parents: 192
diff changeset
   124
    filedIn as a whole as private using #privateMethodsFor: or as
40ca7cc6fb9c *** empty log message ***
claus
parents: 192
diff changeset
   125
    protected using #protectedMethodsFor: instead of the well known #methodsFor:.
40ca7cc6fb9c *** empty log message ***
claus
parents: 192
diff changeset
   126
176
48061f8659aa more queries
claus
parents: 159
diff changeset
   127
    The additional #publicMethodsFor: is for documentation purposes, and
227
23b1c4de3402 package & cleanup
claus
parents: 216
diff changeset
   128
    is equivalent to #methodsFor: (also to support fileIn of ENVY methods).
176
48061f8659aa more queries
claus
parents: 159
diff changeset
   129
8518
7dc3f9909640 Interchanged the meaning of method privacy -
Stefan Vogel <sv@exept.de>
parents: 8465
diff changeset
   130
    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
   131
    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
   132
    class itself or subclasses.
8518
7dc3f9909640 Interchanged the meaning of method privacy -
Stefan Vogel <sv@exept.de>
parents: 8465
diff changeset
   133
    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
   134
    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
   135
    (i.e. protected methods are less private than private ones)
176
48061f8659aa more queries
claus
parents: 159
diff changeset
   136
48061f8659aa more queries
claus
parents: 159
diff changeset
   137
    When such a situation arises, the VM (runtime system) will raise the
48061f8659aa more queries
claus
parents: 159
diff changeset
   138
    PrivateMethodSignal exception (if nonNil), which usually brings you into the
48061f8659aa more queries
claus
parents: 159
diff changeset
   139
    debugger.
48061f8659aa more queries
claus
parents: 159
diff changeset
   140
227
23b1c4de3402 package & cleanup
claus
parents: 216
diff changeset
   141
    If PrivateMethodSignal is nil, the VM will not check for this, and
176
48061f8659aa more queries
claus
parents: 159
diff changeset
   142
    execution is as usual. (you may want to nil-it for production code,
48061f8659aa more queries
claus
parents: 159
diff changeset
   143
    and leave it non nil during development).
48061f8659aa more queries
claus
parents: 159
diff changeset
   144
48061f8659aa more queries
claus
parents: 159
diff changeset
   145
    NOTICE: there is no (not yet ?) standard defined for method privacy,
5277
d457937a69e5 comments & code-cleanup in #who
Claus Gittinger <cg@exept.de>
parents: 5241
diff changeset
   146
    however, the definition protocol was designed to be somewhat ENVY compatible 
d457937a69e5 comments & code-cleanup in #who
Claus Gittinger <cg@exept.de>
parents: 5241
diff changeset
   147
    (from what can be deduced by reading PD code).
d457937a69e5 comments & code-cleanup in #who
Claus Gittinger <cg@exept.de>
parents: 5241
diff changeset
   148
176
48061f8659aa more queries
claus
parents: 159
diff changeset
   149
    Also, the usability of privacy is still to be tested.
415
claus
parents: 414
diff changeset
   150
    This interface, the implementation and the rules for when a privacy violation
claus
parents: 414
diff changeset
   151
    may change (in case of some ANSI standard being defined).
227
23b1c4de3402 package & cleanup
claus
parents: 216
diff changeset
   152
    Be warned and send me suggestions & critics (constructive ;-)
5277
d457937a69e5 comments & code-cleanup in #who
Claus Gittinger <cg@exept.de>
parents: 5241
diff changeset
   153
d457937a69e5 comments & code-cleanup in #who
Claus Gittinger <cg@exept.de>
parents: 5241
diff changeset
   154
    Late note (Feb 2000):
8518
7dc3f9909640 Interchanged the meaning of method privacy -
Stefan Vogel <sv@exept.de>
parents: 8465
diff changeset
   155
        the privacy feature has new been in ST/X for some years and was NOT heavily
7dc3f9909640 Interchanged the meaning of method privacy -
Stefan Vogel <sv@exept.de>
parents: 8465
diff changeset
   156
        used - neither at eXept, nor by customers.
7dc3f9909640 Interchanged the meaning of method privacy -
Stefan Vogel <sv@exept.de>
parents: 8465
diff changeset
   157
        In Smalltalk, it seems to be a very questionable feature, actually limiting
7dc3f9909640 Interchanged the meaning of method privacy -
Stefan Vogel <sv@exept.de>
parents: 8465
diff changeset
   158
        code reusability.
7dc3f9909640 Interchanged the meaning of method privacy -
Stefan Vogel <sv@exept.de>
parents: 8465
diff changeset
   159
        The privacy features are left in the system to demonstrate that it can be
7dc3f9909640 Interchanged the meaning of method privacy -
Stefan Vogel <sv@exept.de>
parents: 8465
diff changeset
   160
        done in Smalltalk (for religious C++ fans ... to avoid useless discussions)
7dc3f9909640 Interchanged the meaning of method privacy -
Stefan Vogel <sv@exept.de>
parents: 8465
diff changeset
   161
        (the check is not expensive, w.r.t. the VM runtime behavior).
176
48061f8659aa more queries
claus
parents: 159
diff changeset
   162
"
42
e33491f6f260 *** empty log message ***
claus
parents: 39
diff changeset
   163
! !
1
a27a279701f8 Initial revision
claus
parents:
diff changeset
   164
1775
6892b91ddc0b F_CALLED flag is no longer present
Claus Gittinger <cg@exept.de>
parents: 1692
diff changeset
   165
!Method class methodsFor:'initialization'!
109
1fae65190b17 errors raise signals; check arg-count in valueWith...
claus
parents: 93
diff changeset
   166
1fae65190b17 errors raise signals; check arg-count in valueWith...
claus
parents: 93
diff changeset
   167
initialize
1254
48c2748b5197 commentary
Claus Gittinger <cg@exept.de>
parents: 1236
diff changeset
   168
    "create signals"
48c2748b5197 commentary
Claus Gittinger <cg@exept.de>
parents: 1236
diff changeset
   169
109
1fae65190b17 errors raise signals; check arg-count in valueWith...
claus
parents: 93
diff changeset
   170
    PrivateMethodSignal isNil ifTrue:[
7601
57c257f1150a Fix race when accessing source
Stefan Vogel <sv@exept.de>
parents: 7457
diff changeset
   171
        "EXPERIMENTAL"
57c257f1150a Fix race when accessing source
Stefan Vogel <sv@exept.de>
parents: 7457
diff changeset
   172
        PrivateMethodSignal := ExecutionError newSignalMayProceed:true.
57c257f1150a Fix race when accessing source
Stefan Vogel <sv@exept.de>
parents: 7457
diff changeset
   173
        PrivateMethodSignal nameClass:self message:#privateMethodSignal.
57c257f1150a Fix race when accessing source
Stefan Vogel <sv@exept.de>
parents: 7457
diff changeset
   174
        PrivateMethodSignal notifierString:'attempt to execute private/protected method'.
2079
bcf84ab30304 Make cached sourcefile thread-protected.
Stefan Vogel <sv@exept.de>
parents: 2066
diff changeset
   175
    ].
bcf84ab30304 Make cached sourcefile thread-protected.
Stefan Vogel <sv@exept.de>
parents: 2066
diff changeset
   176
bcf84ab30304 Make cached sourcefile thread-protected.
Stefan Vogel <sv@exept.de>
parents: 2066
diff changeset
   177
    LastFileLock isNil ifTrue:[
9119
e633e55e69be avoid deadlock on recursionLock when accessing methods source
Claus Gittinger <cg@exept.de>
parents: 9096
diff changeset
   178
        LastFileLock := RecursionLock new name:'Method-LastFile'.
e633e55e69be avoid deadlock on recursionLock when accessing methods source
Claus Gittinger <cg@exept.de>
parents: 9096
diff changeset
   179
        LastMethodSourcesLock := RecursionLock new name:'Method-LastMethodSources'.
7601
57c257f1150a Fix race when accessing source
Stefan Vogel <sv@exept.de>
parents: 7457
diff changeset
   180
        LastFileReference := WeakArray new:1.
57c257f1150a Fix race when accessing source
Stefan Vogel <sv@exept.de>
parents: 7457
diff changeset
   181
        LastFileReference at:1 put:0.
2079
bcf84ab30304 Make cached sourcefile thread-protected.
Stefan Vogel <sv@exept.de>
parents: 2066
diff changeset
   182
    ].
1254
48c2748b5197 commentary
Claus Gittinger <cg@exept.de>
parents: 1236
diff changeset
   183
5387
f855cf3b2f67 need a recursionLock as compilationLock
Claus Gittinger <cg@exept.de>
parents: 5386
diff changeset
   184
    CompilationLock := RecursionLock new name:'MethodCompilation'.
4290
5e43473d7a35 moved recompilation semaphore from LazyMethod to Method
Claus Gittinger <cg@exept.de>
parents: 4015
diff changeset
   185
1254
48c2748b5197 commentary
Claus Gittinger <cg@exept.de>
parents: 1236
diff changeset
   186
    "Modified: 22.4.1996 / 16:34:38 / cg"
2079
bcf84ab30304 Make cached sourcefile thread-protected.
Stefan Vogel <sv@exept.de>
parents: 2066
diff changeset
   187
    "Modified: 3.1.1997 / 16:58:16 / stefan"
10375
b1558b2e851d care for source access BEFORE being initialized.
ca
parents: 10207
diff changeset
   188
!
b1558b2e851d care for source access BEFORE being initialized.
ca
parents: 10207
diff changeset
   189
b1558b2e851d care for source access BEFORE being initialized.
ca
parents: 10207
diff changeset
   190
lastMethodSourcesLock
b1558b2e851d care for source access BEFORE being initialized.
ca
parents: 10207
diff changeset
   191
    LastMethodSourcesLock isNil ifTrue:[
b1558b2e851d care for source access BEFORE being initialized.
ca
parents: 10207
diff changeset
   192
        self initialize
b1558b2e851d care for source access BEFORE being initialized.
ca
parents: 10207
diff changeset
   193
    ].
b1558b2e851d care for source access BEFORE being initialized.
ca
parents: 10207
diff changeset
   194
    ^ LastMethodSourcesLock
109
1fae65190b17 errors raise signals; check arg-count in valueWith...
claus
parents: 93
diff changeset
   195
! !
1fae65190b17 errors raise signals; check arg-count in valueWith...
claus
parents: 93
diff changeset
   196
1775
6892b91ddc0b F_CALLED flag is no longer present
Claus Gittinger <cg@exept.de>
parents: 1692
diff changeset
   197
!Method class methodsFor:'Signal constants'!
159
514c749165c3 *** empty log message ***
claus
parents: 142
diff changeset
   198
514c749165c3 *** empty log message ***
claus
parents: 142
diff changeset
   199
privateMethodSignal
176
48061f8659aa more queries
claus
parents: 159
diff changeset
   200
    "return the signal raised when a private/protected method is called
48061f8659aa more queries
claus
parents: 159
diff changeset
   201
     by some other object (i.e. not a self- or super send)"
48061f8659aa more queries
claus
parents: 159
diff changeset
   202
159
514c749165c3 *** empty log message ***
claus
parents: 142
diff changeset
   203
    ^ PrivateMethodSignal
514c749165c3 *** empty log message ***
claus
parents: 142
diff changeset
   204
! !
514c749165c3 *** empty log message ***
claus
parents: 142
diff changeset
   205
11022
8dd9f699915f +shouldBeSkippedInDebuggersWalkBack
Claus Gittinger <cg@exept.de>
parents: 11016
diff changeset
   206
1775
6892b91ddc0b F_CALLED flag is no longer present
Claus Gittinger <cg@exept.de>
parents: 1692
diff changeset
   207
!Method class methodsFor:'queries'!
3
24d81bf47225 *** empty log message ***
claus
parents: 2
diff changeset
   208
24d81bf47225 *** empty log message ***
claus
parents: 2
diff changeset
   209
isBuiltInClass
1264
8d916aa63bce commentary
Claus Gittinger <cg@exept.de>
parents: 1260
diff changeset
   210
    "return true if this class is known by the run-time-system.
8d916aa63bce commentary
Claus Gittinger <cg@exept.de>
parents: 1260
diff changeset
   211
     Here, true is returned for myself, false for subclasses."
3
24d81bf47225 *** empty log message ***
claus
parents: 2
diff changeset
   212
24d81bf47225 *** empty log message ***
claus
parents: 2
diff changeset
   213
    ^ self == Method
1264
8d916aa63bce commentary
Claus Gittinger <cg@exept.de>
parents: 1260
diff changeset
   214
8d916aa63bce commentary
Claus Gittinger <cg@exept.de>
parents: 1260
diff changeset
   215
    "Modified: 23.4.1996 / 15:59:50 / cg"
44
b262907c93ea *** empty log message ***
claus
parents: 42
diff changeset
   216
!
b262907c93ea *** empty log message ***
claus
parents: 42
diff changeset
   217
6089
a3710756f360 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6071
diff changeset
   218
methodDefinitionTemplateForSelector:aSelector
a3710756f360 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6071
diff changeset
   219
    "given a selector, return a prototype definition string"
a3710756f360 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6071
diff changeset
   220
6091
196638989ccb *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6090
diff changeset
   221
    |nA argNames|
196638989ccb *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6090
diff changeset
   222
196638989ccb *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6090
diff changeset
   223
    (nA := aSelector numArgs) == 1 ifTrue:[
6090
77dfb33df61a *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6089
diff changeset
   224
        argNames := #('arg')
77dfb33df61a *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6089
diff changeset
   225
    ] ifFalse:[
6091
196638989ccb *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6090
diff changeset
   226
        argNames := (1 to:nA) collect:[:i | 'arg' , i printString].
6090
77dfb33df61a *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6089
diff changeset
   227
    ].
77dfb33df61a *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6089
diff changeset
   228
    ^ self 
77dfb33df61a *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6089
diff changeset
   229
        methodDefinitionTemplateForSelector:aSelector 
77dfb33df61a *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6089
diff changeset
   230
        andArgumentNames:argNames.
77dfb33df61a *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6089
diff changeset
   231
77dfb33df61a *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6089
diff changeset
   232
    "
77dfb33df61a *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6089
diff changeset
   233
     Method methodDefinitionTemplateForSelector:#foo           
77dfb33df61a *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6089
diff changeset
   234
     Method methodDefinitionTemplateForSelector:#+             
77dfb33df61a *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6089
diff changeset
   235
     Method methodDefinitionTemplateForSelector:#foo:bar:baz:  
77dfb33df61a *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6089
diff changeset
   236
    "
77dfb33df61a *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6089
diff changeset
   237
!
77dfb33df61a *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6089
diff changeset
   238
77dfb33df61a *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6089
diff changeset
   239
methodDefinitionTemplateForSelector:aSelector andArgumentNames:argNames
77dfb33df61a *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6089
diff changeset
   240
    "given a selector, return a prototype definition string"
77dfb33df61a *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6089
diff changeset
   241
6089
a3710756f360 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6071
diff changeset
   242
    aSelector numArgs > 0 ifTrue:[
a3710756f360 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6071
diff changeset
   243
        aSelector isKeyword ifTrue:[
a3710756f360 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6071
diff changeset
   244
            ^ String streamContents:[:stream |
9364
beef5f0aa8bb New: #methodDefinitionTemplate
Stefan Vogel <sv@exept.de>
parents: 9288
diff changeset
   245
                aSelector keywords with:argNames do:[:eachKeyword :eachArgName| 
beef5f0aa8bb New: #methodDefinitionTemplate
Stefan Vogel <sv@exept.de>
parents: 9288
diff changeset
   246
                    stream nextPutAll:eachKeyword; nextPutAll:eachArgName; space.
beef5f0aa8bb New: #methodDefinitionTemplate
Stefan Vogel <sv@exept.de>
parents: 9288
diff changeset
   247
                ].
beef5f0aa8bb New: #methodDefinitionTemplate
Stefan Vogel <sv@exept.de>
parents: 9288
diff changeset
   248
                stream backStep.   "remove the last space"
beef5f0aa8bb New: #methodDefinitionTemplate
Stefan Vogel <sv@exept.de>
parents: 9288
diff changeset
   249
             ].
6089
a3710756f360 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6071
diff changeset
   250
        ].
6090
77dfb33df61a *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6089
diff changeset
   251
        ^ aSelector , ' ' , (argNames at:1)
6089
a3710756f360 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6071
diff changeset
   252
    ].
a3710756f360 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6071
diff changeset
   253
    ^ aSelector
a3710756f360 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6071
diff changeset
   254
a3710756f360 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6071
diff changeset
   255
    "
6090
77dfb33df61a *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6089
diff changeset
   256
     Method methodDefinitionTemplateForSelector:#foo          andArgumentNames:#()        
77dfb33df61a *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6089
diff changeset
   257
     Method methodDefinitionTemplateForSelector:#+            andArgumentNames:#('aNumber') 
77dfb33df61a *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6089
diff changeset
   258
     Method methodDefinitionTemplateForSelector:#foo:bar:baz: andArgumentNames:#('fooArg' 'barArg' 'bazArg') 
6089
a3710756f360 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6071
diff changeset
   259
    "
a3710756f360 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6071
diff changeset
   260
!
a3710756f360 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6071
diff changeset
   261
747
ea3b6f7fd7ce added ignoredMethods
Claus Gittinger <cg@exept.de>
parents: 737
diff changeset
   262
methodPrivacySupported
ea3b6f7fd7ce added ignoredMethods
Claus Gittinger <cg@exept.de>
parents: 737
diff changeset
   263
    "return true, if the system was compiled to support methodPrivacy.
ea3b6f7fd7ce added ignoredMethods
Claus Gittinger <cg@exept.de>
parents: 737
diff changeset
   264
     You should not depend on that feature being available."
ea3b6f7fd7ce added ignoredMethods
Claus Gittinger <cg@exept.de>
parents: 737
diff changeset
   265
ea3b6f7fd7ce added ignoredMethods
Claus Gittinger <cg@exept.de>
parents: 737
diff changeset
   266
%{  /* NOCONTEXT */
ea3b6f7fd7ce added ignoredMethods
Claus Gittinger <cg@exept.de>
parents: 737
diff changeset
   267
#if defined(F_PRIVATE) || defined(F_CLASSPRIVATE)
ea3b6f7fd7ce added ignoredMethods
Claus Gittinger <cg@exept.de>
parents: 737
diff changeset
   268
    RETURN (true);
ea3b6f7fd7ce added ignoredMethods
Claus Gittinger <cg@exept.de>
parents: 737
diff changeset
   269
#else
ea3b6f7fd7ce added ignoredMethods
Claus Gittinger <cg@exept.de>
parents: 737
diff changeset
   270
    RETURN (false);
ea3b6f7fd7ce added ignoredMethods
Claus Gittinger <cg@exept.de>
parents: 737
diff changeset
   271
#endif
ea3b6f7fd7ce added ignoredMethods
Claus Gittinger <cg@exept.de>
parents: 737
diff changeset
   272
%}
3342
8bcf0fc80a21 class method #resourceTypes re-added
tz
parents: 3341
diff changeset
   273
!
8bcf0fc80a21 class method #resourceTypes re-added
tz
parents: 3341
diff changeset
   274
8bcf0fc80a21 class method #resourceTypes re-added
tz
parents: 3341
diff changeset
   275
resourceTypes
8bcf0fc80a21 class method #resourceTypes re-added
tz
parents: 3341
diff changeset
   276
    "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
   277
8526
326e7dcb212a *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 8518
diff changeset
   278
    ^ #(canvas menu image fileImage help hierarchicalList tabList tableColumns)
3
24d81bf47225 *** empty log message ***
claus
parents: 2
diff changeset
   279
! !
24d81bf47225 *** empty log message ***
claus
parents: 2
diff changeset
   280
1775
6892b91ddc0b F_CALLED flag is no longer present
Claus Gittinger <cg@exept.de>
parents: 1692
diff changeset
   281
!Method class methodsFor:'special'!
957
b405ae99d437 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 952
diff changeset
   282
b405ae99d437 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 952
diff changeset
   283
flushSourceStreamCache
8117
2ad20fde13a3 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 7830
diff changeset
   284
    LastSourceFileName := LastMethodSources := nil.
2ad20fde13a3 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 7830
diff changeset
   285
    LastFileReference at:1 put:0.
957
b405ae99d437 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 952
diff changeset
   286
7830
a19d3746255f comment
Claus Gittinger <cg@exept.de>
parents: 7771
diff changeset
   287
    "
a19d3746255f comment
Claus Gittinger <cg@exept.de>
parents: 7771
diff changeset
   288
     Method flushSourceStreamCache
a19d3746255f comment
Claus Gittinger <cg@exept.de>
parents: 7771
diff changeset
   289
    "
a19d3746255f comment
Claus Gittinger <cg@exept.de>
parents: 7771
diff changeset
   290
957
b405ae99d437 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 952
diff changeset
   291
    "Created: 9.2.1996 / 19:05:28 / cg"
b405ae99d437 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 952
diff changeset
   292
! !
b405ae99d437 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 952
diff changeset
   293
7261
f35fc9cee675 method category rename
Claus Gittinger <cg@exept.de>
parents: 7258
diff changeset
   294
!Method methodsFor:'Compatibility-VW'!
5967
ab762bb4f64f added #sendsSelector:
Claus Gittinger <cg@exept.de>
parents: 5959
diff changeset
   295
ab762bb4f64f added #sendsSelector:
Claus Gittinger <cg@exept.de>
parents: 5959
diff changeset
   296
sendsSelector:aSelectorSymbol
ab762bb4f64f added #sendsSelector:
Claus Gittinger <cg@exept.de>
parents: 5959
diff changeset
   297
    "return true, if this method contains a message-send
ab762bb4f64f added #sendsSelector:
Claus Gittinger <cg@exept.de>
parents: 5959
diff changeset
   298
     with aSelectorSymbol as selector."
ab762bb4f64f added #sendsSelector:
Claus Gittinger <cg@exept.de>
parents: 5959
diff changeset
   299
ab762bb4f64f added #sendsSelector:
Claus Gittinger <cg@exept.de>
parents: 5959
diff changeset
   300
    ^ self sends:aSelectorSymbol
ab762bb4f64f added #sendsSelector:
Claus Gittinger <cg@exept.de>
parents: 5959
diff changeset
   301
! !
ab762bb4f64f added #sendsSelector:
Claus Gittinger <cg@exept.de>
parents: 5959
diff changeset
   302
9096
84df3b129718 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9075
diff changeset
   303
1
a27a279701f8 Initial revision
claus
parents:
diff changeset
   304
!Method methodsFor:'accessing'!
a27a279701f8 Initial revision
claus
parents:
diff changeset
   305
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
   306
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
   307
    "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
   308
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
   309
    ^ category
1
a27a279701f8 Initial revision
claus
parents:
diff changeset
   310
!
a27a279701f8 Initial revision
claus
parents:
diff changeset
   311
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
   312
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
   313
    "set the methods category"
1
a27a279701f8 Initial revision
claus
parents:
diff changeset
   314
5724
96c2a5cf4217 category: and package: now send change notifications.
Claus Gittinger <cg@exept.de>
parents: 5721
diff changeset
   315
    |newCategory oldCategory cls|
5721
5f97733ff519 methods now send change-notifications when the category changes
Claus Gittinger <cg@exept.de>
parents: 5704
diff changeset
   316
3934
a8c6075f9988 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 3845
diff changeset
   317
    aStringOrSymbol notNil ifTrue:[
5721
5f97733ff519 methods now send change-notifications when the category changes
Claus Gittinger <cg@exept.de>
parents: 5704
diff changeset
   318
        newCategory := aStringOrSymbol.
5f97733ff519 methods now send change-notifications when the category changes
Claus Gittinger <cg@exept.de>
parents: 5704
diff changeset
   319
        newCategory ~= (oldCategory := category) ifTrue:[
5f97733ff519 methods now send change-notifications when the category changes
Claus Gittinger <cg@exept.de>
parents: 5704
diff changeset
   320
            self setCategory:newCategory.
5724
96c2a5cf4217 category: and package: now send change notifications.
Claus Gittinger <cg@exept.de>
parents: 5721
diff changeset
   321
10910
d6eb44699802 care for missing mclass in category:
Claus Gittinger <cg@exept.de>
parents: 10857
diff changeset
   322
            cls := self mclass.
d6eb44699802 care for missing mclass in category:
Claus Gittinger <cg@exept.de>
parents: 10857
diff changeset
   323
            cls notNil ifTrue:[
d6eb44699802 care for missing mclass in category:
Claus Gittinger <cg@exept.de>
parents: 10857
diff changeset
   324
                cls addChangeRecordForMethodCategory:self category:newCategory.
d6eb44699802 care for missing mclass in category:
Claus Gittinger <cg@exept.de>
parents: 10857
diff changeset
   325
                self changed:#category with:oldCategory.            "/ will vanish
d6eb44699802 care for missing mclass in category:
Claus Gittinger <cg@exept.de>
parents: 10857
diff changeset
   326
                cls changed:#organization with:self selector.       "/ will vanish
d6eb44699802 care for missing mclass in category:
Claus Gittinger <cg@exept.de>
parents: 10857
diff changeset
   327
                Smalltalk changed:#methodCategory with:(Array with:cls with:self with:oldCategory). 
d6eb44699802 care for missing mclass in category:
Claus Gittinger <cg@exept.de>
parents: 10857
diff changeset
   328
            ]
5721
5f97733ff519 methods now send change-notifications when the category changes
Claus Gittinger <cg@exept.de>
parents: 5704
diff changeset
   329
        ]
3934
a8c6075f9988 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 3845
diff changeset
   330
    ]
a8c6075f9988 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 3845
diff changeset
   331
10729
16fea9f03635 changed #category:
Claus Gittinger <cg@exept.de>
parents: 10673
diff changeset
   332
    "Modified: / 25-09-2007 / 16:15:24 / cg"
1
a27a279701f8 Initial revision
claus
parents:
diff changeset
   333
!
a27a279701f8 Initial revision
claus
parents:
diff changeset
   334
39
bcf183a31bbb *** empty log message ***
claus
parents: 13
diff changeset
   335
comment
bcf183a31bbb *** empty log message ***
claus
parents: 13
diff changeset
   336
    "return the methods comment.
68
59faa75185ba *** empty log message ***
claus
parents: 56
diff changeset
   337
     This is done by searching for and returning the first comment
159
514c749165c3 *** empty log message ***
claus
parents: 142
diff changeset
   338
     from the methods source (excluding any double-quotes). 
68
59faa75185ba *** empty log message ***
claus
parents: 56
diff changeset
   339
     Returns nil if there is no comment (or source is not available)."
39
bcf183a31bbb *** empty log message ***
claus
parents: 13
diff changeset
   340
3297
309058293d49 Fix #comment to return a string (instead of Scanner::Comment).
Stefan Vogel <sv@exept.de>
parents: 3289
diff changeset
   341
    |src comment comments parser|
39
bcf183a31bbb *** empty log message ***
claus
parents: 13
diff changeset
   342
159
514c749165c3 *** empty log message ***
claus
parents: 142
diff changeset
   343
    src := self source.
514c749165c3 *** empty log message ***
claus
parents: 142
diff changeset
   344
    src isNil ifTrue:[^ nil].
93
e31220cb391f *** empty log message ***
claus
parents: 88
diff changeset
   345
1236
5c9bc68e3c71 use new scanner feature to extract comment
Claus Gittinger <cg@exept.de>
parents: 1194
diff changeset
   346
    parser := Parser for:src in:nil.
6988
c5c1ae285622 ignoreErrors / ignoreWarnings are not getters.
penk
parents: 6971
diff changeset
   347
    parser ignoreErrors:true; ignoreWarnings:true; saveComments:true.
1236
5c9bc68e3c71 use new scanner feature to extract comment
Claus Gittinger <cg@exept.de>
parents: 1194
diff changeset
   348
    parser parseMethodSpec.
9075
06679e37a870 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 8913
diff changeset
   349
1236
5c9bc68e3c71 use new scanner feature to extract comment
Claus Gittinger <cg@exept.de>
parents: 1194
diff changeset
   350
    comments := parser comments.
3297
309058293d49 Fix #comment to return a string (instead of Scanner::Comment).
Stefan Vogel <sv@exept.de>
parents: 3289
diff changeset
   351
    comments size ~~ 0 ifTrue:[
8854
538b08b287ca *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 8718
diff changeset
   352
        comment := comments first asString.
6988
c5c1ae285622 ignoreErrors / ignoreWarnings are not getters.
penk
parents: 6971
diff changeset
   353
        (comment withoutSpaces endsWith:'}') ifTrue:[
c5c1ae285622 ignoreErrors / ignoreWarnings are not getters.
penk
parents: 6971
diff changeset
   354
            "if first comment is a pragma, take next comment"
c5c1ae285622 ignoreErrors / ignoreWarnings are not getters.
penk
parents: 6971
diff changeset
   355
            comment := comments at:2 ifAbsent:nil.
c5c1ae285622 ignoreErrors / ignoreWarnings are not getters.
penk
parents: 6971
diff changeset
   356
            comment notNil ifTrue:[
c5c1ae285622 ignoreErrors / ignoreWarnings are not getters.
penk
parents: 6971
diff changeset
   357
                comment := comment string.
c5c1ae285622 ignoreErrors / ignoreWarnings are not getters.
penk
parents: 6971
diff changeset
   358
            ].
c5c1ae285622 ignoreErrors / ignoreWarnings are not getters.
penk
parents: 6971
diff changeset
   359
        ].
1254
48c2748b5197 commentary
Claus Gittinger <cg@exept.de>
parents: 1236
diff changeset
   360
    ].
3297
309058293d49 Fix #comment to return a string (instead of Scanner::Comment).
Stefan Vogel <sv@exept.de>
parents: 3289
diff changeset
   361
    ^ comment.
93
e31220cb391f *** empty log message ***
claus
parents: 88
diff changeset
   362
e31220cb391f *** empty log message ***
claus
parents: 88
diff changeset
   363
    "
1236
5c9bc68e3c71 use new scanner feature to extract comment
Claus Gittinger <cg@exept.de>
parents: 1194
diff changeset
   364
     (Method compiledMethodAt:#comment) comment  
1254
48c2748b5197 commentary
Claus Gittinger <cg@exept.de>
parents: 1236
diff changeset
   365
     (Object class compiledMethodAt:#infoPrinting:) comment  
93
e31220cb391f *** empty log message ***
claus
parents: 88
diff changeset
   366
    "
1236
5c9bc68e3c71 use new scanner feature to extract comment
Claus Gittinger <cg@exept.de>
parents: 1194
diff changeset
   367
3289
9e52625965cc care for commentType
Claus Gittinger <cg@exept.de>
parents: 3247
diff changeset
   368
    "Modified: / 17.2.1998 / 14:50:00 / cg"
3297
309058293d49 Fix #comment to return a string (instead of Scanner::Comment).
Stefan Vogel <sv@exept.de>
parents: 3289
diff changeset
   369
    "Modified: / 23.2.1998 / 10:26:08 / stefan"
39
bcf183a31bbb *** empty log message ***
claus
parents: 13
diff changeset
   370
!
bcf183a31bbb *** empty log message ***
claus
parents: 13
diff changeset
   371
9702
468675f92260 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9692
diff changeset
   372
getPackage
468675f92260 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9692
diff changeset
   373
    "return the package-ID of the method"
468675f92260 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9692
diff changeset
   374
468675f92260 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9692
diff changeset
   375
    ^ package
468675f92260 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9692
diff changeset
   376
!
468675f92260 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9692
diff changeset
   377
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
   378
getSource
3160
db5c1aa38fda comment
Claus Gittinger <cg@exept.de>
parents: 3144
diff changeset
   379
    "low-level access to the source instance-variable.
4751
174a92d4ba3f checkin from browser
Claus Gittinger <cg@exept.de>
parents: 4669
diff changeset
   380
     For internal (compiler) use only.
3160
db5c1aa38fda comment
Claus Gittinger <cg@exept.de>
parents: 3144
diff changeset
   381
     This is NOT always the methods source string"
db5c1aa38fda comment
Claus Gittinger <cg@exept.de>
parents: 3144
diff changeset
   382
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
   383
    ^ source
414
claus
parents: 400
diff changeset
   384
!
claus
parents: 400
diff changeset
   385
4751
174a92d4ba3f checkin from browser
Claus Gittinger <cg@exept.de>
parents: 4669
diff changeset
   386
getSourcePosition
174a92d4ba3f checkin from browser
Claus Gittinger <cg@exept.de>
parents: 4669
diff changeset
   387
    "low-level access to the sourcePosition instance-variable.
174a92d4ba3f checkin from browser
Claus Gittinger <cg@exept.de>
parents: 4669
diff changeset
   388
     For internal (compiler) use only.
174a92d4ba3f checkin from browser
Claus Gittinger <cg@exept.de>
parents: 4669
diff changeset
   389
     This is NOT always the methods sourcePosition"
174a92d4ba3f checkin from browser
Claus Gittinger <cg@exept.de>
parents: 4669
diff changeset
   390
174a92d4ba3f checkin from browser
Claus Gittinger <cg@exept.de>
parents: 4669
diff changeset
   391
    ^ sourcePosition
174a92d4ba3f checkin from browser
Claus Gittinger <cg@exept.de>
parents: 4669
diff changeset
   392
!
174a92d4ba3f checkin from browser
Claus Gittinger <cg@exept.de>
parents: 4669
diff changeset
   393
2176
1a24b0cef25a when compressing sources, make certain to avoid later
Claus Gittinger <cg@exept.de>
parents: 2171
diff changeset
   394
localSourceFilename:aFileName position:aNumber
1a24b0cef25a when compressing sources, make certain to avoid later
Claus Gittinger <cg@exept.de>
parents: 2171
diff changeset
   395
    "set the methods sourcefile/position indicating, that 
1a24b0cef25a when compressing sources, make certain to avoid later
Claus Gittinger <cg@exept.de>
parents: 2171
diff changeset
   396
     this is a local file."
1a24b0cef25a when compressing sources, make certain to avoid later
Claus Gittinger <cg@exept.de>
parents: 2171
diff changeset
   397
1a24b0cef25a when compressing sources, make certain to avoid later
Claus Gittinger <cg@exept.de>
parents: 2171
diff changeset
   398
    source := aFileName.
1a24b0cef25a when compressing sources, make certain to avoid later
Claus Gittinger <cg@exept.de>
parents: 2171
diff changeset
   399
    sourcePosition := aNumber negated
1a24b0cef25a when compressing sources, make certain to avoid later
Claus Gittinger <cg@exept.de>
parents: 2171
diff changeset
   400
1a24b0cef25a when compressing sources, make certain to avoid later
Claus Gittinger <cg@exept.de>
parents: 2171
diff changeset
   401
    "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
   402
!
1a24b0cef25a when compressing sources, make certain to avoid later
Claus Gittinger <cg@exept.de>
parents: 2171
diff changeset
   403
5152
2aacfb3976d4 when changing the package, make certain that the source
Claus Gittinger <cg@exept.de>
parents: 5115
diff changeset
   404
makeLocalStringSource
2aacfb3976d4 when changing the package, make certain that the source
Claus Gittinger <cg@exept.de>
parents: 5115
diff changeset
   405
    "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
   406
     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
   407
     by reading the source code file).
2aacfb3976d4 when changing the package, make certain that the source
Claus Gittinger <cg@exept.de>
parents: 5115
diff changeset
   408
     This is required, when a methods package is changed, to assure that its
2aacfb3976d4 when changing the package, make certain that the source
Claus Gittinger <cg@exept.de>
parents: 5115
diff changeset
   409
     sourceCode is not lost."
2aacfb3976d4 when changing the package, make certain that the source
Claus Gittinger <cg@exept.de>
parents: 5115
diff changeset
   410
2aacfb3976d4 when changing the package, make certain that the source
Claus Gittinger <cg@exept.de>
parents: 5115
diff changeset
   411
    source notNil ifTrue:[
10207
b5ca553d15ad localSourceFirst for extensions.
Claus Gittinger <cg@exept.de>
parents: 10201
diff changeset
   412
        sourcePosition notNil ifTrue:[
b5ca553d15ad localSourceFirst for extensions.
Claus Gittinger <cg@exept.de>
parents: 10201
diff changeset
   413
            self source:(self source)
b5ca553d15ad localSourceFirst for extensions.
Claus Gittinger <cg@exept.de>
parents: 10201
diff changeset
   414
        ]
5152
2aacfb3976d4 when changing the package, make certain that the source
Claus Gittinger <cg@exept.de>
parents: 5115
diff changeset
   415
    ].
2aacfb3976d4 when changing the package, make certain that the source
Claus Gittinger <cg@exept.de>
parents: 5115
diff changeset
   416
!
2aacfb3976d4 when changing the package, make certain that the source
Claus Gittinger <cg@exept.de>
parents: 5115
diff changeset
   417
5324
5c9959ce98af make use of mclass
Claus Gittinger <cg@exept.de>
parents: 5322
diff changeset
   418
mclass:aClass
8465
2d2211d74983 Last change was apparently wrong. Fix it.
Stefan Vogel <sv@exept.de>
parents: 8462
diff changeset
   419
    "set the method's class"
2d2211d74983 Last change was apparently wrong. Fix it.
Stefan Vogel <sv@exept.de>
parents: 8462
diff changeset
   420
     
2d2211d74983 Last change was apparently wrong. Fix it.
Stefan Vogel <sv@exept.de>
parents: 8462
diff changeset
   421
    mclass == aClass ifTrue:[ ^ self ].
8462
d66f584ec04b *** empty log message ***
penk
parents: 8427
diff changeset
   422
5676
db728e9fe276 must flush cached mclass, when copying methods around
src
parents: 5665
diff changeset
   423
    (mclass notNil and:[aClass notNil]) ifTrue:[
10759
46a8d2522aa8 changed #mclass:
Claus Gittinger <cg@exept.de>
parents: 10729
diff changeset
   424
        "/ 'Method [warning]: mclass already set' errorPrintCR.
5324
5c9959ce98af make use of mclass
Claus Gittinger <cg@exept.de>
parents: 5322
diff changeset
   425
    ].
5696
958a0643496d compatibility
Claus Gittinger <cg@exept.de>
parents: 5676
diff changeset
   426
    mclass := aClass.
10207
b5ca553d15ad localSourceFirst for extensions.
Claus Gittinger <cg@exept.de>
parents: 10201
diff changeset
   427
b5ca553d15ad localSourceFirst for extensions.
Claus Gittinger <cg@exept.de>
parents: 10201
diff changeset
   428
    "Modified: / 28-11-2006 / 12:12:27 / cg"
5696
958a0643496d compatibility
Claus Gittinger <cg@exept.de>
parents: 5676
diff changeset
   429
!
5324
5c9959ce98af make use of mclass
Claus Gittinger <cg@exept.de>
parents: 5322
diff changeset
   430
1093
1e742016eea0 category rename / added access to RESOURCE and CALLED flags
Claus Gittinger <cg@exept.de>
parents: 1087
diff changeset
   431
package
9702
468675f92260 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9692
diff changeset
   432
    "return the package-ID 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
   433
5385
7637332d7b38 care for nil package
Claus Gittinger <cg@exept.de>
parents: 5339
diff changeset
   434
    |cls|
7637332d7b38 care for nil package
Claus Gittinger <cg@exept.de>
parents: 5339
diff changeset
   435
7637332d7b38 care for nil package
Claus Gittinger <cg@exept.de>
parents: 5339
diff changeset
   436
    package notNil ifTrue:[ ^ package ].
7637332d7b38 care for nil package
Claus Gittinger <cg@exept.de>
parents: 5339
diff changeset
   437
    (cls := self mclass) isNil ifTrue:[
9692
d53de4f90660 allow for and hide nil-packageID (== NoProject)
Claus Gittinger <cg@exept.de>
parents: 9661
diff changeset
   438
        ^ Project noProjectID.
5385
7637332d7b38 care for nil package
Claus Gittinger <cg@exept.de>
parents: 5339
diff changeset
   439
    ].
5724
96c2a5cf4217 category: and package: now send change notifications.
Claus Gittinger <cg@exept.de>
parents: 5721
diff changeset
   440
    "/ set it.
9692
d53de4f90660 allow for and hide nil-packageID (== NoProject)
Claus Gittinger <cg@exept.de>
parents: 9661
diff changeset
   441
    package := cls getPackage.
d53de4f90660 allow for and hide nil-packageID (== NoProject)
Claus Gittinger <cg@exept.de>
parents: 9661
diff changeset
   442
    package isNil ifTrue:[
d53de4f90660 allow for and hide nil-packageID (== NoProject)
Claus Gittinger <cg@exept.de>
parents: 9661
diff changeset
   443
        ^ Project noProjectID.
d53de4f90660 allow for and hide nil-packageID (== NoProject)
Claus Gittinger <cg@exept.de>
parents: 9661
diff changeset
   444
    ].
d53de4f90660 allow for and hide nil-packageID (== NoProject)
Claus Gittinger <cg@exept.de>
parents: 9661
diff changeset
   445
    ^ package
3950
f9c4485a91d1 avoid nil package return
Claus Gittinger <cg@exept.de>
parents: 3934
diff changeset
   446
10207
b5ca553d15ad localSourceFirst for extensions.
Claus Gittinger <cg@exept.de>
parents: 10201
diff changeset
   447
    "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
   448
!
1e742016eea0 category rename / added access to RESOURCE and CALLED flags
Claus Gittinger <cg@exept.de>
parents: 1087
diff changeset
   449
1e742016eea0 category rename / added access to RESOURCE and CALLED flags
Claus Gittinger <cg@exept.de>
parents: 1087
diff changeset
   450
package:aSymbol
1e742016eea0 category rename / added access to RESOURCE and CALLED flags
Claus Gittinger <cg@exept.de>
parents: 1087
diff changeset
   451
    "set the package-symbol"
1e742016eea0 category rename / added access to RESOURCE and CALLED flags
Claus Gittinger <cg@exept.de>
parents: 1087
diff changeset
   452
9692
d53de4f90660 allow for and hide nil-packageID (== NoProject)
Claus Gittinger <cg@exept.de>
parents: 9661
diff changeset
   453
    |cls oldPackage newPackage|
d53de4f90660 allow for and hide nil-packageID (== NoProject)
Claus Gittinger <cg@exept.de>
parents: 9661
diff changeset
   454
d53de4f90660 allow for and hide nil-packageID (== NoProject)
Claus Gittinger <cg@exept.de>
parents: 9661
diff changeset
   455
    aSymbol == Project noProjectID ifTrue:[
d53de4f90660 allow for and hide nil-packageID (== NoProject)
Claus Gittinger <cg@exept.de>
parents: 9661
diff changeset
   456
        newPackage := nil
d53de4f90660 allow for and hide nil-packageID (== NoProject)
Claus Gittinger <cg@exept.de>
parents: 9661
diff changeset
   457
    ] ifFalse:[
d53de4f90660 allow for and hide nil-packageID (== NoProject)
Claus Gittinger <cg@exept.de>
parents: 9661
diff changeset
   458
        newPackage := aSymbol
d53de4f90660 allow for and hide nil-packageID (== NoProject)
Claus Gittinger <cg@exept.de>
parents: 9661
diff changeset
   459
    ].
d53de4f90660 allow for and hide nil-packageID (== NoProject)
Claus Gittinger <cg@exept.de>
parents: 9661
diff changeset
   460
9713
fc8ef192492f *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9702
diff changeset
   461
    package ~~ newPackage ifTrue:[
5724
96c2a5cf4217 category: and package: now send change notifications.
Claus Gittinger <cg@exept.de>
parents: 5721
diff changeset
   462
        oldPackage := package.
9692
d53de4f90660 allow for and hide nil-packageID (== NoProject)
Claus Gittinger <cg@exept.de>
parents: 9661
diff changeset
   463
        "/ this is required, because otherwise I would no longer be able to
d53de4f90660 allow for and hide nil-packageID (== NoProject)
Claus Gittinger <cg@exept.de>
parents: 9661
diff changeset
   464
        "/ reconstruct my sourcecode (as the connection to the source-file is lost).
5724
96c2a5cf4217 category: and package: now send change notifications.
Claus Gittinger <cg@exept.de>
parents: 5721
diff changeset
   465
        self makeLocalStringSource.
9692
d53de4f90660 allow for and hide nil-packageID (== NoProject)
Claus Gittinger <cg@exept.de>
parents: 9661
diff changeset
   466
        package := newPackage.
5724
96c2a5cf4217 category: and package: now send change notifications.
Claus Gittinger <cg@exept.de>
parents: 5721
diff changeset
   467
96c2a5cf4217 category: and package: now send change notifications.
Claus Gittinger <cg@exept.de>
parents: 5721
diff changeset
   468
        cls := self mclass.
96c2a5cf4217 category: and package: now send change notifications.
Claus Gittinger <cg@exept.de>
parents: 5721
diff changeset
   469
96c2a5cf4217 category: and package: now send change notifications.
Claus Gittinger <cg@exept.de>
parents: 5721
diff changeset
   470
        self changed:#package.                                              "/ will vanish
96c2a5cf4217 category: and package: now send change notifications.
Claus Gittinger <cg@exept.de>
parents: 5721
diff changeset
   471
        cls changed:#methodPackage with:self selector.                      "/ will vanish
96c2a5cf4217 category: and package: now send change notifications.
Claus Gittinger <cg@exept.de>
parents: 5721
diff changeset
   472
96c2a5cf4217 category: and package: now send change notifications.
Claus Gittinger <cg@exept.de>
parents: 5721
diff changeset
   473
        Smalltalk changed:#projectOrganization with:(Array with:cls with:self with:oldPackage). 
10196
f72831ddec29 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10156
diff changeset
   474
        cls addChangeRecordForMethodPackage:self package:newPackage.
5724
96c2a5cf4217 category: and package: now send change notifications.
Claus Gittinger <cg@exept.de>
parents: 5721
diff changeset
   475
    ]
10196
f72831ddec29 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10156
diff changeset
   476
f72831ddec29 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10156
diff changeset
   477
    "Modified: / 23-11-2006 / 17:01:02 / cg"
1093
1e742016eea0 category rename / added access to RESOURCE and CALLED flags
Claus Gittinger <cg@exept.de>
parents: 1087
diff changeset
   478
!
1e742016eea0 category rename / added access to RESOURCE and CALLED flags
Claus Gittinger <cg@exept.de>
parents: 1087
diff changeset
   479
5721
5f97733ff519 methods now send change-notifications when the category changes
Claus Gittinger <cg@exept.de>
parents: 5704
diff changeset
   480
setCategory:aStringOrSymbol
5f97733ff519 methods now send change-notifications when the category changes
Claus Gittinger <cg@exept.de>
parents: 5704
diff changeset
   481
    "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
   482
5f97733ff519 methods now send change-notifications when the category changes
Claus Gittinger <cg@exept.de>
parents: 5704
diff changeset
   483
    aStringOrSymbol notNil ifTrue:[
5f97733ff519 methods now send change-notifications when the category changes
Claus Gittinger <cg@exept.de>
parents: 5704
diff changeset
   484
        category := aStringOrSymbol asSymbol
5f97733ff519 methods now send change-notifications when the category changes
Claus Gittinger <cg@exept.de>
parents: 5704
diff changeset
   485
    ]
5f97733ff519 methods now send change-notifications when the category changes
Claus Gittinger <cg@exept.de>
parents: 5704
diff changeset
   486
5f97733ff519 methods now send change-notifications when the category changes
Claus Gittinger <cg@exept.de>
parents: 5704
diff changeset
   487
    "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
   488
!
5f97733ff519 methods now send change-notifications when the category changes
Claus Gittinger <cg@exept.de>
parents: 5704
diff changeset
   489
5398
b15f5eca2060 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5387
diff changeset
   490
setPackage:aSymbol
9702
468675f92260 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9692
diff changeset
   491
    "set the package-symbol (low level - use package:)"
5398
b15f5eca2060 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5387
diff changeset
   492
b15f5eca2060 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5387
diff changeset
   493
    package := aSymbol
b15f5eca2060 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5387
diff changeset
   494
!
b15f5eca2060 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5387
diff changeset
   495
1093
1e742016eea0 category rename / added access to RESOURCE and CALLED flags
Claus Gittinger <cg@exept.de>
parents: 1087
diff changeset
   496
source
1e742016eea0 category rename / added access to RESOURCE and CALLED flags
Claus Gittinger <cg@exept.de>
parents: 1087
diff changeset
   497
    "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
   498
10608
82b1346f3e8d Use similar code when accessing method and class source code
Stefan Vogel <sv@exept.de>
parents: 10482
diff changeset
   499
    |aStream chunk|
1093
1e742016eea0 category rename / added access to RESOURCE and CALLED flags
Claus Gittinger <cg@exept.de>
parents: 1087
diff changeset
   500
1e742016eea0 category rename / added access to RESOURCE and CALLED flags
Claus Gittinger <cg@exept.de>
parents: 1087
diff changeset
   501
    "
1e742016eea0 category rename / added access to RESOURCE and CALLED flags
Claus Gittinger <cg@exept.de>
parents: 1087
diff changeset
   502
     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
   503
     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
   504
     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
   505
    "
1e742016eea0 category rename / added access to RESOURCE and CALLED flags
Claus Gittinger <cg@exept.de>
parents: 1087
diff changeset
   506
    sourcePosition isNil ifTrue:[^ source].
1e742016eea0 category rename / added access to RESOURCE and CALLED flags
Claus Gittinger <cg@exept.de>
parents: 1087
diff changeset
   507
1e742016eea0 category rename / added access to RESOURCE and CALLED flags
Claus Gittinger <cg@exept.de>
parents: 1087
diff changeset
   508
    source notNil ifTrue:[
10375
b1558b2e851d care for source access BEFORE being initialized.
ca
parents: 10207
diff changeset
   509
        self class lastMethodSourcesLock critical:[
9119
e633e55e69be avoid deadlock on recursionLock when accessing methods source
Claus Gittinger <cg@exept.de>
parents: 9096
diff changeset
   510
            LastMethodSources notNil ifTrue:[
10608
82b1346f3e8d Use similar code when accessing method and class source code
Stefan Vogel <sv@exept.de>
parents: 10482
diff changeset
   511
                chunk := LastMethodSources at:self ifAbsent:nil.
9119
e633e55e69be avoid deadlock on recursionLock when accessing methods source
Claus Gittinger <cg@exept.de>
parents: 9096
diff changeset
   512
            ].
5818
97c692085370 Cleanup unused method vars
Stefan Vogel <sv@exept.de>
parents: 5764
diff changeset
   513
        ].
10608
82b1346f3e8d Use similar code when accessing method and class source code
Stefan Vogel <sv@exept.de>
parents: 10482
diff changeset
   514
        chunk notNil ifTrue:[
82b1346f3e8d Use similar code when accessing method and class source code
Stefan Vogel <sv@exept.de>
parents: 10482
diff changeset
   515
            ^ chunk
9119
e633e55e69be avoid deadlock on recursionLock when accessing methods source
Claus Gittinger <cg@exept.de>
parents: 9096
diff changeset
   516
        ].
e633e55e69be avoid deadlock on recursionLock when accessing methods source
Claus Gittinger <cg@exept.de>
parents: 9096
diff changeset
   517
        aStream := self sourceStream.
e633e55e69be avoid deadlock on recursionLock when accessing methods source
Claus Gittinger <cg@exept.de>
parents: 9096
diff changeset
   518
        aStream notNil ifTrue:[
10673
05229646ecd7 #source - handle DecodingError when fetching the method's source
Stefan Vogel <sv@exept.de>
parents: 10608
diff changeset
   519
            [
05229646ecd7 #source - handle DecodingError when fetching the method's source
Stefan Vogel <sv@exept.de>
parents: 10608
diff changeset
   520
                chunk := self sourceChunkFromStream:aStream.
05229646ecd7 #source - handle DecodingError when fetching the method's source
Stefan Vogel <sv@exept.de>
parents: 10608
diff changeset
   521
            ] on:DecodingError do:[:ex|
05229646ecd7 #source - handle DecodingError when fetching the method's source
Stefan Vogel <sv@exept.de>
parents: 10608
diff changeset
   522
                "CharacterEncoder>>#guessEncoding is not fail safe - retry with plain unecoded data"
05229646ecd7 #source - handle DecodingError when fetching the method's source
Stefan Vogel <sv@exept.de>
parents: 10608
diff changeset
   523
05229646ecd7 #source - handle DecodingError when fetching the method's source
Stefan Vogel <sv@exept.de>
parents: 10608
diff changeset
   524
                ('DecodingError ignored when reading <1p> (<2p>)' expandMacrosWith:self whoString with:ex description) infoPrintCR.
05229646ecd7 #source - handle DecodingError when fetching the method's source
Stefan Vogel <sv@exept.de>
parents: 10608
diff changeset
   525
                aStream := self rawSourceStream.
05229646ecd7 #source - handle DecodingError when fetching the method's source
Stefan Vogel <sv@exept.de>
parents: 10608
diff changeset
   526
                ex restart.
05229646ecd7 #source - handle DecodingError when fetching the method's source
Stefan Vogel <sv@exept.de>
parents: 10608
diff changeset
   527
            ].
7601
57c257f1150a Fix race when accessing source
Stefan Vogel <sv@exept.de>
parents: 7457
diff changeset
   528
        ].
1093
1e742016eea0 category rename / added access to RESOURCE and CALLED flags
Claus Gittinger <cg@exept.de>
parents: 1087
diff changeset
   529
    ].
2979
6bb06c5e49d8 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2868
diff changeset
   530
10673
05229646ecd7 #source - handle DecodingError when fetching the method's source
Stefan Vogel <sv@exept.de>
parents: 10608
diff changeset
   531
    "Cache the source of recently used methods"
05229646ecd7 #source - handle DecodingError when fetching the method's source
Stefan Vogel <sv@exept.de>
parents: 10608
diff changeset
   532
    
10608
82b1346f3e8d Use similar code when accessing method and class source code
Stefan Vogel <sv@exept.de>
parents: 10482
diff changeset
   533
    chunk notNil ifTrue:[
9119
e633e55e69be avoid deadlock on recursionLock when accessing methods source
Claus Gittinger <cg@exept.de>
parents: 9096
diff changeset
   534
        CacheDictionary notNil ifTrue:[
10375
b1558b2e851d care for source access BEFORE being initialized.
ca
parents: 10207
diff changeset
   535
            self class lastMethodSourcesLock critical:[
9119
e633e55e69be avoid deadlock on recursionLock when accessing methods source
Claus Gittinger <cg@exept.de>
parents: 9096
diff changeset
   536
                LastMethodSources isNil ifTrue:[
e633e55e69be avoid deadlock on recursionLock when accessing methods source
Claus Gittinger <cg@exept.de>
parents: 9096
diff changeset
   537
                    LastMethodSources := CacheDictionary new:50.
e633e55e69be avoid deadlock on recursionLock when accessing methods source
Claus Gittinger <cg@exept.de>
parents: 9096
diff changeset
   538
                ].
10608
82b1346f3e8d Use similar code when accessing method and class source code
Stefan Vogel <sv@exept.de>
parents: 10482
diff changeset
   539
                LastMethodSources at:self put:chunk.
9119
e633e55e69be avoid deadlock on recursionLock when accessing methods source
Claus Gittinger <cg@exept.de>
parents: 9096
diff changeset
   540
            ]
e633e55e69be avoid deadlock on recursionLock when accessing methods source
Claus Gittinger <cg@exept.de>
parents: 9096
diff changeset
   541
        ]
2979
6bb06c5e49d8 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2868
diff changeset
   542
    ].
6bb06c5e49d8 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2868
diff changeset
   543
10608
82b1346f3e8d Use similar code when accessing method and class source code
Stefan Vogel <sv@exept.de>
parents: 10482
diff changeset
   544
    ^ chunk
1093
1e742016eea0 category rename / added access to RESOURCE and CALLED flags
Claus Gittinger <cg@exept.de>
parents: 1087
diff changeset
   545
10201
f90568a94903 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10196
diff changeset
   546
    "Modified: / 07-01-1997 / 16:20:09 / stefan"
10207
b5ca553d15ad localSourceFirst for extensions.
Claus Gittinger <cg@exept.de>
parents: 10201
diff changeset
   547
    "Modified: / 28-11-2006 / 11:49:25 / cg"
1093
1e742016eea0 category rename / added access to RESOURCE and CALLED flags
Claus Gittinger <cg@exept.de>
parents: 1087
diff changeset
   548
!
1e742016eea0 category rename / added access to RESOURCE and CALLED flags
Claus Gittinger <cg@exept.de>
parents: 1087
diff changeset
   549
1e742016eea0 category rename / added access to RESOURCE and CALLED flags
Claus Gittinger <cg@exept.de>
parents: 1087
diff changeset
   550
source:aString
1e742016eea0 category rename / added access to RESOURCE and CALLED flags
Claus Gittinger <cg@exept.de>
parents: 1087
diff changeset
   551
    "set the methods sourcestring"
1e742016eea0 category rename / added access to RESOURCE and CALLED flags
Claus Gittinger <cg@exept.de>
parents: 1087
diff changeset
   552
1e742016eea0 category rename / added access to RESOURCE and CALLED flags
Claus Gittinger <cg@exept.de>
parents: 1087
diff changeset
   553
    source := aString.
1e742016eea0 category rename / added access to RESOURCE and CALLED flags
Claus Gittinger <cg@exept.de>
parents: 1087
diff changeset
   554
    sourcePosition := nil
1e742016eea0 category rename / added access to RESOURCE and CALLED flags
Claus Gittinger <cg@exept.de>
parents: 1087
diff changeset
   555
!
1e742016eea0 category rename / added access to RESOURCE and CALLED flags
Claus Gittinger <cg@exept.de>
parents: 1087
diff changeset
   556
1e742016eea0 category rename / added access to RESOURCE and CALLED flags
Claus Gittinger <cg@exept.de>
parents: 1087
diff changeset
   557
sourceFilename
1e742016eea0 category rename / added access to RESOURCE and CALLED flags
Claus Gittinger <cg@exept.de>
parents: 1087
diff changeset
   558
    "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
   559
1e742016eea0 category rename / added access to RESOURCE and CALLED flags
Claus Gittinger <cg@exept.de>
parents: 1087
diff changeset
   560
    sourcePosition notNil ifTrue:[^ source].
1e742016eea0 category rename / added access to RESOURCE and CALLED flags
Claus Gittinger <cg@exept.de>
parents: 1087
diff changeset
   561
    ^ nil
1e742016eea0 category rename / added access to RESOURCE and CALLED flags
Claus Gittinger <cg@exept.de>
parents: 1087
diff changeset
   562
!
1e742016eea0 category rename / added access to RESOURCE and CALLED flags
Claus Gittinger <cg@exept.de>
parents: 1087
diff changeset
   563
1e742016eea0 category rename / added access to RESOURCE and CALLED flags
Claus Gittinger <cg@exept.de>
parents: 1087
diff changeset
   564
sourceFilename:aFileName position:aNumber
1e742016eea0 category rename / added access to RESOURCE and CALLED flags
Claus Gittinger <cg@exept.de>
parents: 1087
diff changeset
   565
    "set the methods sourcefile/position"
1e742016eea0 category rename / added access to RESOURCE and CALLED flags
Claus Gittinger <cg@exept.de>
parents: 1087
diff changeset
   566
1e742016eea0 category rename / added access to RESOURCE and CALLED flags
Claus Gittinger <cg@exept.de>
parents: 1087
diff changeset
   567
    source := aFileName.
1e742016eea0 category rename / added access to RESOURCE and CALLED flags
Claus Gittinger <cg@exept.de>
parents: 1087
diff changeset
   568
    sourcePosition := aNumber
1e742016eea0 category rename / added access to RESOURCE and CALLED flags
Claus Gittinger <cg@exept.de>
parents: 1087
diff changeset
   569
!
1e742016eea0 category rename / added access to RESOURCE and CALLED flags
Claus Gittinger <cg@exept.de>
parents: 1087
diff changeset
   570
2812
660a3a2a0ef3 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 2805
diff changeset
   571
sourceLineNumber
660a3a2a0ef3 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 2805
diff changeset
   572
    "return the lineNumber of my source within the returned
660a3a2a0ef3 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 2805
diff changeset
   573
     source sourcestring.
660a3a2a0ef3 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 2805
diff changeset
   574
     For ST methods, the returned sourceString is always the
660a3a2a0ef3 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 2805
diff changeset
   575
     methods pure source; therefore, the lineNumber is always 1."
660a3a2a0ef3 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 2805
diff changeset
   576
660a3a2a0ef3 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 2805
diff changeset
   577
    ^ 1
660a3a2a0ef3 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 2805
diff changeset
   578
660a3a2a0ef3 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 2805
diff changeset
   579
    "Created: 30.7.1997 / 15:42:01 / cg"
660a3a2a0ef3 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 2805
diff changeset
   580
!
660a3a2a0ef3 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 2805
diff changeset
   581
1093
1e742016eea0 category rename / added access to RESOURCE and CALLED flags
Claus Gittinger <cg@exept.de>
parents: 1087
diff changeset
   582
sourcePosition
1e742016eea0 category rename / added access to RESOURCE and CALLED flags
Claus Gittinger <cg@exept.de>
parents: 1087
diff changeset
   583
    "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
   584
2176
1a24b0cef25a when compressing sources, make certain to avoid later
Claus Gittinger <cg@exept.de>
parents: 2171
diff changeset
   585
    sourcePosition isNil ifTrue:[^ sourcePosition].
1a24b0cef25a when compressing sources, make certain to avoid later
Claus Gittinger <cg@exept.de>
parents: 2171
diff changeset
   586
    ^ sourcePosition abs
1a24b0cef25a when compressing sources, make certain to avoid later
Claus Gittinger <cg@exept.de>
parents: 2171
diff changeset
   587
1a24b0cef25a when compressing sources, make certain to avoid later
Claus Gittinger <cg@exept.de>
parents: 2171
diff changeset
   588
    "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
   589
! !
1e742016eea0 category rename / added access to RESOURCE and CALLED flags
Claus Gittinger <cg@exept.de>
parents: 1087
diff changeset
   590
1e742016eea0 category rename / added access to RESOURCE and CALLED flags
Claus Gittinger <cg@exept.de>
parents: 1087
diff changeset
   591
!Method methodsFor:'accessing-visibility'!
1e742016eea0 category rename / added access to RESOURCE and CALLED flags
Claus Gittinger <cg@exept.de>
parents: 1087
diff changeset
   592
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
   593
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
   594
    "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
   595
     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
   596
     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
   597
     it in its message lookup.
747
ea3b6f7fd7ce added ignoredMethods
Claus Gittinger <cg@exept.de>
parents: 737
diff changeset
   598
     (i.e. setting a method to #ignored, and sending that selector,
ea3b6f7fd7ce added ignoredMethods
Claus Gittinger <cg@exept.de>
parents: 737
diff changeset
   599
      leads to either the superclasses implementation to be called, 
ea3b6f7fd7ce added ignoredMethods
Claus Gittinger <cg@exept.de>
parents: 737
diff changeset
   600
      or a doesNotUnderstand exception to be raised)
ea3b6f7fd7ce added ignoredMethods
Claus Gittinger <cg@exept.de>
parents: 737
diff changeset
   601
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
   602
     Notice: this is a nonstandard feature, not supported
747
ea3b6f7fd7ce added ignoredMethods
Claus Gittinger <cg@exept.de>
parents: 737
diff changeset
   603
     by other smalltalk implementations and not specified in the ANSI spec.
ea3b6f7fd7ce added ignoredMethods
Claus Gittinger <cg@exept.de>
parents: 737
diff changeset
   604
ea3b6f7fd7ce added ignoredMethods
Claus Gittinger <cg@exept.de>
parents: 737
diff changeset
   605
     This is EXPERIMENTAL - and being evaluated for usability.
ea3b6f7fd7ce added ignoredMethods
Claus Gittinger <cg@exept.de>
parents: 737
diff changeset
   606
     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
   607
3216
e0f3f49118ed Simplify privacy stuff to make redirection from WrappedMethod easier.
Stefan Vogel <sv@exept.de>
parents: 3168
diff changeset
   608
    ^ self privacy == #ignored
e0f3f49118ed Simplify privacy stuff to make redirection from WrappedMethod easier.
Stefan Vogel <sv@exept.de>
parents: 3168
diff changeset
   609
e0f3f49118ed Simplify privacy stuff to make redirection from WrappedMethod easier.
Stefan Vogel <sv@exept.de>
parents: 3168
diff changeset
   610
    "Modified: / 23.1.1998 / 15:23:02 / stefan"
176
48061f8659aa more queries
claus
parents: 159
diff changeset
   611
!
48061f8659aa more queries
claus
parents: 159
diff changeset
   612
48061f8659aa more queries
claus
parents: 159
diff changeset
   613
isPrivate
48061f8659aa more queries
claus
parents: 159
diff changeset
   614
    "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
   615
     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
   616
     from superclasses or the class itself.
176
48061f8659aa more queries
claus
parents: 159
diff changeset
   617
     If a private method is called by some other class, a runtime
48061f8659aa more queries
claus
parents: 159
diff changeset
   618
     error (PrivateMethodSignal) is raised.
48061f8659aa more queries
claus
parents: 159
diff changeset
   619
     Notice: method privacy is a nonstandard feature, not supported
48061f8659aa more queries
claus
parents: 159
diff changeset
   620
     by other smalltalk implementations and not specified in the ANSI spec.
747
ea3b6f7fd7ce added ignoredMethods
Claus Gittinger <cg@exept.de>
parents: 737
diff changeset
   621
176
48061f8659aa more queries
claus
parents: 159
diff changeset
   622
     This is EXPERIMENTAL - and being evaluated for usability.
48061f8659aa more queries
claus
parents: 159
diff changeset
   623
     It may change or even vanish (if it shows to be not useful)."
48061f8659aa more queries
claus
parents: 159
diff changeset
   624
3216
e0f3f49118ed Simplify privacy stuff to make redirection from WrappedMethod easier.
Stefan Vogel <sv@exept.de>
parents: 3168
diff changeset
   625
    ^ self privacy == #private
e0f3f49118ed Simplify privacy stuff to make redirection from WrappedMethod easier.
Stefan Vogel <sv@exept.de>
parents: 3168
diff changeset
   626
e0f3f49118ed Simplify privacy stuff to make redirection from WrappedMethod easier.
Stefan Vogel <sv@exept.de>
parents: 3168
diff changeset
   627
    "Modified: / 23.1.1998 / 15:23:13 / stefan"
68
59faa75185ba *** empty log message ***
claus
parents: 56
diff changeset
   628
!
59faa75185ba *** empty log message ***
claus
parents: 56
diff changeset
   629
176
48061f8659aa more queries
claus
parents: 159
diff changeset
   630
isProtected
48061f8659aa more queries
claus
parents: 159
diff changeset
   631
    "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
   632
     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
   633
     from superclasses, the class itself or subclasse.
176
48061f8659aa more queries
claus
parents: 159
diff changeset
   634
     If a protected method is called by some other class, a runtime
48061f8659aa more queries
claus
parents: 159
diff changeset
   635
     error (PrivateMethodSignal) is raised.
747
ea3b6f7fd7ce added ignoredMethods
Claus Gittinger <cg@exept.de>
parents: 737
diff changeset
   636
176
48061f8659aa more queries
claus
parents: 159
diff changeset
   637
     Notice: method privacy is a nonstandard feature, not supported
48061f8659aa more queries
claus
parents: 159
diff changeset
   638
     by other smalltalk implementations and not specified in the ANSI spec.
747
ea3b6f7fd7ce added ignoredMethods
Claus Gittinger <cg@exept.de>
parents: 737
diff changeset
   639
176
48061f8659aa more queries
claus
parents: 159
diff changeset
   640
     This is EXPERIMENTAL - and being evaluated for usability.
48061f8659aa more queries
claus
parents: 159
diff changeset
   641
     It may change or even vanish (if it shows to be not useful)."
48061f8659aa more queries
claus
parents: 159
diff changeset
   642
3216
e0f3f49118ed Simplify privacy stuff to make redirection from WrappedMethod easier.
Stefan Vogel <sv@exept.de>
parents: 3168
diff changeset
   643
    ^ self privacy == #protected
e0f3f49118ed Simplify privacy stuff to make redirection from WrappedMethod easier.
Stefan Vogel <sv@exept.de>
parents: 3168
diff changeset
   644
e0f3f49118ed Simplify privacy stuff to make redirection from WrappedMethod easier.
Stefan Vogel <sv@exept.de>
parents: 3168
diff changeset
   645
    "Modified: / 23.1.1998 / 15:23:27 / stefan"
176
48061f8659aa more queries
claus
parents: 159
diff changeset
   646
!
48061f8659aa more queries
claus
parents: 159
diff changeset
   647
48061f8659aa more queries
claus
parents: 159
diff changeset
   648
isPublic
48061f8659aa more queries
claus
parents: 159
diff changeset
   649
    "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
   650
     This is the default and how other smalltalk implementations treat all methods.
ea3b6f7fd7ce added ignoredMethods
Claus Gittinger <cg@exept.de>
parents: 737
diff changeset
   651
360
claus
parents: 350
diff changeset
   652
     Notice: method privacy is a nonstandard feature, not supported
claus
parents: 350
diff changeset
   653
     by other smalltalk implementations and not specified in the ANSI spec.
747
ea3b6f7fd7ce added ignoredMethods
Claus Gittinger <cg@exept.de>
parents: 737
diff changeset
   654
360
claus
parents: 350
diff changeset
   655
     This is EXPERIMENTAL - and being evaluated for usability.
claus
parents: 350
diff changeset
   656
     It may change or even vanish (if it shows to be not useful)."
176
48061f8659aa more queries
claus
parents: 159
diff changeset
   657
3216
e0f3f49118ed Simplify privacy stuff to make redirection from WrappedMethod easier.
Stefan Vogel <sv@exept.de>
parents: 3168
diff changeset
   658
    ^ self privacy == #public
e0f3f49118ed Simplify privacy stuff to make redirection from WrappedMethod easier.
Stefan Vogel <sv@exept.de>
parents: 3168
diff changeset
   659
e0f3f49118ed Simplify privacy stuff to make redirection from WrappedMethod easier.
Stefan Vogel <sv@exept.de>
parents: 3168
diff changeset
   660
    "Modified: / 23.1.1998 / 15:23:40 / stefan"
176
48061f8659aa more queries
claus
parents: 159
diff changeset
   661
!
48061f8659aa more queries
claus
parents: 159
diff changeset
   662
747
ea3b6f7fd7ce added ignoredMethods
Claus Gittinger <cg@exept.de>
parents: 737
diff changeset
   663
isRestricted
ea3b6f7fd7ce added ignoredMethods
Claus Gittinger <cg@exept.de>
parents: 737
diff changeset
   664
    "return the flag bit stating that this method is restricted.
ea3b6f7fd7ce added ignoredMethods
Claus Gittinger <cg@exept.de>
parents: 737
diff changeset
   665
     Execution of the receiver will only be allowed if the system is not in
ea3b6f7fd7ce added ignoredMethods
Claus Gittinger <cg@exept.de>
parents: 737
diff changeset
   666
     'trap restricted mode' (-->ObjectMemory) otherise a runtime 
ea3b6f7fd7ce added ignoredMethods
Claus Gittinger <cg@exept.de>
parents: 737
diff changeset
   667
     error (PrivateMethodSignal) is raised.
ea3b6f7fd7ce added ignoredMethods
Claus Gittinger <cg@exept.de>
parents: 737
diff changeset
   668
ea3b6f7fd7ce added ignoredMethods
Claus Gittinger <cg@exept.de>
parents: 737
diff changeset
   669
     Notice: method restriction is a nonstandard feature, not supported
ea3b6f7fd7ce added ignoredMethods
Claus Gittinger <cg@exept.de>
parents: 737
diff changeset
   670
     by other smalltalk implementations and not specified in the ANSI spec.
ea3b6f7fd7ce added ignoredMethods
Claus Gittinger <cg@exept.de>
parents: 737
diff changeset
   671
ea3b6f7fd7ce added ignoredMethods
Claus Gittinger <cg@exept.de>
parents: 737
diff changeset
   672
     This is EXPERIMENTAL - and being evaluated for usability.
ea3b6f7fd7ce added ignoredMethods
Claus Gittinger <cg@exept.de>
parents: 737
diff changeset
   673
     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
   674
ea3b6f7fd7ce added ignoredMethods
Claus Gittinger <cg@exept.de>
parents: 737
diff changeset
   675
%{  /* NOCONTEXT */
ea3b6f7fd7ce added ignoredMethods
Claus Gittinger <cg@exept.de>
parents: 737
diff changeset
   676
#ifdef F_RESTRICTED
2868
772c890f907c alpha64
Claus Gittinger <cg@exept.de>
parents: 2826
diff changeset
   677
    INT f = __intVal(__INST(flags));
747
ea3b6f7fd7ce added ignoredMethods
Claus Gittinger <cg@exept.de>
parents: 737
diff changeset
   678
ea3b6f7fd7ce added ignoredMethods
Claus Gittinger <cg@exept.de>
parents: 737
diff changeset
   679
    if (f & F_RESTRICTED) {
10207
b5ca553d15ad localSourceFirst for extensions.
Claus Gittinger <cg@exept.de>
parents: 10201
diff changeset
   680
        RETURN (true);
747
ea3b6f7fd7ce added ignoredMethods
Claus Gittinger <cg@exept.de>
parents: 737
diff changeset
   681
    }
ea3b6f7fd7ce added ignoredMethods
Claus Gittinger <cg@exept.de>
parents: 737
diff changeset
   682
#endif
ea3b6f7fd7ce added ignoredMethods
Claus Gittinger <cg@exept.de>
parents: 737
diff changeset
   683
%}.
ea3b6f7fd7ce added ignoredMethods
Claus Gittinger <cg@exept.de>
parents: 737
diff changeset
   684
    ^ false
8526
326e7dcb212a *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 8518
diff changeset
   685
! !
326e7dcb212a *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 8518
diff changeset
   686
326e7dcb212a *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 8518
diff changeset
   687
!Method privateMethodsFor:'accessing-visibility'!
326e7dcb212a *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 8518
diff changeset
   688
326e7dcb212a *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 8518
diff changeset
   689
primSetPrivacy:aSymbol
326e7dcb212a *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 8518
diff changeset
   690
    "set the methods access rights (privacy) from a symbol;
326e7dcb212a *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 8518
diff changeset
   691
     Currently, this must be one of #private, #protected, #public or #ignored.
326e7dcb212a *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 8518
diff changeset
   692
     #setPrivacy: simply sets the attribute. When changing methods, that 
326e7dcb212a *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 8518
diff changeset
   693
     have already been called, #privacy: should be used.
326e7dcb212a *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 8518
diff changeset
   694
326e7dcb212a *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 8518
diff changeset
   695
     Notice: method privacy is a nonstandard feature, not supported
326e7dcb212a *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 8518
diff changeset
   696
     by other smalltalk implementations and not specified in the ANSI spec.
326e7dcb212a *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 8518
diff changeset
   697
     If at all, use it for debugging purposes, to catch messagesends
326e7dcb212a *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 8518
diff changeset
   698
     which are not supposed to be sent by others.
326e7dcb212a *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 8518
diff changeset
   699
     (especially, if working in a team, while integrating other peoples work)
326e7dcb212a *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 8518
diff changeset
   700
326e7dcb212a *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 8518
diff changeset
   701
     This is EXPERIMENTAL - and being evaluated for usability.
326e7dcb212a *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 8518
diff changeset
   702
     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
   703
326e7dcb212a *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 8518
diff changeset
   704
%{  /* NOCONTEXT */
326e7dcb212a *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 8518
diff changeset
   705
326e7dcb212a *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 8518
diff changeset
   706
#if defined(M_PRIVACY)
326e7dcb212a *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 8518
diff changeset
   707
    INT f = __intVal(__INST(flags));
326e7dcb212a *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 8518
diff changeset
   708
    INT p;
326e7dcb212a *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 8518
diff changeset
   709
326e7dcb212a *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 8518
diff changeset
   710
    if (aSymbol == @symbol(public))
326e7dcb212a *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 8518
diff changeset
   711
        p = 0;
326e7dcb212a *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 8518
diff changeset
   712
    else if (aSymbol == @symbol(protected))
326e7dcb212a *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 8518
diff changeset
   713
        p = F_PRIVATE;
326e7dcb212a *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 8518
diff changeset
   714
    else if (aSymbol == @symbol(private))
326e7dcb212a *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 8518
diff changeset
   715
        p = F_CLASSPRIVATE;
326e7dcb212a *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 8518
diff changeset
   716
    else if (aSymbol == @symbol(ignored))
326e7dcb212a *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 8518
diff changeset
   717
        p = F_IGNORED;
326e7dcb212a *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 8518
diff changeset
   718
    else
326e7dcb212a *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 8518
diff changeset
   719
        RETURN(false);  /* illegal symbol */
326e7dcb212a *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 8518
diff changeset
   720
        
326e7dcb212a *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 8518
diff changeset
   721
326e7dcb212a *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 8518
diff changeset
   722
    f = (f & ~M_PRIVACY) | p;
8913
b9498d27a554 64bit; mkSmallInteger
Claus Gittinger <cg@exept.de>
parents: 8896
diff changeset
   723
    __INST(flags) = __mkSmallInteger(f);
8526
326e7dcb212a *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 8518
diff changeset
   724
#endif
326e7dcb212a *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 8518
diff changeset
   725
326e7dcb212a *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 8518
diff changeset
   726
%}.
326e7dcb212a *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 8518
diff changeset
   727
    ^ true
326e7dcb212a *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 8518
diff changeset
   728
326e7dcb212a *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 8518
diff changeset
   729
    "Modified: 27.8.1995 / 22:58:08 / claus"
326e7dcb212a *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 8518
diff changeset
   730
! !
326e7dcb212a *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 8518
diff changeset
   731
326e7dcb212a *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 8518
diff changeset
   732
!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
   733
d600e08a5936 handle the case where a method has a sourceFileInfo, but the class has not
Claus Gittinger <cg@exept.de>
parents: 934
diff changeset
   734
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
   735
    "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
   736
     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
   737
d600e08a5936 handle the case where a method has a sourceFileInfo, but the class has not
Claus Gittinger <cg@exept.de>
parents: 934
diff changeset
   738
     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
   739
     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
   740
     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
   741
     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
   742
     (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
   743
d600e08a5936 handle the case where a method has a sourceFileInfo, but the class has not
Claus Gittinger <cg@exept.de>
parents: 934
diff changeset
   744
     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
   745
     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
   746
3216
e0f3f49118ed Simplify privacy stuff to make redirection from WrappedMethod easier.
Stefan Vogel <sv@exept.de>
parents: 3168
diff changeset
   747
%{  /* NOCONTEXT */
e0f3f49118ed Simplify privacy stuff to make redirection from WrappedMethod easier.
Stefan Vogel <sv@exept.de>
parents: 3168
diff changeset
   748
    /* 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
   749
e0f3f49118ed Simplify privacy stuff to make redirection from WrappedMethod easier.
Stefan Vogel <sv@exept.de>
parents: 3168
diff changeset
   750
#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
   751
e0f3f49118ed Simplify privacy stuff to make redirection from WrappedMethod easier.
Stefan Vogel <sv@exept.de>
parents: 3168
diff changeset
   752
    INT f = __intVal(__INST(flags));
e0f3f49118ed Simplify privacy stuff to make redirection from WrappedMethod easier.
Stefan Vogel <sv@exept.de>
parents: 3168
diff changeset
   753
    switch (f & M_PRIVACY) {
e0f3f49118ed Simplify privacy stuff to make redirection from WrappedMethod easier.
Stefan Vogel <sv@exept.de>
parents: 3168
diff changeset
   754
e0f3f49118ed Simplify privacy stuff to make redirection from WrappedMethod easier.
Stefan Vogel <sv@exept.de>
parents: 3168
diff changeset
   755
# ifdef F_PRIVATE
e0f3f49118ed Simplify privacy stuff to make redirection from WrappedMethod easier.
Stefan Vogel <sv@exept.de>
parents: 3168
diff changeset
   756
    case F_PRIVATE:
8518
7dc3f9909640 Interchanged the meaning of method privacy -
Stefan Vogel <sv@exept.de>
parents: 8465
diff changeset
   757
        RETURN (@symbol(protected));
7dc3f9909640 Interchanged the meaning of method privacy -
Stefan Vogel <sv@exept.de>
parents: 8465
diff changeset
   758
        break;
3216
e0f3f49118ed Simplify privacy stuff to make redirection from WrappedMethod easier.
Stefan Vogel <sv@exept.de>
parents: 3168
diff changeset
   759
# endif
e0f3f49118ed Simplify privacy stuff to make redirection from WrappedMethod easier.
Stefan Vogel <sv@exept.de>
parents: 3168
diff changeset
   760
# ifdef F_CLASSPRIVATE
e0f3f49118ed Simplify privacy stuff to make redirection from WrappedMethod easier.
Stefan Vogel <sv@exept.de>
parents: 3168
diff changeset
   761
    case F_CLASSPRIVATE:
8518
7dc3f9909640 Interchanged the meaning of method privacy -
Stefan Vogel <sv@exept.de>
parents: 8465
diff changeset
   762
        RETURN (@symbol(private));
7dc3f9909640 Interchanged the meaning of method privacy -
Stefan Vogel <sv@exept.de>
parents: 8465
diff changeset
   763
        break;
3216
e0f3f49118ed Simplify privacy stuff to make redirection from WrappedMethod easier.
Stefan Vogel <sv@exept.de>
parents: 3168
diff changeset
   764
# endif
e0f3f49118ed Simplify privacy stuff to make redirection from WrappedMethod easier.
Stefan Vogel <sv@exept.de>
parents: 3168
diff changeset
   765
# ifdef F_IGNORED
e0f3f49118ed Simplify privacy stuff to make redirection from WrappedMethod easier.
Stefan Vogel <sv@exept.de>
parents: 3168
diff changeset
   766
    case F_IGNORED:
8518
7dc3f9909640 Interchanged the meaning of method privacy -
Stefan Vogel <sv@exept.de>
parents: 8465
diff changeset
   767
        RETURN (@symbol(ignored));
7dc3f9909640 Interchanged the meaning of method privacy -
Stefan Vogel <sv@exept.de>
parents: 8465
diff changeset
   768
        break;
3216
e0f3f49118ed Simplify privacy stuff to make redirection from WrappedMethod easier.
Stefan Vogel <sv@exept.de>
parents: 3168
diff changeset
   769
# endif
e0f3f49118ed Simplify privacy stuff to make redirection from WrappedMethod easier.
Stefan Vogel <sv@exept.de>
parents: 3168
diff changeset
   770
    }
e0f3f49118ed Simplify privacy stuff to make redirection from WrappedMethod easier.
Stefan Vogel <sv@exept.de>
parents: 3168
diff changeset
   771
#endif
e0f3f49118ed Simplify privacy stuff to make redirection from WrappedMethod easier.
Stefan Vogel <sv@exept.de>
parents: 3168
diff changeset
   772
%}.
e0f3f49118ed Simplify privacy stuff to make redirection from WrappedMethod easier.
Stefan Vogel <sv@exept.de>
parents: 3168
diff changeset
   773
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
   774
    ^ #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
   775
!
d600e08a5936 handle the case where a method has a sourceFileInfo, but the class has not
Claus Gittinger <cg@exept.de>
parents: 934
diff changeset
   776
d600e08a5936 handle the case where a method has a sourceFileInfo, but the class has not
Claus Gittinger <cg@exept.de>
parents: 934
diff changeset
   777
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
   778
    "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
   779
     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
   780
d600e08a5936 handle the case where a method has a sourceFileInfo, but the class has not
Claus Gittinger <cg@exept.de>
parents: 934
diff changeset
   781
     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
   782
     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
   783
     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
   784
     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
   785
     (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
   786
d600e08a5936 handle the case where a method has a sourceFileInfo, but the class has not
Claus Gittinger <cg@exept.de>
parents: 934
diff changeset
   787
     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
   788
     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
   789
8526
326e7dcb212a *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 8518
diff changeset
   790
    |oldPrivacy|
326e7dcb212a *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 8518
diff changeset
   791
326e7dcb212a *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 8518
diff changeset
   792
    oldPrivacy := self privacy.
326e7dcb212a *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 8518
diff changeset
   793
326e7dcb212a *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 8518
diff changeset
   794
    (self setPrivacy:aSymbol flushCaches:true) ifTrue:[
326e7dcb212a *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 8518
diff changeset
   795
        |myClass mySelector|
326e7dcb212a *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 8518
diff changeset
   796
326e7dcb212a *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 8518
diff changeset
   797
        myClass := self mclass.
326e7dcb212a *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 8518
diff changeset
   798
        mySelector := self selector.
326e7dcb212a *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 8518
diff changeset
   799
326e7dcb212a *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 8518
diff changeset
   800
        self changed:#privacy.                                       "/ will vanish
326e7dcb212a *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 8518
diff changeset
   801
        myClass notNil ifTrue:[
326e7dcb212a *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 8518
diff changeset
   802
            mySelector notNil ifTrue:[
326e7dcb212a *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 8518
diff changeset
   803
                myClass changed:#methodPrivacy with:mySelector.      "/ will vanish
326e7dcb212a *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 8518
diff changeset
   804
                Smalltalk changed:#privacyOfMethod with:(Array with:myClass with:self with:oldPrivacy). 
10196
f72831ddec29 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10156
diff changeset
   805
                myClass addChangeRecordForMethodPrivacy:self.
8526
326e7dcb212a *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 8518
diff changeset
   806
            ]
326e7dcb212a *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 8518
diff changeset
   807
        ]
3216
e0f3f49118ed Simplify privacy stuff to make redirection from WrappedMethod easier.
Stefan Vogel <sv@exept.de>
parents: 3168
diff changeset
   808
    ]
10196
f72831ddec29 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10156
diff changeset
   809
f72831ddec29 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10156
diff changeset
   810
    "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
   811
!
747
ea3b6f7fd7ce added ignoredMethods
Claus Gittinger <cg@exept.de>
parents: 737
diff changeset
   812
532
2511c99de912 New code to trap restricted (RT) methods.
Stefan Vogel <sv@exept.de>
parents: 530
diff changeset
   813
restricted:aBoolean
2511c99de912 New code to trap restricted (RT) methods.
Stefan Vogel <sv@exept.de>
parents: 530
diff changeset
   814
    "set or clear the flag bit stating that this method is restricted. 
2511c99de912 New code to trap restricted (RT) methods.
Stefan Vogel <sv@exept.de>
parents: 530
diff changeset
   815
     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
   816
     'trap restricted mode' (-->ObjectMemory) otherise a runtime
2511c99de912 New code to trap restricted (RT) methods.
Stefan Vogel <sv@exept.de>
parents: 530
diff changeset
   817
     error (PrivateMethodSignal) is raised.
747
ea3b6f7fd7ce added ignoredMethods
Claus Gittinger <cg@exept.de>
parents: 737
diff changeset
   818
532
2511c99de912 New code to trap restricted (RT) methods.
Stefan Vogel <sv@exept.de>
parents: 530
diff changeset
   819
     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
   820
     by other smalltalk implementations and not specified in the ANSI spec.
747
ea3b6f7fd7ce added ignoredMethods
Claus Gittinger <cg@exept.de>
parents: 737
diff changeset
   821
532
2511c99de912 New code to trap restricted (RT) methods.
Stefan Vogel <sv@exept.de>
parents: 530
diff changeset
   822
     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
   823
     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
   824
2511c99de912 New code to trap restricted (RT) methods.
Stefan Vogel <sv@exept.de>
parents: 530
diff changeset
   825
%{  /* NOCONTEXT */
2511c99de912 New code to trap restricted (RT) methods.
Stefan Vogel <sv@exept.de>
parents: 530
diff changeset
   826
    /* 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
   827
2511c99de912 New code to trap restricted (RT) methods.
Stefan Vogel <sv@exept.de>
parents: 530
diff changeset
   828
#ifdef F_RESTRICTED
2868
772c890f907c alpha64
Claus Gittinger <cg@exept.de>
parents: 2826
diff changeset
   829
    INT f = __intVal(__INST(flags));
772c890f907c alpha64
Claus Gittinger <cg@exept.de>
parents: 2826
diff changeset
   830
    INT old;
532
2511c99de912 New code to trap restricted (RT) methods.
Stefan Vogel <sv@exept.de>
parents: 530
diff changeset
   831
747
ea3b6f7fd7ce added ignoredMethods
Claus Gittinger <cg@exept.de>
parents: 737
diff changeset
   832
    old = f;
532
2511c99de912 New code to trap restricted (RT) methods.
Stefan Vogel <sv@exept.de>
parents: 530
diff changeset
   833
    if (aBoolean == true) 
10207
b5ca553d15ad localSourceFirst for extensions.
Claus Gittinger <cg@exept.de>
parents: 10201
diff changeset
   834
        f |= F_RESTRICTED;
532
2511c99de912 New code to trap restricted (RT) methods.
Stefan Vogel <sv@exept.de>
parents: 530
diff changeset
   835
    else
10207
b5ca553d15ad localSourceFirst for extensions.
Claus Gittinger <cg@exept.de>
parents: 10201
diff changeset
   836
        f &= ~F_RESTRICTED;
8913
b9498d27a554 64bit; mkSmallInteger
Claus Gittinger <cg@exept.de>
parents: 8896
diff changeset
   837
    __INST(flags) = __mkSmallInteger(f);
532
2511c99de912 New code to trap restricted (RT) methods.
Stefan Vogel <sv@exept.de>
parents: 530
diff changeset
   838
    if (old & F_RESTRICTED)
10207
b5ca553d15ad localSourceFirst for extensions.
Claus Gittinger <cg@exept.de>
parents: 10201
diff changeset
   839
        RETURN(true);
532
2511c99de912 New code to trap restricted (RT) methods.
Stefan Vogel <sv@exept.de>
parents: 530
diff changeset
   840
#endif
2511c99de912 New code to trap restricted (RT) methods.
Stefan Vogel <sv@exept.de>
parents: 530
diff changeset
   841
%}.
2511c99de912 New code to trap restricted (RT) methods.
Stefan Vogel <sv@exept.de>
parents: 530
diff changeset
   842
    ^ false
2511c99de912 New code to trap restricted (RT) methods.
Stefan Vogel <sv@exept.de>
parents: 530
diff changeset
   843
747
ea3b6f7fd7ce added ignoredMethods
Claus Gittinger <cg@exept.de>
parents: 737
diff changeset
   844
    "
ea3b6f7fd7ce added ignoredMethods
Claus Gittinger <cg@exept.de>
parents: 737
diff changeset
   845
     (ObjectMemory class compiledMethodAt:#compressingGarbageCollect) restricted:true
ea3b6f7fd7ce added ignoredMethods
Claus Gittinger <cg@exept.de>
parents: 737
diff changeset
   846
    "
532
2511c99de912 New code to trap restricted (RT) methods.
Stefan Vogel <sv@exept.de>
parents: 530
diff changeset
   847
2511c99de912 New code to trap restricted (RT) methods.
Stefan Vogel <sv@exept.de>
parents: 530
diff changeset
   848
    "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
   849
!
2511c99de912 New code to trap restricted (RT) methods.
Stefan Vogel <sv@exept.de>
parents: 530
diff changeset
   850
3216
e0f3f49118ed Simplify privacy stuff to make redirection from WrappedMethod easier.
Stefan Vogel <sv@exept.de>
parents: 3168
diff changeset
   851
setPrivacy:aSymbol
e0f3f49118ed Simplify privacy stuff to make redirection from WrappedMethod easier.
Stefan Vogel <sv@exept.de>
parents: 3168
diff changeset
   852
    "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
   853
     Currently, this must be one of #private, #protected, #public or #ignored.
e0f3f49118ed Simplify privacy stuff to make redirection from WrappedMethod easier.
Stefan Vogel <sv@exept.de>
parents: 3168
diff changeset
   854
     #setPrivacy: simply sets the attribute. When changing methods, that 
e0f3f49118ed Simplify privacy stuff to make redirection from WrappedMethod easier.
Stefan Vogel <sv@exept.de>
parents: 3168
diff changeset
   855
     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
   856
d600e08a5936 handle the case where a method has a sourceFileInfo, but the class has not
Claus Gittinger <cg@exept.de>
parents: 934
diff changeset
   857
     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
   858
     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
   859
     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
   860
     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
   861
     (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
   862
d600e08a5936 handle the case where a method has a sourceFileInfo, but the class has not
Claus Gittinger <cg@exept.de>
parents: 934
diff changeset
   863
     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
   864
     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
   865
8526
326e7dcb212a *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 8518
diff changeset
   866
    ^ self setPrivacy:aSymbol flushCaches:true
326e7dcb212a *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 8518
diff changeset
   867
!
326e7dcb212a *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 8518
diff changeset
   868
326e7dcb212a *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 8518
diff changeset
   869
setPrivacy:aSymbol flushCaches:doFlush
326e7dcb212a *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 8518
diff changeset
   870
    "set the methods access rights (privacy) from a symbol;
326e7dcb212a *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 8518
diff changeset
   871
     Currently, this must be one of #private, #protected, #public or #ignored.
326e7dcb212a *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 8518
diff changeset
   872
     #setPrivacy: simply sets the attribute. When changing methods, that 
326e7dcb212a *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 8518
diff changeset
   873
     have already been called, #privacy: should be used.
326e7dcb212a *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 8518
diff changeset
   874
326e7dcb212a *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 8518
diff changeset
   875
     Notice: method privacy is a nonstandard feature, not supported
326e7dcb212a *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 8518
diff changeset
   876
     by other smalltalk implementations and not specified in the ANSI spec.
326e7dcb212a *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 8518
diff changeset
   877
     If at all, use it for debugging purposes, to catch messagesends
326e7dcb212a *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 8518
diff changeset
   878
     which are not supposed to be sent by others.
326e7dcb212a *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 8518
diff changeset
   879
     (especially, if working in a team, while integrating other peoples work)
326e7dcb212a *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 8518
diff changeset
   880
326e7dcb212a *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 8518
diff changeset
   881
     This is EXPERIMENTAL - and being evaluated for usability.
326e7dcb212a *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 8518
diff changeset
   882
     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
   883
326e7dcb212a *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 8518
diff changeset
   884
    |old sel|
326e7dcb212a *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 8518
diff changeset
   885
326e7dcb212a *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 8518
diff changeset
   886
    old := self privacy.
326e7dcb212a *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 8518
diff changeset
   887
    old == aSymbol ifTrue:[^ false].
326e7dcb212a *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 8518
diff changeset
   888
    (self primSetPrivacy:aSymbol) ifFalse:[^ false].
326e7dcb212a *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 8518
diff changeset
   889
326e7dcb212a *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 8518
diff changeset
   890
    "/
326e7dcb212a *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 8518
diff changeset
   891
    "/ no need to flush, if changing from private to public
326e7dcb212a *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 8518
diff changeset
   892
    "/
326e7dcb212a *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 8518
diff changeset
   893
    doFlush ifTrue:[
326e7dcb212a *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 8518
diff changeset
   894
        (aSymbol == #public and:[old ~~ #ignored]) ifFalse:[
326e7dcb212a *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 8518
diff changeset
   895
            (sel := self selector) notNil ifTrue:[
326e7dcb212a *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 8518
diff changeset
   896
                ObjectMemory flushCachesForSelector:sel
326e7dcb212a *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 8518
diff changeset
   897
            ] ifFalse:[
326e7dcb212a *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 8518
diff changeset
   898
                ObjectMemory flushCaches.
326e7dcb212a *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 8518
diff changeset
   899
            ].
326e7dcb212a *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 8518
diff changeset
   900
        ].
326e7dcb212a *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 8518
diff changeset
   901
    ].
3216
e0f3f49118ed Simplify privacy stuff to make redirection from WrappedMethod easier.
Stefan Vogel <sv@exept.de>
parents: 3168
diff changeset
   902
    ^ true
1
a27a279701f8 Initial revision
claus
parents:
diff changeset
   903
! !
a27a279701f8 Initial revision
claus
parents:
diff changeset
   904
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
   905
!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
   906
d600e08a5936 handle the case where a method has a sourceFileInfo, but the class has not
Claus Gittinger <cg@exept.de>
parents: 934
diff changeset
   907
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
   908
    "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
   909
     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
   910
     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
   911
     the methodDictionary of any class - just returned.
2064
68b185fbddb6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 2063
diff changeset
   912
     If the method contains primitive code, this may return a method
68b185fbddb6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 2063
diff changeset
   913
     without bytecode.
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
   914
     Can be used to obtain a bytecode version of a machine-code 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
   915
     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
   916
     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
   917
9096
84df3b129718 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9075
diff changeset
   918
    |mthd|
1
a27a279701f8 Initial revision
claus
parents:
diff changeset
   919
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
   920
    byteCode notNil ifTrue:[
6254
feae1d5d5431 Use the more elegant #ensure: instead of '#valueNowOrOnUnwindDo'
Stefan Vogel <sv@exept.de>
parents: 6234
diff changeset
   921
        "
feae1d5d5431 Use the more elegant #ensure: instead of '#valueNowOrOnUnwindDo'
Stefan Vogel <sv@exept.de>
parents: 6234
diff changeset
   922
         is already a bytecoded method
feae1d5d5431 Use the more elegant #ensure: instead of '#valueNowOrOnUnwindDo'
Stefan Vogel <sv@exept.de>
parents: 6234
diff changeset
   923
        "
feae1d5d5431 Use the more elegant #ensure: instead of '#valueNowOrOnUnwindDo'
Stefan Vogel <sv@exept.de>
parents: 6234
diff changeset
   924
        ^ 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
   925
    ].
9096
84df3b129718 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9075
diff changeset
   926
84df3b129718 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9075
diff changeset
   927
    ParserFlags
84df3b129718 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9075
diff changeset
   928
        withSTCCompilation:#never
84df3b129718 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9075
diff changeset
   929
        do:[
84df3b129718 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9075
diff changeset
   930
            mthd := self asExecutableMethod.
84df3b129718 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9075
diff changeset
   931
        ].
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
   932
    ^ mthd
68
59faa75185ba *** empty log message ***
claus
parents: 56
diff changeset
   933
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
   934
    "Created: 24.10.1995 / 14:02:32 / cg"
2064
68b185fbddb6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 2063
diff changeset
   935
    "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
   936
!
306
365e65400c93 *** empty log message ***
claus
parents: 302
diff changeset
   937
5405
f07c8045ab4e *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5398
diff changeset
   938
asByteCodeMethodWithSource:newSource
9096
84df3b129718 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9075
diff changeset
   939
    |mthd|
84df3b129718 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9075
diff changeset
   940
84df3b129718 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9075
diff changeset
   941
    ParserFlags 
84df3b129718 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9075
diff changeset
   942
        withSTCCompilation:#never
84df3b129718 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9075
diff changeset
   943
        do:[
84df3b129718 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9075
diff changeset
   944
            mthd := self asExecutableMethodWithSource:newSource.
84df3b129718 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9075
diff changeset
   945
        ].
5405
f07c8045ab4e *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5398
diff changeset
   946
    ^ mthd
f07c8045ab4e *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5398
diff changeset
   947
f07c8045ab4e *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5398
diff changeset
   948
    "Created: 24.10.1995 / 14:02:32 / cg"
f07c8045ab4e *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5398
diff changeset
   949
    "Modified: 5.1.1997 / 01:01:53 / cg"
f07c8045ab4e *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5398
diff changeset
   950
!
f07c8045ab4e *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5398
diff changeset
   951
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
   952
asExecutableMethod
d600e08a5936 handle the case where a method has a sourceFileInfo, but the class has not
Claus Gittinger <cg@exept.de>
parents: 934
diff changeset
   953
    "if the receiver has neither bytecodes nor machinecode, create & return a 
d600e08a5936 handle the case where a method has a sourceFileInfo, but the class has not
Claus Gittinger <cg@exept.de>
parents: 934
diff changeset
   954
     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
   955
     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
   956
     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
   957
     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
   958
     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
   959
     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
   960
5700
ee59aff043c4 asExecutableMethod / asExecutableMethodWith: - code reuse
Claus Gittinger <cg@exept.de>
parents: 5696
diff changeset
   961
    |temporaryMethod sourceString|
306
365e65400c93 *** empty log message ***
claus
parents: 302
diff changeset
   962
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
   963
    byteCode notNil ifTrue:[
5700
ee59aff043c4 asExecutableMethod / asExecutableMethodWith: - code reuse
Claus Gittinger <cg@exept.de>
parents: 5696
diff changeset
   964
        "
ee59aff043c4 asExecutableMethod / asExecutableMethodWith: - code reuse
Claus Gittinger <cg@exept.de>
parents: 5696
diff changeset
   965
         is already a bytecoded method
ee59aff043c4 asExecutableMethod / asExecutableMethodWith: - code reuse
Claus Gittinger <cg@exept.de>
parents: 5696
diff changeset
   966
        "
ee59aff043c4 asExecutableMethod / asExecutableMethodWith: - code reuse
Claus Gittinger <cg@exept.de>
parents: 5696
diff changeset
   967
        ^ self
ee59aff043c4 asExecutableMethod / asExecutableMethodWith: - code reuse
Claus Gittinger <cg@exept.de>
parents: 5696
diff changeset
   968
    ].
ee59aff043c4 asExecutableMethod / asExecutableMethodWith: - code reuse
Claus Gittinger <cg@exept.de>
parents: 5696
diff changeset
   969
ee59aff043c4 asExecutableMethod / asExecutableMethodWith: - code reuse
Claus Gittinger <cg@exept.de>
parents: 5696
diff changeset
   970
    sourceString := self source.
ee59aff043c4 asExecutableMethod / asExecutableMethodWith: - code reuse
Claus Gittinger <cg@exept.de>
parents: 5696
diff changeset
   971
    sourceString isNil ifTrue:[
ee59aff043c4 asExecutableMethod / asExecutableMethodWith: - code reuse
Claus Gittinger <cg@exept.de>
parents: 5696
diff changeset
   972
        'Method [warning]: cannot generate bytecode (no source for compilation)' errorPrintCR.
ee59aff043c4 asExecutableMethod / asExecutableMethodWith: - code reuse
Claus Gittinger <cg@exept.de>
parents: 5696
diff changeset
   973
        ^ 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
   974
    ].
d600e08a5936 handle the case where a method has a sourceFileInfo, but the class has not
Claus Gittinger <cg@exept.de>
parents: 934
diff changeset
   975
5700
ee59aff043c4 asExecutableMethod / asExecutableMethodWith: - code reuse
Claus Gittinger <cg@exept.de>
parents: 5696
diff changeset
   976
    temporaryMethod := self asExecutableMethodWithSource:sourceString.
ee59aff043c4 asExecutableMethod / asExecutableMethodWith: - code reuse
Claus Gittinger <cg@exept.de>
parents: 5696
diff changeset
   977
ee59aff043c4 asExecutableMethod / asExecutableMethodWith: - code reuse
Claus Gittinger <cg@exept.de>
parents: 5696
diff changeset
   978
    (temporaryMethod isNil or:[temporaryMethod == #Error]) ifTrue:[
ee59aff043c4 asExecutableMethod / asExecutableMethodWith: - code reuse
Claus Gittinger <cg@exept.de>
parents: 5696
diff changeset
   979
        'Method [warning]: cannot generate bytecode (contains primitive code or error)' errorPrintCR.
ee59aff043c4 asExecutableMethod / asExecutableMethodWith: - code reuse
Claus Gittinger <cg@exept.de>
parents: 5696
diff changeset
   980
        ^ nil.
ee59aff043c4 asExecutableMethod / asExecutableMethodWith: - code reuse
Claus Gittinger <cg@exept.de>
parents: 5696
diff changeset
   981
    ].
ee59aff043c4 asExecutableMethod / asExecutableMethodWith: - code reuse
Claus Gittinger <cg@exept.de>
parents: 5696
diff changeset
   982
    "/
ee59aff043c4 asExecutableMethod / asExecutableMethodWith: - code reuse
Claus Gittinger <cg@exept.de>
parents: 5696
diff changeset
   983
    "/ 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
   984
    "/
ee59aff043c4 asExecutableMethod / asExecutableMethodWith: - code reuse
Claus Gittinger <cg@exept.de>
parents: 5696
diff changeset
   985
    temporaryMethod sourceFilename:source position:sourcePosition. 
ee59aff043c4 asExecutableMethod / asExecutableMethodWith: - code reuse
Claus Gittinger <cg@exept.de>
parents: 5696
diff changeset
   986
    ^ temporaryMethod
ee59aff043c4 asExecutableMethod / asExecutableMethodWith: - code reuse
Claus Gittinger <cg@exept.de>
parents: 5696
diff changeset
   987
!
ee59aff043c4 asExecutableMethod / asExecutableMethodWith: - code reuse
Claus Gittinger <cg@exept.de>
parents: 5696
diff changeset
   988
ee59aff043c4 asExecutableMethod / asExecutableMethodWith: - code reuse
Claus Gittinger <cg@exept.de>
parents: 5696
diff changeset
   989
asExecutableMethodWithSource:newSource
ee59aff043c4 asExecutableMethod / asExecutableMethodWith: - code reuse
Claus Gittinger <cg@exept.de>
parents: 5696
diff changeset
   990
    |temporaryMethod cls|
ee59aff043c4 asExecutableMethod / asExecutableMethodWith: - code reuse
Claus Gittinger <cg@exept.de>
parents: 5696
diff changeset
   991
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
   992
    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
   993
    cls isNil ifTrue:[
5700
ee59aff043c4 asExecutableMethod / asExecutableMethodWith: - code reuse
Claus Gittinger <cg@exept.de>
parents: 5696
diff changeset
   994
        'Method [warning]: cannot generate bytecode (no class for compilation)' errorPrintCR.
ee59aff043c4 asExecutableMethod / asExecutableMethodWith: - code reuse
Claus Gittinger <cg@exept.de>
parents: 5696
diff changeset
   995
        ^ nil
306
365e65400c93 *** empty log message ***
claus
parents: 302
diff changeset
   996
    ].
1
a27a279701f8 Initial revision
claus
parents:
diff changeset
   997
4290
5e43473d7a35 moved recompilation semaphore from LazyMethod to Method
Claus Gittinger <cg@exept.de>
parents: 4015
diff changeset
   998
    "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
   999
     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
  1000
     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
  1001
     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
  1002
     (happened when autoloading animation demos)
176
48061f8659aa more queries
claus
parents: 159
diff changeset
  1003
    "
4290
5e43473d7a35 moved recompilation semaphore from LazyMethod to Method
Claus Gittinger <cg@exept.de>
parents: 4015
diff changeset
  1004
    CompilationLock critical:[
5700
ee59aff043c4 asExecutableMethod / asExecutableMethodWith: - code reuse
Claus Gittinger <cg@exept.de>
parents: 5696
diff changeset
  1005
        "
ee59aff043c4 asExecutableMethod / asExecutableMethodWith: - code reuse
Claus Gittinger <cg@exept.de>
parents: 5696
diff changeset
  1006
         dont want this to go into the changes file,
ee59aff043c4 asExecutableMethod / asExecutableMethodWith: - code reuse
Claus Gittinger <cg@exept.de>
parents: 5696
diff changeset
  1007
         dont want output on Transcript and definitely 
ee59aff043c4 asExecutableMethod / asExecutableMethodWith: - code reuse
Claus Gittinger <cg@exept.de>
parents: 5696
diff changeset
  1008
         dont want a lazy method ...
ee59aff043c4 asExecutableMethod / asExecutableMethodWith: - code reuse
Claus Gittinger <cg@exept.de>
parents: 5696
diff changeset
  1009
        "
ee59aff043c4 asExecutableMethod / asExecutableMethodWith: - code reuse
Claus Gittinger <cg@exept.de>
parents: 5696
diff changeset
  1010
        Class withoutUpdatingChangesDo:[
ee59aff043c4 asExecutableMethod / asExecutableMethodWith: - code reuse
Claus Gittinger <cg@exept.de>
parents: 5696
diff changeset
  1011
            |silent lazy|
ee59aff043c4 asExecutableMethod / asExecutableMethodWith: - code reuse
Claus Gittinger <cg@exept.de>
parents: 5696
diff changeset
  1012
ee59aff043c4 asExecutableMethod / asExecutableMethodWith: - code reuse
Claus Gittinger <cg@exept.de>
parents: 5696
diff changeset
  1013
            silent := Smalltalk silentLoading:true.
ee59aff043c4 asExecutableMethod / asExecutableMethodWith: - code reuse
Claus Gittinger <cg@exept.de>
parents: 5696
diff changeset
  1014
            lazy := Compiler compileLazy:false.
ee59aff043c4 asExecutableMethod / asExecutableMethodWith: - code reuse
Claus Gittinger <cg@exept.de>
parents: 5696
diff changeset
  1015
ee59aff043c4 asExecutableMethod / asExecutableMethodWith: - code reuse
Claus Gittinger <cg@exept.de>
parents: 5696
diff changeset
  1016
            [
ee59aff043c4 asExecutableMethod / asExecutableMethodWith: - code reuse
Claus Gittinger <cg@exept.de>
parents: 5696
diff changeset
  1017
                |compiler|
ee59aff043c4 asExecutableMethod / asExecutableMethodWith: - code reuse
Claus Gittinger <cg@exept.de>
parents: 5696
diff changeset
  1018
ee59aff043c4 asExecutableMethod / asExecutableMethodWith: - code reuse
Claus Gittinger <cg@exept.de>
parents: 5696
diff changeset
  1019
                Class nameSpaceQuerySignal answer:(cls nameSpace)
ee59aff043c4 asExecutableMethod / asExecutableMethodWith: - code reuse
Claus Gittinger <cg@exept.de>
parents: 5696
diff changeset
  1020
                do:[
ee59aff043c4 asExecutableMethod / asExecutableMethodWith: - code reuse
Claus Gittinger <cg@exept.de>
parents: 5696
diff changeset
  1021
                    compiler := cls compilerClass.
ee59aff043c4 asExecutableMethod / asExecutableMethodWith: - code reuse
Claus Gittinger <cg@exept.de>
parents: 5696
diff changeset
  1022
ee59aff043c4 asExecutableMethod / asExecutableMethodWith: - code reuse
Claus Gittinger <cg@exept.de>
parents: 5696
diff changeset
  1023
                    "/
ee59aff043c4 asExecutableMethod / asExecutableMethodWith: - code reuse
Claus Gittinger <cg@exept.de>
parents: 5696
diff changeset
  1024
                    "/ kludge - have to make ST/X's compiler protocol
ee59aff043c4 asExecutableMethod / asExecutableMethodWith: - code reuse
Claus Gittinger <cg@exept.de>
parents: 5696
diff changeset
  1025
                    "/ be compatible to ST-80's
ee59aff043c4 asExecutableMethod / asExecutableMethodWith: - code reuse
Claus Gittinger <cg@exept.de>
parents: 5696
diff changeset
  1026
                    "/
ee59aff043c4 asExecutableMethod / asExecutableMethodWith: - code reuse
Claus Gittinger <cg@exept.de>
parents: 5696
diff changeset
  1027
                    (compiler respondsTo:#compile:forClass:inCategory:notifying:install:)
ee59aff043c4 asExecutableMethod / asExecutableMethodWith: - code reuse
Claus Gittinger <cg@exept.de>
parents: 5696
diff changeset
  1028
                    ifTrue:[
ee59aff043c4 asExecutableMethod / asExecutableMethodWith: - code reuse
Claus Gittinger <cg@exept.de>
parents: 5696
diff changeset
  1029
                        temporaryMethod := compiler
ee59aff043c4 asExecutableMethod / asExecutableMethodWith: - code reuse
Claus Gittinger <cg@exept.de>
parents: 5696
diff changeset
  1030
                                             compile:newSource
ee59aff043c4 asExecutableMethod / asExecutableMethodWith: - code reuse
Claus Gittinger <cg@exept.de>
parents: 5696
diff changeset
  1031
                                             forClass:cls
ee59aff043c4 asExecutableMethod / asExecutableMethodWith: - code reuse
Claus Gittinger <cg@exept.de>
parents: 5696
diff changeset
  1032
                                             inCategory:(self category)
ee59aff043c4 asExecutableMethod / asExecutableMethodWith: - code reuse
Claus Gittinger <cg@exept.de>
parents: 5696
diff changeset
  1033
                                             notifying:nil
ee59aff043c4 asExecutableMethod / asExecutableMethodWith: - code reuse
Claus Gittinger <cg@exept.de>
parents: 5696
diff changeset
  1034
                                             install:false.
ee59aff043c4 asExecutableMethod / asExecutableMethodWith: - code reuse
Claus Gittinger <cg@exept.de>
parents: 5696
diff changeset
  1035
                    ] ifFalse:[
ee59aff043c4 asExecutableMethod / asExecutableMethodWith: - code reuse
Claus Gittinger <cg@exept.de>
parents: 5696
diff changeset
  1036
                        temporaryMethod := compiler new
ee59aff043c4 asExecutableMethod / asExecutableMethodWith: - code reuse
Claus Gittinger <cg@exept.de>
parents: 5696
diff changeset
  1037
                                             compile:newSource 
ee59aff043c4 asExecutableMethod / asExecutableMethodWith: - code reuse
Claus Gittinger <cg@exept.de>
parents: 5696
diff changeset
  1038
                                             in:cls 
ee59aff043c4 asExecutableMethod / asExecutableMethodWith: - code reuse
Claus Gittinger <cg@exept.de>
parents: 5696
diff changeset
  1039
                                             notifying:nil 
ee59aff043c4 asExecutableMethod / asExecutableMethodWith: - code reuse
Claus Gittinger <cg@exept.de>
parents: 5696
diff changeset
  1040
                                             ifFail:nil
ee59aff043c4 asExecutableMethod / asExecutableMethodWith: - code reuse
Claus Gittinger <cg@exept.de>
parents: 5696
diff changeset
  1041
                    ].
ee59aff043c4 asExecutableMethod / asExecutableMethodWith: - code reuse
Claus Gittinger <cg@exept.de>
parents: 5696
diff changeset
  1042
                ].
6254
feae1d5d5431 Use the more elegant #ensure: instead of '#valueNowOrOnUnwindDo'
Stefan Vogel <sv@exept.de>
parents: 6234
diff changeset
  1043
            ] ensure:[
5700
ee59aff043c4 asExecutableMethod / asExecutableMethodWith: - code reuse
Claus Gittinger <cg@exept.de>
parents: 5696
diff changeset
  1044
                Compiler compileLazy:lazy.
ee59aff043c4 asExecutableMethod / asExecutableMethodWith: - code reuse
Claus Gittinger <cg@exept.de>
parents: 5696
diff changeset
  1045
                Smalltalk silentLoading:silent.
ee59aff043c4 asExecutableMethod / asExecutableMethodWith: - code reuse
Claus Gittinger <cg@exept.de>
parents: 5696
diff changeset
  1046
            ]
ee59aff043c4 asExecutableMethod / asExecutableMethodWith: - code reuse
Claus Gittinger <cg@exept.de>
parents: 5696
diff changeset
  1047
        ].
463
447ead9f870c be silent on transcript when parsing for args, vars and primitiveCode
Claus Gittinger <cg@exept.de>
parents: 444
diff changeset
  1048
    ].
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
  1049
    (temporaryMethod isNil or:[temporaryMethod == #Error]) ifTrue:[
5700
ee59aff043c4 asExecutableMethod / asExecutableMethodWith: - code reuse
Claus Gittinger <cg@exept.de>
parents: 5696
diff changeset
  1050
        'Method [warning]: cannot generate bytecode (contains primitive code or error)' errorPrintCR.
ee59aff043c4 asExecutableMethod / asExecutableMethodWith: - code reuse
Claus Gittinger <cg@exept.de>
parents: 5696
diff changeset
  1051
        ^ nil.
5405
f07c8045ab4e *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5398
diff changeset
  1052
    ].
f07c8045ab4e *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5398
diff changeset
  1053
    "/
f07c8045ab4e *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5398
diff changeset
  1054
    "/ 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
  1055
    "/
f07c8045ab4e *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5398
diff changeset
  1056
    temporaryMethod source:newSource. 
f07c8045ab4e *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5398
diff changeset
  1057
    "/
f07c8045ab4e *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5398
diff changeset
  1058
    "/ dont forget the methods class & package ...
f07c8045ab4e *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5398
diff changeset
  1059
    "/
f07c8045ab4e *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5398
diff changeset
  1060
    temporaryMethod setPackage:package.
f07c8045ab4e *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5398
diff changeset
  1061
    temporaryMethod mclass:mclass.
f07c8045ab4e *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5398
diff changeset
  1062
    ^ temporaryMethod
1
a27a279701f8 Initial revision
claus
parents:
diff changeset
  1063
! !
a27a279701f8 Initial revision
claus
parents:
diff changeset
  1064
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
  1065
!Method methodsFor:'copying'!
438
claus
parents: 423
diff changeset
  1066
952
d600e08a5936 handle the case where a method has a sourceFileInfo, but the class has not
Claus Gittinger <cg@exept.de>
parents: 934
diff changeset
  1067
copy
2176
1a24b0cef25a when compressing sources, make certain to avoid later
Claus Gittinger <cg@exept.de>
parents: 2171
diff changeset
  1068
    "redefined to change a source ref into a real string"
438
claus
parents: 423
diff changeset
  1069
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
  1070
    |aCopy|
438
claus
parents: 423
diff changeset
  1071
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
  1072
    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
  1073
    sourcePosition notNil ifTrue:[
5676
db728e9fe276 must flush cached mclass, when copying methods around
src
parents: 5665
diff changeset
  1074
        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
  1075
    ].
5676
db728e9fe276 must flush cached mclass, when copying methods around
src
parents: 5665
diff changeset
  1076
    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
  1077
    ^ aCopy
2176
1a24b0cef25a when compressing sources, make certain to avoid later
Claus Gittinger <cg@exept.de>
parents: 2171
diff changeset
  1078
5696
958a0643496d compatibility
Claus Gittinger <cg@exept.de>
parents: 5676
diff changeset
  1079
    "Modified: 16.1.1997 / 01:27:25 / cg"
958a0643496d compatibility
Claus Gittinger <cg@exept.de>
parents: 5676
diff changeset
  1080
! !
438
claus
parents: 423
diff changeset
  1081
1
a27a279701f8 Initial revision
claus
parents:
diff changeset
  1082
!Method methodsFor:'error handling'!
a27a279701f8 Initial revision
claus
parents:
diff changeset
  1083
328
claus
parents: 326
diff changeset
  1084
invalidCodeObject
1873
3544a4a94a2a checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1870
diff changeset
  1085
    "{ Pragma: +optSpace }"
3544a4a94a2a checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1870
diff changeset
  1086
93
e31220cb391f *** empty log message ***
claus
parents: 88
diff changeset
  1087
    "this method is triggered by the interpreter when a nil or non method
e31220cb391f *** empty log message ***
claus
parents: 88
diff changeset
  1088
     is about to be executed.
e31220cb391f *** empty log message ***
claus
parents: 88
diff changeset
  1089
     In this case, the VM sends this to the bad method (the receiver).
e31220cb391f *** empty log message ***
claus
parents: 88
diff changeset
  1090
e31220cb391f *** empty log message ***
claus
parents: 88
diff changeset
  1091
     Also, the Compiler creates methods with their code/bytecode set to
e31220cb391f *** empty log message ***
claus
parents: 88
diff changeset
  1092
     this method if - after a class change - a method cannot be compiled
e31220cb391f *** empty log message ***
claus
parents: 88
diff changeset
  1093
     and is therefore no longer executable (for example, after an instvar
68
59faa75185ba *** empty log message ***
claus
parents: 56
diff changeset
  1094
     has been removed, and a method still tries to access this instvar)
44
b262907c93ea *** empty log message ***
claus
parents: 42
diff changeset
  1095
93
e31220cb391f *** empty log message ***
claus
parents: 88
diff changeset
  1096
     Thus, we arrive here, when playing around in a classes methodArray,
e31220cb391f *** empty log message ***
claus
parents: 88
diff changeset
  1097
     or compiler/runtime system is broken :-(, 
e31220cb391f *** empty log message ***
claus
parents: 88
diff changeset
  1098
     or you ignore the error messages during some recompile."
1
a27a279701f8 Initial revision
claus
parents:
diff changeset
  1099
1873
3544a4a94a2a checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1870
diff changeset
  1100
%{
3544a4a94a2a checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1870
diff changeset
  1101
    /*
3544a4a94a2a checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1870
diff changeset
  1102
     * for reasons too far from being explained here,
3544a4a94a2a checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1870
diff changeset
  1103
     * this MUST be a compiled method
3544a4a94a2a checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1870
diff changeset
  1104
     */
3544a4a94a2a checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1870
diff changeset
  1105
%}.
7601
57c257f1150a Fix race when accessing source
Stefan Vogel <sv@exept.de>
parents: 7457
diff changeset
  1106
    ^ InvalidCodeError
57c257f1150a Fix race when accessing source
Stefan Vogel <sv@exept.de>
parents: 7457
diff changeset
  1107
        raiseErrorString:'invalid method - not executable'.
1873
3544a4a94a2a checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1870
diff changeset
  1108
3544a4a94a2a checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1870
diff changeset
  1109
    "Modified: 4.11.1996 / 22:45:06 / cg"
1
a27a279701f8 Initial revision
claus
parents:
diff changeset
  1110
!
a27a279701f8 Initial revision
claus
parents:
diff changeset
  1111
1870
2623b60c27e1 lifted numVars; added access for invalidCodeObject-trappers
Claus Gittinger <cg@exept.de>
parents: 1855
diff changeset
  1112
invalidCodeObjectWith:arg
1873
3544a4a94a2a checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1870
diff changeset
  1113
    "{ Pragma: +optSpace }"
3544a4a94a2a checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1870
diff changeset
  1114
1870
2623b60c27e1 lifted numVars; added access for invalidCodeObject-trappers
Claus Gittinger <cg@exept.de>
parents: 1855
diff changeset
  1115
    "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
  1116
     uncompilable methods (with 1 arg) will be bound to this method here,
2623b60c27e1 lifted numVars; added access for invalidCodeObject-trappers
Claus Gittinger <cg@exept.de>
parents: 1855
diff changeset
  1117
     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
  1118
1873
3544a4a94a2a checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1870
diff changeset
  1119
%{
3544a4a94a2a checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1870
diff changeset
  1120
    /*
3544a4a94a2a checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1870
diff changeset
  1121
     * for reasons too far from being explained here,
3544a4a94a2a checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1870
diff changeset
  1122
     * this MUST be a compiled method
3544a4a94a2a checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1870
diff changeset
  1123
     */
3544a4a94a2a checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1870
diff changeset
  1124
%}.
7601
57c257f1150a Fix race when accessing source
Stefan Vogel <sv@exept.de>
parents: 7457
diff changeset
  1125
    ^ InvalidCodeError
57c257f1150a Fix race when accessing source
Stefan Vogel <sv@exept.de>
parents: 7457
diff changeset
  1126
        raiseErrorString:'invalid method - not executable'.
1870
2623b60c27e1 lifted numVars; added access for invalidCodeObject-trappers
Claus Gittinger <cg@exept.de>
parents: 1855
diff changeset
  1127
2623b60c27e1 lifted numVars; added access for invalidCodeObject-trappers
Claus Gittinger <cg@exept.de>
parents: 1855
diff changeset
  1128
    "Created: 4.11.1996 / 21:16:16 / cg"
1873
3544a4a94a2a checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1870
diff changeset
  1129
    "Modified: 4.11.1996 / 22:45:12 / cg"
1870
2623b60c27e1 lifted numVars; added access for invalidCodeObject-trappers
Claus Gittinger <cg@exept.de>
parents: 1855
diff changeset
  1130
!
2623b60c27e1 lifted numVars; added access for invalidCodeObject-trappers
Claus Gittinger <cg@exept.de>
parents: 1855
diff changeset
  1131
2623b60c27e1 lifted numVars; added access for invalidCodeObject-trappers
Claus Gittinger <cg@exept.de>
parents: 1855
diff changeset
  1132
invalidCodeObjectWith:arg with:arg2
1873
3544a4a94a2a checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1870
diff changeset
  1133
    "{ Pragma: +optSpace }"
3544a4a94a2a checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1870
diff changeset
  1134
1870
2623b60c27e1 lifted numVars; added access for invalidCodeObject-trappers
Claus Gittinger <cg@exept.de>
parents: 1855
diff changeset
  1135
    "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
  1136
     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
  1137
     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
  1138
1873
3544a4a94a2a checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1870
diff changeset
  1139
%{
3544a4a94a2a checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1870
diff changeset
  1140
    /*
3544a4a94a2a checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1870
diff changeset
  1141
     * for reasons too far from being explained here,
3544a4a94a2a checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1870
diff changeset
  1142
     * this MUST be a compiled method
3544a4a94a2a checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1870
diff changeset
  1143
     */
3544a4a94a2a checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1870
diff changeset
  1144
%}.
7601
57c257f1150a Fix race when accessing source
Stefan Vogel <sv@exept.de>
parents: 7457
diff changeset
  1145
    ^ InvalidCodeError
57c257f1150a Fix race when accessing source
Stefan Vogel <sv@exept.de>
parents: 7457
diff changeset
  1146
        raiseErrorString:'invalid method - not executable'.
1870
2623b60c27e1 lifted numVars; added access for invalidCodeObject-trappers
Claus Gittinger <cg@exept.de>
parents: 1855
diff changeset
  1147
2623b60c27e1 lifted numVars; added access for invalidCodeObject-trappers
Claus Gittinger <cg@exept.de>
parents: 1855
diff changeset
  1148
    "Created: 4.11.1996 / 21:16:41 / cg"
1873
3544a4a94a2a checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1870
diff changeset
  1149
    "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
  1150
!
2623b60c27e1 lifted numVars; added access for invalidCodeObject-trappers
Claus Gittinger <cg@exept.de>
parents: 1855
diff changeset
  1151
2623b60c27e1 lifted numVars; added access for invalidCodeObject-trappers
Claus Gittinger <cg@exept.de>
parents: 1855
diff changeset
  1152
invalidCodeObjectWith:arg with:arg2 with:arg3
1873
3544a4a94a2a checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1870
diff changeset
  1153
    "{ Pragma: +optSpace }"
3544a4a94a2a checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1870
diff changeset
  1154
1870
2623b60c27e1 lifted numVars; added access for invalidCodeObject-trappers
Claus Gittinger <cg@exept.de>
parents: 1855
diff changeset
  1155
    "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
  1156
     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
  1157
     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
  1158
1873
3544a4a94a2a checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1870
diff changeset
  1159
%{
3544a4a94a2a checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1870
diff changeset
  1160
    /*
3544a4a94a2a checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1870
diff changeset
  1161
     * for reasons too far from being explained here,
3544a4a94a2a checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1870
diff changeset
  1162
     * this MUST be a compiled method
3544a4a94a2a checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1870
diff changeset
  1163
     */
3544a4a94a2a checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1870
diff changeset
  1164
%}.
7601
57c257f1150a Fix race when accessing source
Stefan Vogel <sv@exept.de>
parents: 7457
diff changeset
  1165
    ^ InvalidCodeError
57c257f1150a Fix race when accessing source
Stefan Vogel <sv@exept.de>
parents: 7457
diff changeset
  1166
        raiseErrorString:'invalid method - not executable'.
1870
2623b60c27e1 lifted numVars; added access for invalidCodeObject-trappers
Claus Gittinger <cg@exept.de>
parents: 1855
diff changeset
  1167
2623b60c27e1 lifted numVars; added access for invalidCodeObject-trappers
Claus Gittinger <cg@exept.de>
parents: 1855
diff changeset
  1168
    "Created: 4.11.1996 / 21:16:51 / cg"
1873
3544a4a94a2a checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1870
diff changeset
  1169
    "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
  1170
!
2623b60c27e1 lifted numVars; added access for invalidCodeObject-trappers
Claus Gittinger <cg@exept.de>
parents: 1855
diff changeset
  1171
2623b60c27e1 lifted numVars; added access for invalidCodeObject-trappers
Claus Gittinger <cg@exept.de>
parents: 1855
diff changeset
  1172
invalidCodeObjectWith:arg with:arg2 with:arg3 with:arg4
1873
3544a4a94a2a checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1870
diff changeset
  1173
    "{ Pragma: +optSpace }"
3544a4a94a2a checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1870
diff changeset
  1174
1870
2623b60c27e1 lifted numVars; added access for invalidCodeObject-trappers
Claus Gittinger <cg@exept.de>
parents: 1855
diff changeset
  1175
    "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
  1176
     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
  1177
     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
  1178
1873
3544a4a94a2a checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1870
diff changeset
  1179
%{
3544a4a94a2a checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1870
diff changeset
  1180
    /*
3544a4a94a2a checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1870
diff changeset
  1181
     * for reasons too far from being explained here,
3544a4a94a2a checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1870
diff changeset
  1182
     * this MUST be a compiled method
3544a4a94a2a checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1870
diff changeset
  1183
     */
3544a4a94a2a checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1870
diff changeset
  1184
%}.
7601
57c257f1150a Fix race when accessing source
Stefan Vogel <sv@exept.de>
parents: 7457
diff changeset
  1185
    ^ InvalidCodeError
57c257f1150a Fix race when accessing source
Stefan Vogel <sv@exept.de>
parents: 7457
diff changeset
  1186
        raiseErrorString:'invalid method - not executable'.
1870
2623b60c27e1 lifted numVars; added access for invalidCodeObject-trappers
Claus Gittinger <cg@exept.de>
parents: 1855
diff changeset
  1187
2623b60c27e1 lifted numVars; added access for invalidCodeObject-trappers
Claus Gittinger <cg@exept.de>
parents: 1855
diff changeset
  1188
    "Created: 4.11.1996 / 21:17:00 / cg"
1873
3544a4a94a2a checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1870
diff changeset
  1189
    "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
  1190
!
2623b60c27e1 lifted numVars; added access for invalidCodeObject-trappers
Claus Gittinger <cg@exept.de>
parents: 1855
diff changeset
  1191
2623b60c27e1 lifted numVars; added access for invalidCodeObject-trappers
Claus Gittinger <cg@exept.de>
parents: 1855
diff changeset
  1192
invalidCodeObjectWith:arg with:arg2 with:arg3 with:arg4 with:arg5
1873
3544a4a94a2a checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1870
diff changeset
  1193
    "{ Pragma: +optSpace }"
3544a4a94a2a checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1870
diff changeset
  1194
1870
2623b60c27e1 lifted numVars; added access for invalidCodeObject-trappers
Claus Gittinger <cg@exept.de>
parents: 1855
diff changeset
  1195
    "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
  1196
     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
  1197
     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
  1198
1873
3544a4a94a2a checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1870
diff changeset
  1199
%{
3544a4a94a2a checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1870
diff changeset
  1200
    /*
3544a4a94a2a checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1870
diff changeset
  1201
     * for reasons too far from being explained here,
3544a4a94a2a checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1870
diff changeset
  1202
     * this MUST be a compiled method
3544a4a94a2a checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1870
diff changeset
  1203
     */
3544a4a94a2a checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1870
diff changeset
  1204
%}.
7601
57c257f1150a Fix race when accessing source
Stefan Vogel <sv@exept.de>
parents: 7457
diff changeset
  1205
    ^ InvalidCodeError
57c257f1150a Fix race when accessing source
Stefan Vogel <sv@exept.de>
parents: 7457
diff changeset
  1206
        raiseErrorString:'invalid method - not executable'.
1870
2623b60c27e1 lifted numVars; added access for invalidCodeObject-trappers
Claus Gittinger <cg@exept.de>
parents: 1855
diff changeset
  1207
2623b60c27e1 lifted numVars; added access for invalidCodeObject-trappers
Claus Gittinger <cg@exept.de>
parents: 1855
diff changeset
  1208
    "Created: 4.11.1996 / 21:17:09 / cg"
1873
3544a4a94a2a checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1870
diff changeset
  1209
    "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
  1210
!
2623b60c27e1 lifted numVars; added access for invalidCodeObject-trappers
Claus Gittinger <cg@exept.de>
parents: 1855
diff changeset
  1211
2623b60c27e1 lifted numVars; added access for invalidCodeObject-trappers
Claus Gittinger <cg@exept.de>
parents: 1855
diff changeset
  1212
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
  1213
    "{ Pragma: +optSpace }"
3544a4a94a2a checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1870
diff changeset
  1214
1870
2623b60c27e1 lifted numVars; added access for invalidCodeObject-trappers
Claus Gittinger <cg@exept.de>
parents: 1855
diff changeset
  1215
    "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
  1216
     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
  1217
     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
  1218
1873
3544a4a94a2a checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1870
diff changeset
  1219
%{
3544a4a94a2a checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1870
diff changeset
  1220
    /*
3544a4a94a2a checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1870
diff changeset
  1221
     * for reasons too far from being explained here,
3544a4a94a2a checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1870
diff changeset
  1222
     * this MUST be a compiled method
3544a4a94a2a checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1870
diff changeset
  1223
     */
3544a4a94a2a checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1870
diff changeset
  1224
%}.
7601
57c257f1150a Fix race when accessing source
Stefan Vogel <sv@exept.de>
parents: 7457
diff changeset
  1225
    ^ InvalidCodeError
57c257f1150a Fix race when accessing source
Stefan Vogel <sv@exept.de>
parents: 7457
diff changeset
  1226
        raiseErrorString:'invalid method - not executable'.
1870
2623b60c27e1 lifted numVars; added access for invalidCodeObject-trappers
Claus Gittinger <cg@exept.de>
parents: 1855
diff changeset
  1227
2623b60c27e1 lifted numVars; added access for invalidCodeObject-trappers
Claus Gittinger <cg@exept.de>
parents: 1855
diff changeset
  1228
    "Created: 4.11.1996 / 21:17:17 / cg"
1873
3544a4a94a2a checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1870
diff changeset
  1229
    "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
  1230
!
2623b60c27e1 lifted numVars; added access for invalidCodeObject-trappers
Claus Gittinger <cg@exept.de>
parents: 1855
diff changeset
  1231
2623b60c27e1 lifted numVars; added access for invalidCodeObject-trappers
Claus Gittinger <cg@exept.de>
parents: 1855
diff changeset
  1232
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
  1233
    "{ Pragma: +optSpace }"
3544a4a94a2a checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1870
diff changeset
  1234
1870
2623b60c27e1 lifted numVars; added access for invalidCodeObject-trappers
Claus Gittinger <cg@exept.de>
parents: 1855
diff changeset
  1235
    "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
  1236
     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
  1237
     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
  1238
1873
3544a4a94a2a checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1870
diff changeset
  1239
%{
3544a4a94a2a checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1870
diff changeset
  1240
    /*
3544a4a94a2a checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1870
diff changeset
  1241
     * for reasons too far from being explained here,
3544a4a94a2a checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1870
diff changeset
  1242
     * this MUST be a compiled method
3544a4a94a2a checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1870
diff changeset
  1243
     */
3544a4a94a2a checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1870
diff changeset
  1244
%}.
7601
57c257f1150a Fix race when accessing source
Stefan Vogel <sv@exept.de>
parents: 7457
diff changeset
  1245
    ^ InvalidCodeError
57c257f1150a Fix race when accessing source
Stefan Vogel <sv@exept.de>
parents: 7457
diff changeset
  1246
        raiseErrorString:'invalid method - not executable'.
1870
2623b60c27e1 lifted numVars; added access for invalidCodeObject-trappers
Claus Gittinger <cg@exept.de>
parents: 1855
diff changeset
  1247
2623b60c27e1 lifted numVars; added access for invalidCodeObject-trappers
Claus Gittinger <cg@exept.de>
parents: 1855
diff changeset
  1248
    "Created: 4.11.1996 / 21:17:25 / cg"
1873
3544a4a94a2a checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1870
diff changeset
  1249
    "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
  1250
!
2623b60c27e1 lifted numVars; added access for invalidCodeObject-trappers
Claus Gittinger <cg@exept.de>
parents: 1855
diff changeset
  1251
2623b60c27e1 lifted numVars; added access for invalidCodeObject-trappers
Claus Gittinger <cg@exept.de>
parents: 1855
diff changeset
  1252
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
  1253
    "{ Pragma: +optSpace }"
3544a4a94a2a checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1870
diff changeset
  1254
1870
2623b60c27e1 lifted numVars; added access for invalidCodeObject-trappers
Claus Gittinger <cg@exept.de>
parents: 1855
diff changeset
  1255
    "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
  1256
     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
  1257
     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
  1258
1873
3544a4a94a2a checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1870
diff changeset
  1259
%{
3544a4a94a2a checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1870
diff changeset
  1260
    /*
3544a4a94a2a checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1870
diff changeset
  1261
     * for reasons too far from being explained here,
3544a4a94a2a checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1870
diff changeset
  1262
     * this MUST be a compiled method
3544a4a94a2a checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1870
diff changeset
  1263
     */
3544a4a94a2a checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1870
diff changeset
  1264
%}.
7601
57c257f1150a Fix race when accessing source
Stefan Vogel <sv@exept.de>
parents: 7457
diff changeset
  1265
    ^ InvalidCodeError
57c257f1150a Fix race when accessing source
Stefan Vogel <sv@exept.de>
parents: 7457
diff changeset
  1266
        raiseErrorString:'invalid method - not executable'.
1870
2623b60c27e1 lifted numVars; added access for invalidCodeObject-trappers
Claus Gittinger <cg@exept.de>
parents: 1855
diff changeset
  1267
2623b60c27e1 lifted numVars; added access for invalidCodeObject-trappers
Claus Gittinger <cg@exept.de>
parents: 1855
diff changeset
  1268
    "Created: 4.11.1996 / 21:17:32 / cg"
1873
3544a4a94a2a checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1870
diff changeset
  1269
    "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
  1270
!
2623b60c27e1 lifted numVars; added access for invalidCodeObject-trappers
Claus Gittinger <cg@exept.de>
parents: 1855
diff changeset
  1271
2623b60c27e1 lifted numVars; added access for invalidCodeObject-trappers
Claus Gittinger <cg@exept.de>
parents: 1855
diff changeset
  1272
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
  1273
    "{ Pragma: +optSpace }"
3544a4a94a2a checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1870
diff changeset
  1274
1870
2623b60c27e1 lifted numVars; added access for invalidCodeObject-trappers
Claus Gittinger <cg@exept.de>
parents: 1855
diff changeset
  1275
    "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
  1276
     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
  1277
     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
  1278
1873
3544a4a94a2a checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1870
diff changeset
  1279
%{
3544a4a94a2a checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1870
diff changeset
  1280
    /*
3544a4a94a2a checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1870
diff changeset
  1281
     * for reasons too far from being explained here,
3544a4a94a2a checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1870
diff changeset
  1282
     * this MUST be a compiled method
3544a4a94a2a checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1870
diff changeset
  1283
     */
3544a4a94a2a checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1870
diff changeset
  1284
%}.
7601
57c257f1150a Fix race when accessing source
Stefan Vogel <sv@exept.de>
parents: 7457
diff changeset
  1285
    ^ InvalidCodeError
57c257f1150a Fix race when accessing source
Stefan Vogel <sv@exept.de>
parents: 7457
diff changeset
  1286
        raiseErrorString:'invalid method - not executable'.
1870
2623b60c27e1 lifted numVars; added access for invalidCodeObject-trappers
Claus Gittinger <cg@exept.de>
parents: 1855
diff changeset
  1287
2623b60c27e1 lifted numVars; added access for invalidCodeObject-trappers
Claus Gittinger <cg@exept.de>
parents: 1855
diff changeset
  1288
    "Created: 4.11.1996 / 21:17:37 / cg"
1873
3544a4a94a2a checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1870
diff changeset
  1289
    "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
  1290
!
2623b60c27e1 lifted numVars; added access for invalidCodeObject-trappers
Claus Gittinger <cg@exept.de>
parents: 1855
diff changeset
  1291
2623b60c27e1 lifted numVars; added access for invalidCodeObject-trappers
Claus Gittinger <cg@exept.de>
parents: 1855
diff changeset
  1292
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
  1293
    "{ Pragma: +optSpace }"
3544a4a94a2a checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1870
diff changeset
  1294
1870
2623b60c27e1 lifted numVars; added access for invalidCodeObject-trappers
Claus Gittinger <cg@exept.de>
parents: 1855
diff changeset
  1295
    "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
  1296
     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
  1297
     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
  1298
1873
3544a4a94a2a checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1870
diff changeset
  1299
%{
3544a4a94a2a checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1870
diff changeset
  1300
    /*
3544a4a94a2a checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1870
diff changeset
  1301
     * for reasons too far from being explained here,
3544a4a94a2a checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1870
diff changeset
  1302
     * this MUST be a compiled method
3544a4a94a2a checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1870
diff changeset
  1303
     */
3544a4a94a2a checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1870
diff changeset
  1304
%}.
7601
57c257f1150a Fix race when accessing source
Stefan Vogel <sv@exept.de>
parents: 7457
diff changeset
  1305
    ^ InvalidCodeError
57c257f1150a Fix race when accessing source
Stefan Vogel <sv@exept.de>
parents: 7457
diff changeset
  1306
        raiseErrorString:'invalid method - not executable'.
1870
2623b60c27e1 lifted numVars; added access for invalidCodeObject-trappers
Claus Gittinger <cg@exept.de>
parents: 1855
diff changeset
  1307
2623b60c27e1 lifted numVars; added access for invalidCodeObject-trappers
Claus Gittinger <cg@exept.de>
parents: 1855
diff changeset
  1308
    "Created: 4.11.1996 / 21:17:45 / cg"
1873
3544a4a94a2a checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1870
diff changeset
  1309
    "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
  1310
!
2623b60c27e1 lifted numVars; added access for invalidCodeObject-trappers
Claus Gittinger <cg@exept.de>
parents: 1855
diff changeset
  1311
2623b60c27e1 lifted numVars; added access for invalidCodeObject-trappers
Claus Gittinger <cg@exept.de>
parents: 1855
diff changeset
  1312
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
  1313
    "{ Pragma: +optSpace }"
3544a4a94a2a checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1870
diff changeset
  1314
1870
2623b60c27e1 lifted numVars; added access for invalidCodeObject-trappers
Claus Gittinger <cg@exept.de>
parents: 1855
diff changeset
  1315
    "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
  1316
     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
  1317
     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
  1318
1873
3544a4a94a2a checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1870
diff changeset
  1319
%{
3544a4a94a2a checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1870
diff changeset
  1320
    /*
3544a4a94a2a checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1870
diff changeset
  1321
     * for reasons too far from being explained here,
3544a4a94a2a checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1870
diff changeset
  1322
     * this MUST be a compiled method
3544a4a94a2a checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1870
diff changeset
  1323
     */
3544a4a94a2a checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1870
diff changeset
  1324
%}.
7601
57c257f1150a Fix race when accessing source
Stefan Vogel <sv@exept.de>
parents: 7457
diff changeset
  1325
    ^ InvalidCodeError
57c257f1150a Fix race when accessing source
Stefan Vogel <sv@exept.de>
parents: 7457
diff changeset
  1326
        raiseErrorString:'invalid method - not executable'.
1870
2623b60c27e1 lifted numVars; added access for invalidCodeObject-trappers
Claus Gittinger <cg@exept.de>
parents: 1855
diff changeset
  1327
2623b60c27e1 lifted numVars; added access for invalidCodeObject-trappers
Claus Gittinger <cg@exept.de>
parents: 1855
diff changeset
  1328
    "Created: 4.11.1996 / 21:17:52 / cg"
1873
3544a4a94a2a checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1870
diff changeset
  1329
    "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
  1330
!
2623b60c27e1 lifted numVars; added access for invalidCodeObject-trappers
Claus Gittinger <cg@exept.de>
parents: 1855
diff changeset
  1331
2623b60c27e1 lifted numVars; added access for invalidCodeObject-trappers
Claus Gittinger <cg@exept.de>
parents: 1855
diff changeset
  1332
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
  1333
    "{ Pragma: +optSpace }"
3544a4a94a2a checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1870
diff changeset
  1334
1870
2623b60c27e1 lifted numVars; added access for invalidCodeObject-trappers
Claus Gittinger <cg@exept.de>
parents: 1855
diff changeset
  1335
    "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
  1336
     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
  1337
     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
  1338
1873
3544a4a94a2a checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1870
diff changeset
  1339
%{
3544a4a94a2a checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1870
diff changeset
  1340
    /*
3544a4a94a2a checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1870
diff changeset
  1341
     * for reasons too far from being explained here,
3544a4a94a2a checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1870
diff changeset
  1342
     * this MUST be a compiled method
3544a4a94a2a checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1870
diff changeset
  1343
     */
3544a4a94a2a checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1870
diff changeset
  1344
%}.
7601
57c257f1150a Fix race when accessing source
Stefan Vogel <sv@exept.de>
parents: 7457
diff changeset
  1345
    ^ InvalidCodeError
57c257f1150a Fix race when accessing source
Stefan Vogel <sv@exept.de>
parents: 7457
diff changeset
  1346
        raiseErrorString:'invalid method - not executable'.
1870
2623b60c27e1 lifted numVars; added access for invalidCodeObject-trappers
Claus Gittinger <cg@exept.de>
parents: 1855
diff changeset
  1347
2623b60c27e1 lifted numVars; added access for invalidCodeObject-trappers
Claus Gittinger <cg@exept.de>
parents: 1855
diff changeset
  1348
    "Created: 4.11.1996 / 20:51:28 / cg"
1873
3544a4a94a2a checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1870
diff changeset
  1349
    "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
  1350
!
2623b60c27e1 lifted numVars; added access for invalidCodeObject-trappers
Claus Gittinger <cg@exept.de>
parents: 1855
diff changeset
  1351
2623b60c27e1 lifted numVars; added access for invalidCodeObject-trappers
Claus Gittinger <cg@exept.de>
parents: 1855
diff changeset
  1352
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
  1353
    "{ Pragma: +optSpace }"
3544a4a94a2a checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1870
diff changeset
  1354
1870
2623b60c27e1 lifted numVars; added access for invalidCodeObject-trappers
Claus Gittinger <cg@exept.de>
parents: 1855
diff changeset
  1355
    "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
  1356
     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
  1357
     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
  1358
1873
3544a4a94a2a checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1870
diff changeset
  1359
%{
3544a4a94a2a checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1870
diff changeset
  1360
    /*
3544a4a94a2a checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1870
diff changeset
  1361
     * for reasons too far from being explained here,
3544a4a94a2a checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1870
diff changeset
  1362
     * this MUST be a compiled method
3544a4a94a2a checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1870
diff changeset
  1363
     */
3544a4a94a2a checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1870
diff changeset
  1364
%}.
7601
57c257f1150a Fix race when accessing source
Stefan Vogel <sv@exept.de>
parents: 7457
diff changeset
  1365
    ^ InvalidCodeError
57c257f1150a Fix race when accessing source
Stefan Vogel <sv@exept.de>
parents: 7457
diff changeset
  1366
        raiseErrorString:'invalid method - not executable'.
1870
2623b60c27e1 lifted numVars; added access for invalidCodeObject-trappers
Claus Gittinger <cg@exept.de>
parents: 1855
diff changeset
  1367
2623b60c27e1 lifted numVars; added access for invalidCodeObject-trappers
Claus Gittinger <cg@exept.de>
parents: 1855
diff changeset
  1368
    "Created: 4.11.1996 / 21:18:09 / cg"
1873
3544a4a94a2a checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1870
diff changeset
  1369
    "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
  1370
!
2623b60c27e1 lifted numVars; added access for invalidCodeObject-trappers
Claus Gittinger <cg@exept.de>
parents: 1855
diff changeset
  1371
2623b60c27e1 lifted numVars; added access for invalidCodeObject-trappers
Claus Gittinger <cg@exept.de>
parents: 1855
diff changeset
  1372
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
  1373
    "{ Pragma: +optSpace }"
3544a4a94a2a checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1870
diff changeset
  1374
1870
2623b60c27e1 lifted numVars; added access for invalidCodeObject-trappers
Claus Gittinger <cg@exept.de>
parents: 1855
diff changeset
  1375
    "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
  1376
     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
  1377
     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
  1378
1873
3544a4a94a2a checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1870
diff changeset
  1379
%{
3544a4a94a2a checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1870
diff changeset
  1380
    /*
3544a4a94a2a checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1870
diff changeset
  1381
     * for reasons too far from being explained here,
3544a4a94a2a checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1870
diff changeset
  1382
     * this MUST be a compiled method
3544a4a94a2a checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1870
diff changeset
  1383
     */
3544a4a94a2a checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1870
diff changeset
  1384
%}.
7601
57c257f1150a Fix race when accessing source
Stefan Vogel <sv@exept.de>
parents: 7457
diff changeset
  1385
    ^ InvalidCodeError
57c257f1150a Fix race when accessing source
Stefan Vogel <sv@exept.de>
parents: 7457
diff changeset
  1386
        raiseErrorString:'invalid method - not executable'.
1870
2623b60c27e1 lifted numVars; added access for invalidCodeObject-trappers
Claus Gittinger <cg@exept.de>
parents: 1855
diff changeset
  1387
2623b60c27e1 lifted numVars; added access for invalidCodeObject-trappers
Claus Gittinger <cg@exept.de>
parents: 1855
diff changeset
  1388
    "Created: 4.11.1996 / 21:18:17 / cg"
1873
3544a4a94a2a checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1870
diff changeset
  1389
    "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
  1390
!
2623b60c27e1 lifted numVars; added access for invalidCodeObject-trappers
Claus Gittinger <cg@exept.de>
parents: 1855
diff changeset
  1391
2623b60c27e1 lifted numVars; added access for invalidCodeObject-trappers
Claus Gittinger <cg@exept.de>
parents: 1855
diff changeset
  1392
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
  1393
    "{ Pragma: +optSpace }"
3544a4a94a2a checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1870
diff changeset
  1394
1870
2623b60c27e1 lifted numVars; added access for invalidCodeObject-trappers
Claus Gittinger <cg@exept.de>
parents: 1855
diff changeset
  1395
    "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
  1396
     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
  1397
     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
  1398
1873
3544a4a94a2a checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1870
diff changeset
  1399
%{
3544a4a94a2a checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1870
diff changeset
  1400
    /*
3544a4a94a2a checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1870
diff changeset
  1401
     * for reasons too far from being explained here,
3544a4a94a2a checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1870
diff changeset
  1402
     * this MUST be a compiled method
3544a4a94a2a checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1870
diff changeset
  1403
     */
3544a4a94a2a checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1870
diff changeset
  1404
%}.
7601
57c257f1150a Fix race when accessing source
Stefan Vogel <sv@exept.de>
parents: 7457
diff changeset
  1405
    ^ InvalidCodeError
57c257f1150a Fix race when accessing source
Stefan Vogel <sv@exept.de>
parents: 7457
diff changeset
  1406
        raiseErrorString:'invalid method - not executable'.
1870
2623b60c27e1 lifted numVars; added access for invalidCodeObject-trappers
Claus Gittinger <cg@exept.de>
parents: 1855
diff changeset
  1407
2623b60c27e1 lifted numVars; added access for invalidCodeObject-trappers
Claus Gittinger <cg@exept.de>
parents: 1855
diff changeset
  1408
    "Created: 4.11.1996 / 21:18:22 / cg"
1873
3544a4a94a2a checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1870
diff changeset
  1409
    "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
  1410
!
2623b60c27e1 lifted numVars; added access for invalidCodeObject-trappers
Claus Gittinger <cg@exept.de>
parents: 1855
diff changeset
  1411
109
1fae65190b17 errors raise signals; check arg-count in valueWith...
claus
parents: 93
diff changeset
  1412
privateMethodCalled
1873
3544a4a94a2a checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1870
diff changeset
  1413
    "{ Pragma: +optSpace }"
3544a4a94a2a checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1870
diff changeset
  1414
980
0ab2f56ecfc7 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 957
diff changeset
  1415
    "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
  1416
360
claus
parents: 350
diff changeset
  1417
     If you continue in the debugger, the method will be called,
415
claus
parents: 414
diff changeset
  1418
     and further privacy exceptions will NOT be reported at this call location, 
360
claus
parents: 350
diff changeset
  1419
     until any new method is compiled, or the privacy of any method changes,
claus
parents: 350
diff changeset
  1420
     or the caches are flushed.
claus
parents: 350
diff changeset
  1421
     (the reason is that after the continue, the method is enterred into the
claus
parents: 350
diff changeset
  1422
      calling cache, for which method privacy is not checked.
claus
parents: 350
diff changeset
  1423
      Any of the above actions flushes this cache and a privacy check
claus
parents: 350
diff changeset
  1424
      is performed again.)
claus
parents: 350
diff changeset
  1425
     Future versions may not enter private methods into the cache, to fix this
claus
parents: 350
diff changeset
  1426
     (unobvious) behavior. However, then you will get an exception for EVERY
claus
parents: 350
diff changeset
  1427
     call to a private method ...
claus
parents: 350
diff changeset
  1428
claus
parents: 350
diff changeset
  1429
     Notice: method privacy is a nonstandard feature, not supported
claus
parents: 350
diff changeset
  1430
     by other smalltalk implementations and not specified in the ANSI spec.
claus
parents: 350
diff changeset
  1431
     This is EXPERIMENTAL - and being evaluated for usability.
claus
parents: 350
diff changeset
  1432
     It may change or even vanish (if it shows to be not useful)."
68
59faa75185ba *** empty log message ***
claus
parents: 56
diff changeset
  1433
8518
7dc3f9909640 Interchanged the meaning of method privacy -
Stefan Vogel <sv@exept.de>
parents: 8465
diff changeset
  1434
    ^ PrivateMethodSignal raiseRequest
1873
3544a4a94a2a checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1870
diff changeset
  1435
3544a4a94a2a checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1870
diff changeset
  1436
    "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
  1437
!
d600e08a5936 handle the case where a method has a sourceFileInfo, but the class has not
Claus Gittinger <cg@exept.de>
parents: 934
diff changeset
  1438
d600e08a5936 handle the case where a method has a sourceFileInfo, but the class has not
Claus Gittinger <cg@exept.de>
parents: 934
diff changeset
  1439
uncompiledCodeObject
1873
3544a4a94a2a checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1870
diff changeset
  1440
    "{ Pragma: +optSpace }"
3544a4a94a2a checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1870
diff changeset
  1441
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
  1442
    "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
  1443
     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
  1444
     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
  1445
     For those methods, the compiler generated a method object consisting
1873
3544a4a94a2a checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1870
diff changeset
  1446
     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
  1447
3544a4a94a2a checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1870
diff changeset
  1448
%{
3544a4a94a2a checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1870
diff changeset
  1449
    /*
3544a4a94a2a checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1870
diff changeset
  1450
     * for reasons too far from being explained here,
3544a4a94a2a checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1870
diff changeset
  1451
     * this MUST be a compiled method
3544a4a94a2a checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1870
diff changeset
  1452
     */
3544a4a94a2a checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1870
diff changeset
  1453
%}.
7601
57c257f1150a Fix race when accessing source
Stefan Vogel <sv@exept.de>
parents: 7457
diff changeset
  1454
    ^ InvalidCodeError
57c257f1150a Fix race when accessing source
Stefan Vogel <sv@exept.de>
parents: 7457
diff changeset
  1455
        raiseRequestWith:self
57c257f1150a Fix race when accessing source
Stefan Vogel <sv@exept.de>
parents: 7457
diff changeset
  1456
        errorString:'invalid method - not compiled'.
1873
3544a4a94a2a checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1870
diff changeset
  1457
3544a4a94a2a checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1870
diff changeset
  1458
    "Modified: 4.11.1996 / 22:58:02 / cg"
3544a4a94a2a checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1870
diff changeset
  1459
!
3544a4a94a2a checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1870
diff changeset
  1460
3544a4a94a2a checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1870
diff changeset
  1461
unloadedCodeObject
3544a4a94a2a checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1870
diff changeset
  1462
    "{ Pragma: +optSpace }"
3544a4a94a2a checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1870
diff changeset
  1463
3544a4a94a2a checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1870
diff changeset
  1464
    "this method is invoked by methods which have been binary-unloaded
3544a4a94a2a checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1870
diff changeset
  1465
     For those the source info consists
3544a4a94a2a checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1870
diff changeset
  1466
     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
  1467
3544a4a94a2a checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1870
diff changeset
  1468
%{
3544a4a94a2a checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1870
diff changeset
  1469
    /*
3544a4a94a2a checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1870
diff changeset
  1470
     * for reasons too far from being explained here,
3544a4a94a2a checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1870
diff changeset
  1471
     * this MUST be a compiled method
3544a4a94a2a checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1870
diff changeset
  1472
     */
3544a4a94a2a checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1870
diff changeset
  1473
%}.
7601
57c257f1150a Fix race when accessing source
Stefan Vogel <sv@exept.de>
parents: 7457
diff changeset
  1474
    ^ InvalidCodeError
57c257f1150a Fix race when accessing source
Stefan Vogel <sv@exept.de>
parents: 7457
diff changeset
  1475
        raiseRequestWith:self
57c257f1150a Fix race when accessing source
Stefan Vogel <sv@exept.de>
parents: 7457
diff changeset
  1476
        errorString:'invalid method - unloaded'.
1873
3544a4a94a2a checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1870
diff changeset
  1477
3544a4a94a2a checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1870
diff changeset
  1478
    "Created: 4.11.1996 / 22:57:54 / cg"
3544a4a94a2a checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1870
diff changeset
  1479
    "Modified: 4.11.1996 / 22:58:28 / cg"
1
a27a279701f8 Initial revision
claus
parents:
diff changeset
  1480
! !
a27a279701f8 Initial revision
claus
parents:
diff changeset
  1481
9987
2ca75ae430c4 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 9827
diff changeset
  1482
93
e31220cb391f *** empty log message ***
claus
parents: 88
diff changeset
  1483
!Method methodsFor:'printing & storing'!
1
a27a279701f8 Initial revision
claus
parents:
diff changeset
  1484
a27a279701f8 Initial revision
claus
parents:
diff changeset
  1485
printOn:aStream
56
be0ed17e6f85 *** empty log message ***
claus
parents: 49
diff changeset
  1486
    "put a printed representation of the receiver onto aStream.
be0ed17e6f85 *** empty log message ***
claus
parents: 49
diff changeset
  1487
     Since methods do not store their class/selector, we have to search
be0ed17e6f85 *** empty log message ***
claus
parents: 49
diff changeset
  1488
     for it here."
1
a27a279701f8 Initial revision
claus
parents:
diff changeset
  1489
227
23b1c4de3402 package & cleanup
claus
parents: 216
diff changeset
  1490
    |classAndSelector m wrapped|
1
a27a279701f8 Initial revision
claus
parents:
diff changeset
  1491
253
30daee717a53 *** empty log message ***
claus
parents: 227
diff changeset
  1492
    wrapped := false.
30daee717a53 *** empty log message ***
claus
parents: 227
diff changeset
  1493
6234
d8083875f657 fixed pixmap readout for win32, where red and green are exchanged
Claus Gittinger <cg@exept.de>
parents: 6160
diff changeset
  1494
    self basicPrintOn:aStream."/ aStream nextPutAll:(self classNameWithArticle).
159
514c749165c3 *** empty log message ***
claus
parents: 142
diff changeset
  1495
    aStream nextPut:$(.
227
23b1c4de3402 package & cleanup
claus
parents: 216
diff changeset
  1496
176
48061f8659aa more queries
claus
parents: 159
diff changeset
  1497
    classAndSelector := self who.
227
23b1c4de3402 package & cleanup
claus
parents: 216
diff changeset
  1498
    classAndSelector isNil ifTrue:[
6234
d8083875f657 fixed pixmap readout for win32, where red and green are exchanged
Claus Gittinger <cg@exept.de>
parents: 6160
diff changeset
  1499
        "
d8083875f657 fixed pixmap readout for win32, where red and green are exchanged
Claus Gittinger <cg@exept.de>
parents: 6160
diff changeset
  1500
         not anchored in any class.
d8083875f657 fixed pixmap readout for win32, where red and green are exchanged
Claus Gittinger <cg@exept.de>
parents: 6160
diff changeset
  1501
         check if wrapped (to be more informative in inspectors)
d8083875f657 fixed pixmap readout for win32, where red and green are exchanged
Claus Gittinger <cg@exept.de>
parents: 6160
diff changeset
  1502
        "
d8083875f657 fixed pixmap readout for win32, where red and green are exchanged
Claus Gittinger <cg@exept.de>
parents: 6160
diff changeset
  1503
        m := self wrapper.
d8083875f657 fixed pixmap readout for win32, where red and green are exchanged
Claus Gittinger <cg@exept.de>
parents: 6160
diff changeset
  1504
        m notNil ifTrue:[
d8083875f657 fixed pixmap readout for win32, where red and green are exchanged
Claus Gittinger <cg@exept.de>
parents: 6160
diff changeset
  1505
            classAndSelector := m who.
d8083875f657 fixed pixmap readout for win32, where red and green are exchanged
Claus Gittinger <cg@exept.de>
parents: 6160
diff changeset
  1506
            wrapped := true.
d8083875f657 fixed pixmap readout for win32, where red and green are exchanged
Claus Gittinger <cg@exept.de>
parents: 6160
diff changeset
  1507
        ]
227
23b1c4de3402 package & cleanup
claus
parents: 216
diff changeset
  1508
    ].
176
48061f8659aa more queries
claus
parents: 159
diff changeset
  1509
    classAndSelector notNil ifTrue:[
6234
d8083875f657 fixed pixmap readout for win32, where red and green are exchanged
Claus Gittinger <cg@exept.de>
parents: 6160
diff changeset
  1510
        (classAndSelector methodClass) name printOn:aStream.
d8083875f657 fixed pixmap readout for win32, where red and green are exchanged
Claus Gittinger <cg@exept.de>
parents: 6160
diff changeset
  1511
        aStream nextPutAll:' '.
d8083875f657 fixed pixmap readout for win32, where red and green are exchanged
Claus Gittinger <cg@exept.de>
parents: 6160
diff changeset
  1512
        (classAndSelector methodSelector) printOn:aStream.
d8083875f657 fixed pixmap readout for win32, where red and green are exchanged
Claus Gittinger <cg@exept.de>
parents: 6160
diff changeset
  1513
        wrapped ifTrue:[
d8083875f657 fixed pixmap readout for win32, where red and green are exchanged
Claus Gittinger <cg@exept.de>
parents: 6160
diff changeset
  1514
            aStream nextPutAll:'; wrapped'
d8083875f657 fixed pixmap readout for win32, where red and green are exchanged
Claus Gittinger <cg@exept.de>
parents: 6160
diff changeset
  1515
        ].
1
a27a279701f8 Initial revision
claus
parents:
diff changeset
  1516
    ] ifFalse:[
6234
d8083875f657 fixed pixmap readout for win32, where red and green are exchanged
Claus Gittinger <cg@exept.de>
parents: 6160
diff changeset
  1517
        "
d8083875f657 fixed pixmap readout for win32, where red and green are exchanged
Claus Gittinger <cg@exept.de>
parents: 6160
diff changeset
  1518
         sorry, a method which is nowhere anchored
d8083875f657 fixed pixmap readout for win32, where red and green are exchanged
Claus Gittinger <cg@exept.de>
parents: 6160
diff changeset
  1519
        "
d8083875f657 fixed pixmap readout for win32, where red and green are exchanged
Claus Gittinger <cg@exept.de>
parents: 6160
diff changeset
  1520
        aStream nextPutAll:'unbound'
56
be0ed17e6f85 *** empty log message ***
claus
parents: 49
diff changeset
  1521
    ].
be0ed17e6f85 *** empty log message ***
claus
parents: 49
diff changeset
  1522
    aStream nextPut:$)
176
48061f8659aa more queries
claus
parents: 159
diff changeset
  1523
48061f8659aa more queries
claus
parents: 159
diff changeset
  1524
    "
253
30daee717a53 *** empty log message ***
claus
parents: 227
diff changeset
  1525
     (Object compiledMethodAt:#at:) printOn:Transcript. Transcript cr.
30daee717a53 *** empty log message ***
claus
parents: 227
diff changeset
  1526
     (Object compiledMethodAt:#at:) copy printOn:Transcript. Transcript cr.
10083
8cec9ab7373e *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10044
diff changeset
  1527
8cec9ab7373e *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10044
diff changeset
  1528
     (Object compiledMethodAt:#at:) whoString printOn:Transcript. Transcript cr.
8cec9ab7373e *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10044
diff changeset
  1529
     (Object compiledMethodAt:#at:) copy whoString printOn:Transcript. Transcript cr.
176
48061f8659aa more queries
claus
parents: 159
diff changeset
  1530
    "
1851
4accc9fafd19 change #who to return a proper object
Claus Gittinger <cg@exept.de>
parents: 1813
diff changeset
  1531
10083
8cec9ab7373e *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10044
diff changeset
  1532
    "Modified: / 12-10-2006 / 20:32:22 / 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
  1533
!
d600e08a5936 handle the case where a method has a sourceFileInfo, but the class has not
Claus Gittinger <cg@exept.de>
parents: 934
diff changeset
  1534
d600e08a5936 handle the case where a method has a sourceFileInfo, but the class has not
Claus Gittinger <cg@exept.de>
parents: 934
diff changeset
  1535
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
  1536
    "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
  1537
     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
  1538
1851
4accc9fafd19 change #who to return a proper object
Claus Gittinger <cg@exept.de>
parents: 1813
diff changeset
  1539
    |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
  1540
1851
4accc9fafd19 change #who to return a proper object
Claus Gittinger <cg@exept.de>
parents: 1813
diff changeset
  1541
    who := self who.
4accc9fafd19 change #who to return a proper object
Claus Gittinger <cg@exept.de>
parents: 1813
diff changeset
  1542
    who notNil ifTrue:[
11016
6f98b4ca31ab changed #whoString
Claus Gittinger <cg@exept.de>
parents: 10910
diff changeset
  1543
        ^ 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
  1544
    ].
6071
c10946059080 whoString can be evaluated
Claus Gittinger <cg@exept.de>
parents: 6058
diff changeset
  1545
    ^ '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
  1546
d600e08a5936 handle the case where a method has a sourceFileInfo, but the class has not
Claus Gittinger <cg@exept.de>
parents: 934
diff changeset
  1547
    "
6071
c10946059080 whoString can be evaluated
Claus Gittinger <cg@exept.de>
parents: 6058
diff changeset
  1548
     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
  1549
     (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
  1550
    "
1851
4accc9fafd19 change #who to return a proper object
Claus Gittinger <cg@exept.de>
parents: 1813
diff changeset
  1551
4accc9fafd19 change #who to return a proper object
Claus Gittinger <cg@exept.de>
parents: 1813
diff changeset
  1552
    "Modified: 1.11.1996 / 16:27:04 / cg"
1
a27a279701f8 Initial revision
claus
parents:
diff changeset
  1553
! !
a27a279701f8 Initial revision
claus
parents:
diff changeset
  1554
8141
41b25e5f7532 sourceStream access refactored (preps for utf8 decoding)
Claus Gittinger <cg@exept.de>
parents: 8117
diff changeset
  1555
!Method methodsFor:'private'!
41b25e5f7532 sourceStream access refactored (preps for utf8 decoding)
Claus Gittinger <cg@exept.de>
parents: 8117
diff changeset
  1556
41b25e5f7532 sourceStream access refactored (preps for utf8 decoding)
Claus Gittinger <cg@exept.de>
parents: 8117
diff changeset
  1557
localSourceStream
41b25e5f7532 sourceStream access refactored (preps for utf8 decoding)
Claus Gittinger <cg@exept.de>
parents: 8117
diff changeset
  1558
    "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
  1559
     searching in standard places."
41b25e5f7532 sourceStream access refactored (preps for utf8 decoding)
Claus Gittinger <cg@exept.de>
parents: 8117
diff changeset
  1560
8216
3b56b52db477 getpackageDir
ca
parents: 8169
diff changeset
  1561
    |dir fileName aStream|
8141
41b25e5f7532 sourceStream access refactored (preps for utf8 decoding)
Claus Gittinger <cg@exept.de>
parents: 8117
diff changeset
  1562
41b25e5f7532 sourceStream access refactored (preps for utf8 decoding)
Claus Gittinger <cg@exept.de>
parents: 8117
diff changeset
  1563
    package notNil ifTrue:[
8216
3b56b52db477 getpackageDir
ca
parents: 8169
diff changeset
  1564
        "/
3b56b52db477 getpackageDir
ca
parents: 8169
diff changeset
  1565
        "/ old: look in 'source/<filename>'
3b56b52db477 getpackageDir
ca
parents: 8169
diff changeset
  1566
        "/ this is still kept in order to find user-private
3b56b52db477 getpackageDir
ca
parents: 8169
diff changeset
  1567
        "/ classes in her currentDirectory.
3b56b52db477 getpackageDir
ca
parents: 8169
diff changeset
  1568
        "/
8141
41b25e5f7532 sourceStream access refactored (preps for utf8 decoding)
Claus Gittinger <cg@exept.de>
parents: 8117
diff changeset
  1569
        fileName := Smalltalk getSourceFileName:(package copyReplaceAll:$: with:$/) , '/' , source.
41b25e5f7532 sourceStream access refactored (preps for utf8 decoding)
Claus Gittinger <cg@exept.de>
parents: 8117
diff changeset
  1570
        fileName notNil ifTrue:[
41b25e5f7532 sourceStream access refactored (preps for utf8 decoding)
Claus Gittinger <cg@exept.de>
parents: 8117
diff changeset
  1571
            aStream := fileName asFilename readStreamOrNil.
41b25e5f7532 sourceStream access refactored (preps for utf8 decoding)
Claus Gittinger <cg@exept.de>
parents: 8117
diff changeset
  1572
            aStream notNil ifTrue:[^ aStream].
41b25e5f7532 sourceStream access refactored (preps for utf8 decoding)
Claus Gittinger <cg@exept.de>
parents: 8117
diff changeset
  1573
        ].
8216
3b56b52db477 getpackageDir
ca
parents: 8169
diff changeset
  1574
        "/
3b56b52db477 getpackageDir
ca
parents: 8169
diff changeset
  1575
        "/ new: look in package-dir
3b56b52db477 getpackageDir
ca
parents: 8169
diff changeset
  1576
        "/
3b56b52db477 getpackageDir
ca
parents: 8169
diff changeset
  1577
        dir := Smalltalk getPackageDirectoryForPackage:package.
3b56b52db477 getpackageDir
ca
parents: 8169
diff changeset
  1578
        dir notNil ifTrue:[
3b56b52db477 getpackageDir
ca
parents: 8169
diff changeset
  1579
            fileName := dir construct:source.
3b56b52db477 getpackageDir
ca
parents: 8169
diff changeset
  1580
            aStream := fileName asFilename readStreamOrNil.
3b56b52db477 getpackageDir
ca
parents: 8169
diff changeset
  1581
            aStream notNil ifTrue:[^ aStream].
3b56b52db477 getpackageDir
ca
parents: 8169
diff changeset
  1582
        ].
8141
41b25e5f7532 sourceStream access refactored (preps for utf8 decoding)
Claus Gittinger <cg@exept.de>
parents: 8117
diff changeset
  1583
    ].
41b25e5f7532 sourceStream access refactored (preps for utf8 decoding)
Claus Gittinger <cg@exept.de>
parents: 8117
diff changeset
  1584
    fileName := Smalltalk getSourceFileName:source.
41b25e5f7532 sourceStream access refactored (preps for utf8 decoding)
Claus Gittinger <cg@exept.de>
parents: 8117
diff changeset
  1585
    fileName notNil ifTrue:[
41b25e5f7532 sourceStream access refactored (preps for utf8 decoding)
Claus Gittinger <cg@exept.de>
parents: 8117
diff changeset
  1586
        aStream := fileName asFilename readStreamOrNil.
41b25e5f7532 sourceStream access refactored (preps for utf8 decoding)
Claus Gittinger <cg@exept.de>
parents: 8117
diff changeset
  1587
    ].
41b25e5f7532 sourceStream access refactored (preps for utf8 decoding)
Claus Gittinger <cg@exept.de>
parents: 8117
diff changeset
  1588
    ^ aStream
41b25e5f7532 sourceStream access refactored (preps for utf8 decoding)
Claus Gittinger <cg@exept.de>
parents: 8117
diff changeset
  1589
!
41b25e5f7532 sourceStream access refactored (preps for utf8 decoding)
Claus Gittinger <cg@exept.de>
parents: 8117
diff changeset
  1590
41b25e5f7532 sourceStream access refactored (preps for utf8 decoding)
Claus Gittinger <cg@exept.de>
parents: 8117
diff changeset
  1591
rawSourceStream
41b25e5f7532 sourceStream access refactored (preps for utf8 decoding)
Claus Gittinger <cg@exept.de>
parents: 8117
diff changeset
  1592
    "return an open sourceStream (needs positioning)"
41b25e5f7532 sourceStream access refactored (preps for utf8 decoding)
Claus Gittinger <cg@exept.de>
parents: 8117
diff changeset
  1593
41b25e5f7532 sourceStream access refactored (preps for utf8 decoding)
Claus Gittinger <cg@exept.de>
parents: 8117
diff changeset
  1594
    |aStream fileName who myClass mgr className classNameSymbol sep dir mod|
41b25e5f7532 sourceStream access refactored (preps for utf8 decoding)
Claus Gittinger <cg@exept.de>
parents: 8117
diff changeset
  1595
41b25e5f7532 sourceStream access refactored (preps for utf8 decoding)
Claus Gittinger <cg@exept.de>
parents: 8117
diff changeset
  1596
    "
41b25e5f7532 sourceStream access refactored (preps for utf8 decoding)
Claus Gittinger <cg@exept.de>
parents: 8117
diff changeset
  1597
     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
  1598
     abs(sourcePosition) is the offset.
41b25e5f7532 sourceStream access refactored (preps for utf8 decoding)
Claus Gittinger <cg@exept.de>
parents: 8117
diff changeset
  1599
     Otherwise, source is the real source
41b25e5f7532 sourceStream access refactored (preps for utf8 decoding)
Claus Gittinger <cg@exept.de>
parents: 8117
diff changeset
  1600
    "
41b25e5f7532 sourceStream access refactored (preps for utf8 decoding)
Claus Gittinger <cg@exept.de>
parents: 8117
diff changeset
  1601
    source isNil ifTrue:[^ nil].
41b25e5f7532 sourceStream access refactored (preps for utf8 decoding)
Claus Gittinger <cg@exept.de>
parents: 8117
diff changeset
  1602
    sourcePosition isNil ifTrue:[^ source readStream].
41b25e5f7532 sourceStream access refactored (preps for utf8 decoding)
Claus Gittinger <cg@exept.de>
parents: 8117
diff changeset
  1603
41b25e5f7532 sourceStream access refactored (preps for utf8 decoding)
Claus Gittinger <cg@exept.de>
parents: 8117
diff changeset
  1604
    "/ keep the last source file open, because open/close
41b25e5f7532 sourceStream access refactored (preps for utf8 decoding)
Claus Gittinger <cg@exept.de>
parents: 8117
diff changeset
  1605
    "/ operations maybe slow on NFS-mounted file systems.
41b25e5f7532 sourceStream access refactored (preps for utf8 decoding)
Claus Gittinger <cg@exept.de>
parents: 8117
diff changeset
  1606
    "/ Since the reference to the file is weak, it will be closed
41b25e5f7532 sourceStream access refactored (preps for utf8 decoding)
Claus Gittinger <cg@exept.de>
parents: 8117
diff changeset
  1607
    "/ automatically if the file is not referenced for a while. 
41b25e5f7532 sourceStream access refactored (preps for utf8 decoding)
Claus Gittinger <cg@exept.de>
parents: 8117
diff changeset
  1608
    "/ Neat trick.
41b25e5f7532 sourceStream access refactored (preps for utf8 decoding)
Claus Gittinger <cg@exept.de>
parents: 8117
diff changeset
  1609
41b25e5f7532 sourceStream access refactored (preps for utf8 decoding)
Claus Gittinger <cg@exept.de>
parents: 8117
diff changeset
  1610
    LastFileLock critical:[
41b25e5f7532 sourceStream access refactored (preps for utf8 decoding)
Claus Gittinger <cg@exept.de>
parents: 8117
diff changeset
  1611
        aStream := LastFileReference at:1.
41b25e5f7532 sourceStream access refactored (preps for utf8 decoding)
Claus Gittinger <cg@exept.de>
parents: 8117
diff changeset
  1612
        LastFileReference at:1 put:0.
41b25e5f7532 sourceStream access refactored (preps for utf8 decoding)
Claus Gittinger <cg@exept.de>
parents: 8117
diff changeset
  1613
11066
95bf9204e56b changed #rawSourceStream
Stefan Vogel <sv@exept.de>
parents: 11022
diff changeset
  1614
        (aStream isNil or:[aStream == 0 or:[aStream isOpen not]]) ifTrue:[
8141
41b25e5f7532 sourceStream access refactored (preps for utf8 decoding)
Claus Gittinger <cg@exept.de>
parents: 8117
diff changeset
  1615
            aStream := nil.
41b25e5f7532 sourceStream access refactored (preps for utf8 decoding)
Claus Gittinger <cg@exept.de>
parents: 8117
diff changeset
  1616
        ] ifFalse:[
41b25e5f7532 sourceStream access refactored (preps for utf8 decoding)
Claus Gittinger <cg@exept.de>
parents: 8117
diff changeset
  1617
            LastSourceFileName = source ifFalse:[
41b25e5f7532 sourceStream access refactored (preps for utf8 decoding)
Claus Gittinger <cg@exept.de>
parents: 8117
diff changeset
  1618
                aStream close.
41b25e5f7532 sourceStream access refactored (preps for utf8 decoding)
Claus Gittinger <cg@exept.de>
parents: 8117
diff changeset
  1619
                aStream := nil.
41b25e5f7532 sourceStream access refactored (preps for utf8 decoding)
Claus Gittinger <cg@exept.de>
parents: 8117
diff changeset
  1620
            ]
41b25e5f7532 sourceStream access refactored (preps for utf8 decoding)
Claus Gittinger <cg@exept.de>
parents: 8117
diff changeset
  1621
        ].
41b25e5f7532 sourceStream access refactored (preps for utf8 decoding)
Claus Gittinger <cg@exept.de>
parents: 8117
diff changeset
  1622
        LastSourceFileName := nil.
41b25e5f7532 sourceStream access refactored (preps for utf8 decoding)
Claus Gittinger <cg@exept.de>
parents: 8117
diff changeset
  1623
    ].
41b25e5f7532 sourceStream access refactored (preps for utf8 decoding)
Claus Gittinger <cg@exept.de>
parents: 8117
diff changeset
  1624
41b25e5f7532 sourceStream access refactored (preps for utf8 decoding)
Claus Gittinger <cg@exept.de>
parents: 8117
diff changeset
  1625
    aStream notNil ifTrue:[
41b25e5f7532 sourceStream access refactored (preps for utf8 decoding)
Claus Gittinger <cg@exept.de>
parents: 8117
diff changeset
  1626
        ^ aStream
41b25e5f7532 sourceStream access refactored (preps for utf8 decoding)
Claus Gittinger <cg@exept.de>
parents: 8117
diff changeset
  1627
    ].
41b25e5f7532 sourceStream access refactored (preps for utf8 decoding)
Claus Gittinger <cg@exept.de>
parents: 8117
diff changeset
  1628
41b25e5f7532 sourceStream access refactored (preps for utf8 decoding)
Claus Gittinger <cg@exept.de>
parents: 8117
diff changeset
  1629
    "/ a negative sourcePosition indicates
41b25e5f7532 sourceStream access refactored (preps for utf8 decoding)
Claus Gittinger <cg@exept.de>
parents: 8117
diff changeset
  1630
    "/ that this is a local file 
41b25e5f7532 sourceStream access refactored (preps for utf8 decoding)
Claus Gittinger <cg@exept.de>
parents: 8117
diff changeset
  1631
    "/ (not to be requested via the sourceCodeManager)
41b25e5f7532 sourceStream access refactored (preps for utf8 decoding)
Claus Gittinger <cg@exept.de>
parents: 8117
diff changeset
  1632
    "/ 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
  1633
    "/ 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
  1634
    "/ 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
  1635
41b25e5f7532 sourceStream access refactored (preps for utf8 decoding)
Claus Gittinger <cg@exept.de>
parents: 8117
diff changeset
  1636
    sourcePosition < 0 ifTrue:[
41b25e5f7532 sourceStream access refactored (preps for utf8 decoding)
Claus Gittinger <cg@exept.de>
parents: 8117
diff changeset
  1637
        aStream := source asFilename readStreamOrNil.
41b25e5f7532 sourceStream access refactored (preps for utf8 decoding)
Claus Gittinger <cg@exept.de>
parents: 8117
diff changeset
  1638
        aStream isNil ifTrue:[
41b25e5f7532 sourceStream access refactored (preps for utf8 decoding)
Claus Gittinger <cg@exept.de>
parents: 8117
diff changeset
  1639
            "/ search in some standard places
41b25e5f7532 sourceStream access refactored (preps for utf8 decoding)
Claus Gittinger <cg@exept.de>
parents: 8117
diff changeset
  1640
            fileName := Smalltalk getSourceFileName:source.
41b25e5f7532 sourceStream access refactored (preps for utf8 decoding)
Claus Gittinger <cg@exept.de>
parents: 8117
diff changeset
  1641
            fileName notNil ifTrue:[
41b25e5f7532 sourceStream access refactored (preps for utf8 decoding)
Claus Gittinger <cg@exept.de>
parents: 8117
diff changeset
  1642
                aStream := fileName asFilename readStreamOrNil.
41b25e5f7532 sourceStream access refactored (preps for utf8 decoding)
Claus Gittinger <cg@exept.de>
parents: 8117
diff changeset
  1643
            ].
41b25e5f7532 sourceStream access refactored (preps for utf8 decoding)
Claus Gittinger <cg@exept.de>
parents: 8117
diff changeset
  1644
        ].
41b25e5f7532 sourceStream access refactored (preps for utf8 decoding)
Claus Gittinger <cg@exept.de>
parents: 8117
diff changeset
  1645
        aStream notNil ifTrue:[
41b25e5f7532 sourceStream access refactored (preps for utf8 decoding)
Claus Gittinger <cg@exept.de>
parents: 8117
diff changeset
  1646
            ^ aStream
41b25e5f7532 sourceStream access refactored (preps for utf8 decoding)
Claus Gittinger <cg@exept.de>
parents: 8117
diff changeset
  1647
        ].
41b25e5f7532 sourceStream access refactored (preps for utf8 decoding)
Claus Gittinger <cg@exept.de>
parents: 8117
diff changeset
  1648
    ].
41b25e5f7532 sourceStream access refactored (preps for utf8 decoding)
Claus Gittinger <cg@exept.de>
parents: 8117
diff changeset
  1649
41b25e5f7532 sourceStream access refactored (preps for utf8 decoding)
Claus Gittinger <cg@exept.de>
parents: 8117
diff changeset
  1650
    "/
41b25e5f7532 sourceStream access refactored (preps for utf8 decoding)
Claus Gittinger <cg@exept.de>
parents: 8117
diff changeset
  1651
    "/ 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
  1652
    "/
10207
b5ca553d15ad localSourceFirst for extensions.
Claus Gittinger <cg@exept.de>
parents: 10201
diff changeset
  1653
    (Class tryLocalSourceFirst or:[(mgr := Smalltalk at:#SourceCodeManager) isNil]) ifTrue:[
8141
41b25e5f7532 sourceStream access refactored (preps for utf8 decoding)
Claus Gittinger <cg@exept.de>
parents: 8117
diff changeset
  1654
        aStream := self localSourceStream.
41b25e5f7532 sourceStream access refactored (preps for utf8 decoding)
Claus Gittinger <cg@exept.de>
parents: 8117
diff changeset
  1655
        aStream notNil ifTrue:[
41b25e5f7532 sourceStream access refactored (preps for utf8 decoding)
Claus Gittinger <cg@exept.de>
parents: 8117
diff changeset
  1656
            ^ aStream
41b25e5f7532 sourceStream access refactored (preps for utf8 decoding)
Claus Gittinger <cg@exept.de>
parents: 8117
diff changeset
  1657
        ].
41b25e5f7532 sourceStream access refactored (preps for utf8 decoding)
Claus Gittinger <cg@exept.de>
parents: 8117
diff changeset
  1658
    ].
41b25e5f7532 sourceStream access refactored (preps for utf8 decoding)
Claus Gittinger <cg@exept.de>
parents: 8117
diff changeset
  1659
41b25e5f7532 sourceStream access refactored (preps for utf8 decoding)
Claus Gittinger <cg@exept.de>
parents: 8117
diff changeset
  1660
    "/
41b25e5f7532 sourceStream access refactored (preps for utf8 decoding)
Claus Gittinger <cg@exept.de>
parents: 8117
diff changeset
  1661
    "/ 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
  1662
    "/
41b25e5f7532 sourceStream access refactored (preps for utf8 decoding)
Claus Gittinger <cg@exept.de>
parents: 8117
diff changeset
  1663
    who := self who.
41b25e5f7532 sourceStream access refactored (preps for utf8 decoding)
Claus Gittinger <cg@exept.de>
parents: 8117
diff changeset
  1664
    who notNil ifTrue:[
41b25e5f7532 sourceStream access refactored (preps for utf8 decoding)
Claus Gittinger <cg@exept.de>
parents: 8117
diff changeset
  1665
        myClass := who methodClass.
41b25e5f7532 sourceStream access refactored (preps for utf8 decoding)
Claus Gittinger <cg@exept.de>
parents: 8117
diff changeset
  1666
41b25e5f7532 sourceStream access refactored (preps for utf8 decoding)
Claus Gittinger <cg@exept.de>
parents: 8117
diff changeset
  1667
        (package notNil and:[package ~= myClass package]) ifTrue:[
41b25e5f7532 sourceStream access refactored (preps for utf8 decoding)
Claus Gittinger <cg@exept.de>
parents: 8117
diff changeset
  1668
            mgr notNil ifTrue:[
41b25e5f7532 sourceStream access refactored (preps for utf8 decoding)
Claus Gittinger <cg@exept.de>
parents: 8117
diff changeset
  1669
                "/ try to get the source using my package information ...
41b25e5f7532 sourceStream access refactored (preps for utf8 decoding)
Claus Gittinger <cg@exept.de>
parents: 8117
diff changeset
  1670
                sep := package indexOfAny:'/\:'.
41b25e5f7532 sourceStream access refactored (preps for utf8 decoding)
Claus Gittinger <cg@exept.de>
parents: 8117
diff changeset
  1671
                sep ~~ 0 ifTrue:[
41b25e5f7532 sourceStream access refactored (preps for utf8 decoding)
Claus Gittinger <cg@exept.de>
parents: 8117
diff changeset
  1672
                    mod := package copyTo:sep - 1.
41b25e5f7532 sourceStream access refactored (preps for utf8 decoding)
Claus Gittinger <cg@exept.de>
parents: 8117
diff changeset
  1673
                    dir := package copyFrom:sep + 1.
41b25e5f7532 sourceStream access refactored (preps for utf8 decoding)
Claus Gittinger <cg@exept.de>
parents: 8117
diff changeset
  1674
                    aStream := mgr streamForClass:nil fileName:source revision:nil directory:dir module:mod cache:false.
41b25e5f7532 sourceStream access refactored (preps for utf8 decoding)
Claus Gittinger <cg@exept.de>
parents: 8117
diff changeset
  1675
                    aStream notNil ifTrue:[
41b25e5f7532 sourceStream access refactored (preps for utf8 decoding)
Claus Gittinger <cg@exept.de>
parents: 8117
diff changeset
  1676
                        ^ aStream
41b25e5f7532 sourceStream access refactored (preps for utf8 decoding)
Claus Gittinger <cg@exept.de>
parents: 8117
diff changeset
  1677
                    ].
41b25e5f7532 sourceStream access refactored (preps for utf8 decoding)
Claus Gittinger <cg@exept.de>
parents: 8117
diff changeset
  1678
                ].
41b25e5f7532 sourceStream access refactored (preps for utf8 decoding)
Claus Gittinger <cg@exept.de>
parents: 8117
diff changeset
  1679
            ].
10201
f90568a94903 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10196
diff changeset
  1680
            dir := Smalltalk projectDirectoryForPackage:package.
10857
08eea654d8f1 changed #rawSourceStream
Claus Gittinger <cg@exept.de>
parents: 10759
diff changeset
  1681
            dir notNil ifTrue:[    
08eea654d8f1 changed #rawSourceStream
Claus Gittinger <cg@exept.de>
parents: 10759
diff changeset
  1682
                aStream := (dir asFilename construct:source) readStream.
08eea654d8f1 changed #rawSourceStream
Claus Gittinger <cg@exept.de>
parents: 10759
diff changeset
  1683
                aStream notNil ifTrue:[
08eea654d8f1 changed #rawSourceStream
Claus Gittinger <cg@exept.de>
parents: 10759
diff changeset
  1684
                    ^ aStream
08eea654d8f1 changed #rawSourceStream
Claus Gittinger <cg@exept.de>
parents: 10759
diff changeset
  1685
                ].
08eea654d8f1 changed #rawSourceStream
Claus Gittinger <cg@exept.de>
parents: 10759
diff changeset
  1686
            ]
8141
41b25e5f7532 sourceStream access refactored (preps for utf8 decoding)
Claus Gittinger <cg@exept.de>
parents: 8117
diff changeset
  1687
        ].
41b25e5f7532 sourceStream access refactored (preps for utf8 decoding)
Claus Gittinger <cg@exept.de>
parents: 8117
diff changeset
  1688
41b25e5f7532 sourceStream access refactored (preps for utf8 decoding)
Claus Gittinger <cg@exept.de>
parents: 8117
diff changeset
  1689
        aStream := myClass sourceStreamFor:source.
41b25e5f7532 sourceStream access refactored (preps for utf8 decoding)
Claus Gittinger <cg@exept.de>
parents: 8117
diff changeset
  1690
        aStream notNil ifTrue:[
41b25e5f7532 sourceStream access refactored (preps for utf8 decoding)
Claus Gittinger <cg@exept.de>
parents: 8117
diff changeset
  1691
            ^ aStream
41b25e5f7532 sourceStream access refactored (preps for utf8 decoding)
Claus Gittinger <cg@exept.de>
parents: 8117
diff changeset
  1692
        ].
41b25e5f7532 sourceStream access refactored (preps for utf8 decoding)
Claus Gittinger <cg@exept.de>
parents: 8117
diff changeset
  1693
    ].
41b25e5f7532 sourceStream access refactored (preps for utf8 decoding)
Claus Gittinger <cg@exept.de>
parents: 8117
diff changeset
  1694
41b25e5f7532 sourceStream access refactored (preps for utf8 decoding)
Claus Gittinger <cg@exept.de>
parents: 8117
diff changeset
  1695
    "/
41b25e5f7532 sourceStream access refactored (preps for utf8 decoding)
Claus Gittinger <cg@exept.de>
parents: 8117
diff changeset
  1696
    "/ nope - look in standard places 
41b25e5f7532 sourceStream access refactored (preps for utf8 decoding)
Claus Gittinger <cg@exept.de>
parents: 8117
diff changeset
  1697
    "/ (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
  1698
    "/
10207
b5ca553d15ad localSourceFirst for extensions.
Claus Gittinger <cg@exept.de>
parents: 10201
diff changeset
  1699
    (mgr notNil and:[Class tryLocalSourceFirst not]) ifTrue:[
8141
41b25e5f7532 sourceStream access refactored (preps for utf8 decoding)
Claus Gittinger <cg@exept.de>
parents: 8117
diff changeset
  1700
        aStream := self localSourceStream.
41b25e5f7532 sourceStream access refactored (preps for utf8 decoding)
Claus Gittinger <cg@exept.de>
parents: 8117
diff changeset
  1701
        aStream notNil ifTrue:[
41b25e5f7532 sourceStream access refactored (preps for utf8 decoding)
Claus Gittinger <cg@exept.de>
parents: 8117
diff changeset
  1702
            ^ aStream
41b25e5f7532 sourceStream access refactored (preps for utf8 decoding)
Claus Gittinger <cg@exept.de>
parents: 8117
diff changeset
  1703
        ].
41b25e5f7532 sourceStream access refactored (preps for utf8 decoding)
Claus Gittinger <cg@exept.de>
parents: 8117
diff changeset
  1704
    ].
41b25e5f7532 sourceStream access refactored (preps for utf8 decoding)
Claus Gittinger <cg@exept.de>
parents: 8117
diff changeset
  1705
41b25e5f7532 sourceStream access refactored (preps for utf8 decoding)
Claus Gittinger <cg@exept.de>
parents: 8117
diff changeset
  1706
    "/
41b25e5f7532 sourceStream access refactored (preps for utf8 decoding)
Claus Gittinger <cg@exept.de>
parents: 8117
diff changeset
  1707
    "/ final chance: try current directory
41b25e5f7532 sourceStream access refactored (preps for utf8 decoding)
Claus Gittinger <cg@exept.de>
parents: 8117
diff changeset
  1708
    "/
41b25e5f7532 sourceStream access refactored (preps for utf8 decoding)
Claus Gittinger <cg@exept.de>
parents: 8117
diff changeset
  1709
    aStream isNil ifTrue:[
41b25e5f7532 sourceStream access refactored (preps for utf8 decoding)
Claus Gittinger <cg@exept.de>
parents: 8117
diff changeset
  1710
        aStream := source asFilename readStreamOrNil.
41b25e5f7532 sourceStream access refactored (preps for utf8 decoding)
Claus Gittinger <cg@exept.de>
parents: 8117
diff changeset
  1711
        aStream notNil ifTrue:[
41b25e5f7532 sourceStream access refactored (preps for utf8 decoding)
Claus Gittinger <cg@exept.de>
parents: 8117
diff changeset
  1712
            ^ aStream
41b25e5f7532 sourceStream access refactored (preps for utf8 decoding)
Claus Gittinger <cg@exept.de>
parents: 8117
diff changeset
  1713
        ].
41b25e5f7532 sourceStream access refactored (preps for utf8 decoding)
Claus Gittinger <cg@exept.de>
parents: 8117
diff changeset
  1714
    ].
41b25e5f7532 sourceStream access refactored (preps for utf8 decoding)
Claus Gittinger <cg@exept.de>
parents: 8117
diff changeset
  1715
41b25e5f7532 sourceStream access refactored (preps for utf8 decoding)
Claus Gittinger <cg@exept.de>
parents: 8117
diff changeset
  1716
    (who isNil and:[source notNil]) ifTrue:[
41b25e5f7532 sourceStream access refactored (preps for utf8 decoding)
Claus Gittinger <cg@exept.de>
parents: 8117
diff changeset
  1717
        "/
41b25e5f7532 sourceStream access refactored (preps for utf8 decoding)
Claus Gittinger <cg@exept.de>
parents: 8117
diff changeset
  1718
        "/ mhmh - seems to be a method which used to be in some
41b25e5f7532 sourceStream access refactored (preps for utf8 decoding)
Claus Gittinger <cg@exept.de>
parents: 8117
diff changeset
  1719
        "/ class, but has been overwritten by another or removed.
41b25e5f7532 sourceStream access refactored (preps for utf8 decoding)
Claus Gittinger <cg@exept.de>
parents: 8117
diff changeset
  1720
        "/ (i.e. it has no containing class anyMore)
41b25e5f7532 sourceStream access refactored (preps for utf8 decoding)
Claus Gittinger <cg@exept.de>
parents: 8117
diff changeset
  1721
        "/ try to guess the class from the sourceFileName.
41b25e5f7532 sourceStream access refactored (preps for utf8 decoding)
Claus Gittinger <cg@exept.de>
parents: 8117
diff changeset
  1722
        "/ and retry.
41b25e5f7532 sourceStream access refactored (preps for utf8 decoding)
Claus Gittinger <cg@exept.de>
parents: 8117
diff changeset
  1723
        "/
41b25e5f7532 sourceStream access refactored (preps for utf8 decoding)
Claus Gittinger <cg@exept.de>
parents: 8117
diff changeset
  1724
        className := Smalltalk classNameForFile:source.
41b25e5f7532 sourceStream access refactored (preps for utf8 decoding)
Claus Gittinger <cg@exept.de>
parents: 8117
diff changeset
  1725
        (classNameSymbol := className asSymbolIfInterned) notNil ifTrue:[
41b25e5f7532 sourceStream access refactored (preps for utf8 decoding)
Claus Gittinger <cg@exept.de>
parents: 8117
diff changeset
  1726
            myClass := Smalltalk at:classNameSymbol ifAbsent:nil.
41b25e5f7532 sourceStream access refactored (preps for utf8 decoding)
Claus Gittinger <cg@exept.de>
parents: 8117
diff changeset
  1727
            myClass notNil ifTrue:[
41b25e5f7532 sourceStream access refactored (preps for utf8 decoding)
Claus Gittinger <cg@exept.de>
parents: 8117
diff changeset
  1728
                aStream := myClass sourceStreamFor:source.
41b25e5f7532 sourceStream access refactored (preps for utf8 decoding)
Claus Gittinger <cg@exept.de>
parents: 8117
diff changeset
  1729
                aStream notNil ifTrue:[
41b25e5f7532 sourceStream access refactored (preps for utf8 decoding)
Claus Gittinger <cg@exept.de>
parents: 8117
diff changeset
  1730
                    ^ aStream
41b25e5f7532 sourceStream access refactored (preps for utf8 decoding)
Claus Gittinger <cg@exept.de>
parents: 8117
diff changeset
  1731
                ].
41b25e5f7532 sourceStream access refactored (preps for utf8 decoding)
Claus Gittinger <cg@exept.de>
parents: 8117
diff changeset
  1732
            ]
41b25e5f7532 sourceStream access refactored (preps for utf8 decoding)
Claus Gittinger <cg@exept.de>
parents: 8117
diff changeset
  1733
        ]
41b25e5f7532 sourceStream access refactored (preps for utf8 decoding)
Claus Gittinger <cg@exept.de>
parents: 8117
diff changeset
  1734
    ].                
41b25e5f7532 sourceStream access refactored (preps for utf8 decoding)
Claus Gittinger <cg@exept.de>
parents: 8117
diff changeset
  1735
41b25e5f7532 sourceStream access refactored (preps for utf8 decoding)
Claus Gittinger <cg@exept.de>
parents: 8117
diff changeset
  1736
    ^ nil
10201
f90568a94903 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10196
diff changeset
  1737
f90568a94903 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 10196
diff changeset
  1738
    "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
  1739
!
41b25e5f7532 sourceStream access refactored (preps for utf8 decoding)
Claus Gittinger <cg@exept.de>
parents: 8117
diff changeset
  1740
41b25e5f7532 sourceStream access refactored (preps for utf8 decoding)
Claus Gittinger <cg@exept.de>
parents: 8117
diff changeset
  1741
sourceChunkFromStream:aStream
10673
05229646ecd7 #source - handle DecodingError when fetching the method's source
Stefan Vogel <sv@exept.de>
parents: 10608
diff changeset
  1742
    PositionError handle:[:ex |
8141
41b25e5f7532 sourceStream access refactored (preps for utf8 decoding)
Claus Gittinger <cg@exept.de>
parents: 8117
diff changeset
  1743
        ^ nil
41b25e5f7532 sourceStream access refactored (preps for utf8 decoding)
Claus Gittinger <cg@exept.de>
parents: 8117
diff changeset
  1744
    ] do:[
41b25e5f7532 sourceStream access refactored (preps for utf8 decoding)
Claus Gittinger <cg@exept.de>
parents: 8117
diff changeset
  1745
        aStream position1Based:sourcePosition abs.
41b25e5f7532 sourceStream access refactored (preps for utf8 decoding)
Claus Gittinger <cg@exept.de>
parents: 8117
diff changeset
  1746
    ].
41b25e5f7532 sourceStream access refactored (preps for utf8 decoding)
Claus Gittinger <cg@exept.de>
parents: 8117
diff changeset
  1747
    ^ aStream nextChunk.
41b25e5f7532 sourceStream access refactored (preps for utf8 decoding)
Claus Gittinger <cg@exept.de>
parents: 8117
diff changeset
  1748
!
41b25e5f7532 sourceStream access refactored (preps for utf8 decoding)
Claus Gittinger <cg@exept.de>
parents: 8117
diff changeset
  1749
41b25e5f7532 sourceStream access refactored (preps for utf8 decoding)
Claus Gittinger <cg@exept.de>
parents: 8117
diff changeset
  1750
sourceStream
41b25e5f7532 sourceStream access refactored (preps for utf8 decoding)
Claus Gittinger <cg@exept.de>
parents: 8117
diff changeset
  1751
    "return an open sourceStream (needs positioning)"
41b25e5f7532 sourceStream access refactored (preps for utf8 decoding)
Claus Gittinger <cg@exept.de>
parents: 8117
diff changeset
  1752
8169
354b025a08f9 encoding stuff
Claus Gittinger <cg@exept.de>
parents: 8162
diff changeset
  1753
    |stream encoding encoder rawStream|
8162
ae2572f8a468 closing of cached LastStream
ca
parents: 8149
diff changeset
  1754
ae2572f8a468 closing of cached LastStream
ca
parents: 8149
diff changeset
  1755
    rawStream := stream := self rawSourceStream.
8141
41b25e5f7532 sourceStream access refactored (preps for utf8 decoding)
Claus Gittinger <cg@exept.de>
parents: 8117
diff changeset
  1756
    stream notNil ifTrue:[
8149
c0b336aacec6 utf8-check
Claus Gittinger <cg@exept.de>
parents: 8146
diff changeset
  1757
        "/ see if its utf8 encoded...
8711
c5f28b4c719d guessEncoding now implemented in CharacterEncoder
Claus Gittinger <cg@exept.de>
parents: 8526
diff changeset
  1758
        encoding := CharacterEncoder guessEncodingOfStream:stream.
10608
82b1346f3e8d Use similar code when accessing method and class source code
Stefan Vogel <sv@exept.de>
parents: 10482
diff changeset
  1759
        (encoding notNil and:[encoding ~~ #'iso8859-1' and:[encoding ~~ #'ascii']]) ifTrue:[
82b1346f3e8d Use similar code when accessing method and class source code
Stefan Vogel <sv@exept.de>
parents: 10482
diff changeset
  1760
            encoder := CharacterEncoder encoderFor:encoding ifAbsent:nil.
82b1346f3e8d Use similar code when accessing method and class source code
Stefan Vogel <sv@exept.de>
parents: 10482
diff changeset
  1761
            (encoder notNil and:[encoder isNullEncoder not]) ifTrue:[
82b1346f3e8d Use similar code when accessing method and class source code
Stefan Vogel <sv@exept.de>
parents: 10482
diff changeset
  1762
                stream := EncodedStream stream:stream encoder:encoder.
82b1346f3e8d Use similar code when accessing method and class source code
Stefan Vogel <sv@exept.de>
parents: 10482
diff changeset
  1763
            ].
8149
c0b336aacec6 utf8-check
Claus Gittinger <cg@exept.de>
parents: 8146
diff changeset
  1764
        ].
8169
354b025a08f9 encoding stuff
Claus Gittinger <cg@exept.de>
parents: 8162
diff changeset
  1765
        LastSourceFileName := source.
354b025a08f9 encoding stuff
Claus Gittinger <cg@exept.de>
parents: 8162
diff changeset
  1766
        LastFileReference at:1 put:rawStream.
8141
41b25e5f7532 sourceStream access refactored (preps for utf8 decoding)
Claus Gittinger <cg@exept.de>
parents: 8117
diff changeset
  1767
    ].
41b25e5f7532 sourceStream access refactored (preps for utf8 decoding)
Claus Gittinger <cg@exept.de>
parents: 8117
diff changeset
  1768
    ^ stream
41b25e5f7532 sourceStream access refactored (preps for utf8 decoding)
Claus Gittinger <cg@exept.de>
parents: 8117
diff changeset
  1769
! !
41b25e5f7532 sourceStream access refactored (preps for utf8 decoding)
Claus Gittinger <cg@exept.de>
parents: 8117
diff changeset
  1770
1093
1e742016eea0 category rename / added access to RESOURCE and CALLED flags
Claus Gittinger <cg@exept.de>
parents: 1087
diff changeset
  1771
!Method methodsFor:'private-compiler interface'!
1e742016eea0 category rename / added access to RESOURCE and CALLED flags
Claus Gittinger <cg@exept.de>
parents: 1087
diff changeset
  1772
5405
f07c8045ab4e *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5398
diff changeset
  1773
primitiveNumber
f07c8045ab4e *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5398
diff changeset
  1774
    "for stx rel >= 5.x only:
f07c8045ab4e *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5398
diff changeset
  1775
     return the primitive number."
f07c8045ab4e *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5398
diff changeset
  1776
f07c8045ab4e *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5398
diff changeset
  1777
%{  /* NOCONTEXT */
f07c8045ab4e *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5398
diff changeset
  1778
f07c8045ab4e *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5398
diff changeset
  1779
#ifdef F_PRIMITIVE
f07c8045ab4e *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5398
diff changeset
  1780
    INT f = __intVal(__INST(flags));
6014
14acbd7c25d4 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6006
diff changeset
  1781
    OBJ nr = 0;
5405
f07c8045ab4e *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5398
diff changeset
  1782
f07c8045ab4e *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5398
diff changeset
  1783
    if (f & F_PRIMITIVE) {
10207
b5ca553d15ad localSourceFirst for extensions.
Claus Gittinger <cg@exept.de>
parents: 10201
diff changeset
  1784
        nr = __INST(code_);
5405
f07c8045ab4e *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5398
diff changeset
  1785
    }
f07c8045ab4e *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5398
diff changeset
  1786
    RETURN (nr);
f07c8045ab4e *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5398
diff changeset
  1787
#endif
f07c8045ab4e *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5398
diff changeset
  1788
%}.
f07c8045ab4e *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5398
diff changeset
  1789
    self primitiveFailed
f07c8045ab4e *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5398
diff changeset
  1790
!
f07c8045ab4e *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5398
diff changeset
  1791
f07c8045ab4e *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5398
diff changeset
  1792
setPrimitiveNumber:aNumber
f07c8045ab4e *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5398
diff changeset
  1793
    "for stx rel >= 5.x only:
f07c8045ab4e *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5398
diff changeset
  1794
     mark the method as having primitive code."
f07c8045ab4e *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5398
diff changeset
  1795
f07c8045ab4e *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5398
diff changeset
  1796
%{  /* NOCONTEXT */
f07c8045ab4e *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5398
diff changeset
  1797
f07c8045ab4e *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5398
diff changeset
  1798
#ifdef F_PRIMITIVE
f07c8045ab4e *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5398
diff changeset
  1799
    INT f = __intVal(__INST(flags));
f07c8045ab4e *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5398
diff changeset
  1800
f07c8045ab4e *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5398
diff changeset
  1801
    f |= F_PRIMITIVE;
8913
b9498d27a554 64bit; mkSmallInteger
Claus Gittinger <cg@exept.de>
parents: 8896
diff changeset
  1802
    __INST(flags) = __mkSmallInteger(f);
5405
f07c8045ab4e *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5398
diff changeset
  1803
    __INST(code_) = aNumber;
f07c8045ab4e *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5398
diff changeset
  1804
    RETURN (self);
f07c8045ab4e *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5398
diff changeset
  1805
#endif
f07c8045ab4e *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5398
diff changeset
  1806
%}.
f07c8045ab4e *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5398
diff changeset
  1807
    self primitiveFailed
f07c8045ab4e *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5398
diff changeset
  1808
f07c8045ab4e *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5398
diff changeset
  1809
f07c8045ab4e *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5398
diff changeset
  1810
f07c8045ab4e *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5398
diff changeset
  1811
!
f07c8045ab4e *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5398
diff changeset
  1812
1093
1e742016eea0 category rename / added access to RESOURCE and CALLED flags
Claus Gittinger <cg@exept.de>
parents: 1087
diff changeset
  1813
setResourceFlag
1e742016eea0 category rename / added access to RESOURCE and CALLED flags
Claus Gittinger <cg@exept.de>
parents: 1087
diff changeset
  1814
    "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
  1815
     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
  1816
1e742016eea0 category rename / added access to RESOURCE and CALLED flags
Claus Gittinger <cg@exept.de>
parents: 1087
diff changeset
  1817
%{  /* NOCONTEXT */
1e742016eea0 category rename / added access to RESOURCE and CALLED flags
Claus Gittinger <cg@exept.de>
parents: 1087
diff changeset
  1818
1e742016eea0 category rename / added access to RESOURCE and CALLED flags
Claus Gittinger <cg@exept.de>
parents: 1087
diff changeset
  1819
#ifdef F_RESOURCE
2868
772c890f907c alpha64
Claus Gittinger <cg@exept.de>
parents: 2826
diff changeset
  1820
    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
  1821
1e742016eea0 category rename / added access to RESOURCE and CALLED flags
Claus Gittinger <cg@exept.de>
parents: 1087
diff changeset
  1822
    f |= F_RESOURCE;
8913
b9498d27a554 64bit; mkSmallInteger
Claus Gittinger <cg@exept.de>
parents: 8896
diff changeset
  1823
    __INST(flags) = __mkSmallInteger(f);
1093
1e742016eea0 category rename / added access to RESOURCE and CALLED flags
Claus Gittinger <cg@exept.de>
parents: 1087
diff changeset
  1824
#endif
1e742016eea0 category rename / added access to RESOURCE and CALLED flags
Claus Gittinger <cg@exept.de>
parents: 1087
diff changeset
  1825
%}
1e742016eea0 category rename / added access to RESOURCE and CALLED flags
Claus Gittinger <cg@exept.de>
parents: 1087
diff changeset
  1826
! !
1e742016eea0 category rename / added access to RESOURCE and CALLED flags
Claus Gittinger <cg@exept.de>
parents: 1087
diff changeset
  1827
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
!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
  1829
2702
5d6f23d8ee18 more ST80 queries
Claus Gittinger <cg@exept.de>
parents: 2695
diff changeset
  1830
accessedInstVars
5d6f23d8ee18 more ST80 queries
Claus Gittinger <cg@exept.de>
parents: 2695
diff changeset
  1831
    "return a collection of instVarNames, which are accessed by
5d6f23d8ee18 more ST80 queries
Claus Gittinger <cg@exept.de>
parents: 2695
diff changeset
  1832
     the receiver method"
5d6f23d8ee18 more ST80 queries
Claus Gittinger <cg@exept.de>
parents: 2695
diff changeset
  1833
5d6f23d8ee18 more ST80 queries
Claus Gittinger <cg@exept.de>
parents: 2695
diff changeset
  1834
    |src parser|
5d6f23d8ee18 more ST80 queries
Claus Gittinger <cg@exept.de>
parents: 2695
diff changeset
  1835
5d6f23d8ee18 more ST80 queries
Claus Gittinger <cg@exept.de>
parents: 2695
diff changeset
  1836
    src := self source.
5d6f23d8ee18 more ST80 queries
Claus Gittinger <cg@exept.de>
parents: 2695
diff changeset
  1837
    src notNil ifTrue:[
10207
b5ca553d15ad localSourceFirst for extensions.
Claus Gittinger <cg@exept.de>
parents: 10201
diff changeset
  1838
        parser := Parser
b5ca553d15ad localSourceFirst for extensions.
Claus Gittinger <cg@exept.de>
parents: 10201
diff changeset
  1839
                        parseMethod:src 
b5ca553d15ad localSourceFirst for extensions.
Claus Gittinger <cg@exept.de>
parents: 10201
diff changeset
  1840
                        in:self containingClass 
b5ca553d15ad localSourceFirst for extensions.
Claus Gittinger <cg@exept.de>
parents: 10201
diff changeset
  1841
                        ignoreErrors:true 
b5ca553d15ad localSourceFirst for extensions.
Claus Gittinger <cg@exept.de>
parents: 10201
diff changeset
  1842
                        ignoreWarnings:true.
b5ca553d15ad localSourceFirst for extensions.
Claus Gittinger <cg@exept.de>
parents: 10201
diff changeset
  1843
b5ca553d15ad localSourceFirst for extensions.
Claus Gittinger <cg@exept.de>
parents: 10201
diff changeset
  1844
        (parser notNil and:[parser ~~ #Error]) ifTrue:[
b5ca553d15ad localSourceFirst for extensions.
Claus Gittinger <cg@exept.de>
parents: 10201
diff changeset
  1845
            ^ parser usedInstVars
b5ca553d15ad localSourceFirst for extensions.
Claus Gittinger <cg@exept.de>
parents: 10201
diff changeset
  1846
        ].
2702
5d6f23d8ee18 more ST80 queries
Claus Gittinger <cg@exept.de>
parents: 2695
diff changeset
  1847
    ].
5d6f23d8ee18 more ST80 queries
Claus Gittinger <cg@exept.de>
parents: 2695
diff changeset
  1848
    ^ #() "/ actually: unknown
5d6f23d8ee18 more ST80 queries
Claus Gittinger <cg@exept.de>
parents: 2695
diff changeset
  1849
5d6f23d8ee18 more ST80 queries
Claus Gittinger <cg@exept.de>
parents: 2695
diff changeset
  1850
    "Modified: 19.6.1997 / 17:54:09 / cg"
5d6f23d8ee18 more ST80 queries
Claus Gittinger <cg@exept.de>
parents: 2695
diff changeset
  1851
!
5d6f23d8ee18 more ST80 queries
Claus Gittinger <cg@exept.de>
parents: 2695
diff changeset
  1852
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
  1853
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
  1854
    "return the class I am defined 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
  1855
     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
  1856
d600e08a5936 handle the case where a method has a sourceFileInfo, but the class has not
Claus Gittinger <cg@exept.de>
parents: 934
diff changeset
  1857
    "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
  1858
1851
4accc9fafd19 change #who to return a proper object
Claus Gittinger <cg@exept.de>
parents: 1813
diff changeset
  1859
    |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
  1860
5704
aeeece3a93ef flush mclass, if no longer valid
Claus Gittinger <cg@exept.de>
parents: 5700
diff changeset
  1861
    mclass notNil ifTrue:[
aeeece3a93ef flush mclass, if no longer valid
Claus Gittinger <cg@exept.de>
parents: 5700
diff changeset
  1862
        "/ check if this (cached) info is still valid ...
5894
ed6193fa6040 Define #isObsolete and fix various comments
Stefan Vogel <sv@exept.de>
parents: 5818
diff changeset
  1863
        (mclass containsMethod:self) ifTrue:[
ed6193fa6040 Define #isObsolete and fix various comments
Stefan Vogel <sv@exept.de>
parents: 5818
diff changeset
  1864
            ^ mclass
5704
aeeece3a93ef flush mclass, if no longer valid
Claus Gittinger <cg@exept.de>
parents: 5700
diff changeset
  1865
        ].
5894
ed6193fa6040 Define #isObsolete and fix various comments
Stefan Vogel <sv@exept.de>
parents: 5818
diff changeset
  1866
        mclass := nil.
5704
aeeece3a93ef flush mclass, if no longer valid
Claus Gittinger <cg@exept.de>
parents: 5700
diff changeset
  1867
    ].
5324
5c9959ce98af make use of mclass
Claus Gittinger <cg@exept.de>
parents: 5322
diff changeset
  1868
1851
4accc9fafd19 change #who to return a proper object
Claus Gittinger <cg@exept.de>
parents: 1813
diff changeset
  1869
    who := self who.
4accc9fafd19 change #who to return a proper object
Claus Gittinger <cg@exept.de>
parents: 1813
diff changeset
  1870
    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
  1871
    "
d600e08a5936 handle the case where a method has a sourceFileInfo, but the class has not
Claus Gittinger <cg@exept.de>
parents: 934
diff changeset
  1872
     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
  1873
    "
d600e08a5936 handle the case where a method has a sourceFileInfo, but the class has not
Claus Gittinger <cg@exept.de>
parents: 934
diff changeset
  1874
    ^ 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
  1875
d600e08a5936 handle the case where a method has a sourceFileInfo, but the class has not
Claus Gittinger <cg@exept.de>
parents: 934
diff changeset
  1876
    "
5894
ed6193fa6040 Define #isObsolete and fix various comments
Stefan Vogel <sv@exept.de>
parents: 5818
diff changeset
  1877
     (Object compiledMethodAt:#at:) containingClass   
ed6193fa6040 Define #isObsolete and fix various comments
Stefan Vogel <sv@exept.de>
parents: 5818
diff changeset
  1878
ed6193fa6040 Define #isObsolete and fix various comments
Stefan Vogel <sv@exept.de>
parents: 5818
diff changeset
  1879
     (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
  1880
    "
d600e08a5936 handle the case where a method has a sourceFileInfo, but the class has not
Claus Gittinger <cg@exept.de>
parents: 934
diff changeset
  1881
!
d600e08a5936 handle the case where a method has a sourceFileInfo, but the class has not
Claus Gittinger <cg@exept.de>
parents: 934
diff changeset
  1882
10482
11b634beb199 +ole queries
fm
parents: 10375
diff changeset
  1883
externalLibraryFunction
11b634beb199 +ole queries
fm
parents: 10375
diff changeset
  1884
    "if this is an externalLibraryFunction call, return the externalLibraryFunction.
11b634beb199 +ole queries
fm
parents: 10375
diff changeset
  1885
     Returns nil otherwise."
11b634beb199 +ole queries
fm
parents: 10375
diff changeset
  1886
11b634beb199 +ole queries
fm
parents: 10375
diff changeset
  1887
    ^ self literalsDetect:[:lit | lit isExternalLibraryFunction] ifNone:nil
11b634beb199 +ole queries
fm
parents: 10375
diff changeset
  1888
!
11b634beb199 +ole queries
fm
parents: 10375
diff changeset
  1889
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
  1890
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
  1891
    "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
  1892
     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
  1893
d600e08a5936 handle the case where a method has a sourceFileInfo, but the class has not
Claus Gittinger <cg@exept.de>
parents: 934
diff changeset
  1894
    |src|
159
514c749165c3 *** empty log message ***
claus
parents: 142
diff changeset
  1895
2218
93c4cb83372a comment
Claus Gittinger <cg@exept.de>
parents: 2201
diff changeset
  1896
    "/ first a trivial reject, if the source does not
5534
bf00d9a2dfd5 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5530
diff changeset
  1897
    "/ contain a '% {' sequence
2218
93c4cb83372a comment
Claus Gittinger <cg@exept.de>
parents: 2201
diff changeset
  1898
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
  1899
    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
  1900
    src notNil ifTrue:[
10207
b5ca553d15ad localSourceFirst for extensions.
Claus Gittinger <cg@exept.de>
parents: 10201
diff changeset
  1901
        (src includesString:(String with:$% with:${) "<- no constant here - to avoid trouble with stupid scanners" ) ifFalse:[
b5ca553d15ad localSourceFirst for extensions.
Claus Gittinger <cg@exept.de>
parents: 10201
diff changeset
  1902
            "/ cannot contain primitive code.
b5ca553d15ad localSourceFirst for extensions.
Claus Gittinger <cg@exept.de>
parents: 10201
diff changeset
  1903
            ^ false
b5ca553d15ad localSourceFirst for extensions.
Claus Gittinger <cg@exept.de>
parents: 10201
diff changeset
  1904
        ]
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
  1905
    ].
2218
93c4cb83372a comment
Claus Gittinger <cg@exept.de>
parents: 2201
diff changeset
  1906
93c4cb83372a comment
Claus Gittinger <cg@exept.de>
parents: 2201
diff changeset
  1907
    "/ ok; it may or may not ...
93c4cb83372a comment
Claus Gittinger <cg@exept.de>
parents: 2201
diff changeset
  1908
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
  1909
    ^ 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
  1910
d600e08a5936 handle the case where a method has a sourceFileInfo, but the class has not
Claus Gittinger <cg@exept.de>
parents: 934
diff changeset
  1911
    "
d600e08a5936 handle the case where a method has a sourceFileInfo, but the class has not
Claus Gittinger <cg@exept.de>
parents: 934
diff changeset
  1912
     (Method compiledMethodAt:#hasPrimitiveCode) 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
  1913
     (Object compiledMethodAt:#at:) 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
  1914
     (Object compiledMethodAt:#basicAt:) 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
  1915
    "
159
514c749165c3 *** empty log message ***
claus
parents: 142
diff changeset
  1916
2218
93c4cb83372a comment
Claus Gittinger <cg@exept.de>
parents: 2201
diff changeset
  1917
    "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
  1918
!
d600e08a5936 handle the case where a method has a sourceFileInfo, but the class has not
Claus Gittinger <cg@exept.de>
parents: 934
diff changeset
  1919
1093
1e742016eea0 category rename / added access to RESOURCE and CALLED flags
Claus Gittinger <cg@exept.de>
parents: 1087
diff changeset
  1920
hasResource
1e742016eea0 category rename / added access to RESOURCE and CALLED flags
Claus Gittinger <cg@exept.de>
parents: 1087
diff changeset
  1921
    "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
  1922
     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
  1923
1e742016eea0 category rename / added access to RESOURCE and CALLED flags
Claus Gittinger <cg@exept.de>
parents: 1087
diff changeset
  1924
%{  /* NOCONTEXT */
1e742016eea0 category rename / added access to RESOURCE and CALLED flags
Claus Gittinger <cg@exept.de>
parents: 1087
diff changeset
  1925
1e742016eea0 category rename / added access to RESOURCE and CALLED flags
Claus Gittinger <cg@exept.de>
parents: 1087
diff changeset
  1926
#ifdef F_RESOURCE
1133
961f2b095c22 underline cleanup
Claus Gittinger <cg@exept.de>
parents: 1103
diff changeset
  1927
    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
  1928
#endif
1e742016eea0 category rename / added access to RESOURCE and CALLED flags
Claus Gittinger <cg@exept.de>
parents: 1087
diff changeset
  1929
%}.
1e742016eea0 category rename / added access to RESOURCE and CALLED flags
Claus Gittinger <cg@exept.de>
parents: 1087
diff changeset
  1930
    ^ false
1e742016eea0 category rename / added access to RESOURCE and CALLED flags
Claus Gittinger <cg@exept.de>
parents: 1087
diff changeset
  1931
!
1e742016eea0 category rename / added access to RESOURCE and CALLED flags
Claus Gittinger <cg@exept.de>
parents: 1087
diff changeset
  1932
2694
46ba8cbdc013 added #homeMethod for ST80 compatibility
Claus Gittinger <cg@exept.de>
parents: 2558
diff changeset
  1933
homeMethod
46ba8cbdc013 added #homeMethod for ST80 compatibility
Claus Gittinger <cg@exept.de>
parents: 2558
diff changeset
  1934
    "for common protocol with blocks: if the receiver is a method,
46ba8cbdc013 added #homeMethod for ST80 compatibility
Claus Gittinger <cg@exept.de>
parents: 2558
diff changeset
  1935
     return the receiver; otherwise, if its a block, return its home
46ba8cbdc013 added #homeMethod for ST80 compatibility
Claus Gittinger <cg@exept.de>
parents: 2558
diff changeset
  1936
     method."
46ba8cbdc013 added #homeMethod for ST80 compatibility
Claus Gittinger <cg@exept.de>
parents: 2558
diff changeset
  1937
46ba8cbdc013 added #homeMethod for ST80 compatibility
Claus Gittinger <cg@exept.de>
parents: 2558
diff changeset
  1938
    ^ self
46ba8cbdc013 added #homeMethod for ST80 compatibility
Claus Gittinger <cg@exept.de>
parents: 2558
diff changeset
  1939
46ba8cbdc013 added #homeMethod for ST80 compatibility
Claus Gittinger <cg@exept.de>
parents: 2558
diff changeset
  1940
    "Created: 19.6.1997 / 16:13:12 / cg"
46ba8cbdc013 added #homeMethod for ST80 compatibility
Claus Gittinger <cg@exept.de>
parents: 2558
diff changeset
  1941
!
46ba8cbdc013 added #homeMethod for ST80 compatibility
Claus Gittinger <cg@exept.de>
parents: 2558
diff changeset
  1942
10482
11b634beb199 +ole queries
fm
parents: 10375
diff changeset
  1943
indexOfOLECall
11b634beb199 +ole queries
fm
parents: 10375
diff changeset
  1944
    "return true, if the method contains ole call; false if not.
11b634beb199 +ole queries
fm
parents: 10375
diff changeset
  1945
     Uses Parser to parse methods source and get the information."
11b634beb199 +ole queries
fm
parents: 10375
diff changeset
  1946
11b634beb199 +ole queries
fm
parents: 10375
diff changeset
  1947
    |funcOrNil|
11b634beb199 +ole queries
fm
parents: 10375
diff changeset
  1948
11b634beb199 +ole queries
fm
parents: 10375
diff changeset
  1949
    funcOrNil := self externalLibraryFunction.
11b634beb199 +ole queries
fm
parents: 10375
diff changeset
  1950
    (funcOrNil isNil or:[funcOrNil isCallTypeOLE not]) ifTrue:[^ nil].
11b634beb199 +ole queries
fm
parents: 10375
diff changeset
  1951
    ^ funcOrNil vtableIndex
11b634beb199 +ole queries
fm
parents: 10375
diff changeset
  1952
11b634beb199 +ole queries
fm
parents: 10375
diff changeset
  1953
    "
11b634beb199 +ole queries
fm
parents: 10375
diff changeset
  1954
     (Method compiledMethodAt:#hasPrimitiveCode) isOLECall  
11b634beb199 +ole queries
fm
parents: 10375
diff changeset
  1955
     (Method compiledMethodAt:#hasPrimitiveCode) indexOfOLECall 
11b634beb199 +ole queries
fm
parents: 10375
diff changeset
  1956
11b634beb199 +ole queries
fm
parents: 10375
diff changeset
  1957
     (Win32OperatingSystem class compiledMethodAt:#primClosePrinter:) isOLECall    
11b634beb199 +ole queries
fm
parents: 10375
diff changeset
  1958
     (Win32OperatingSystem class compiledMethodAt:#primClosePrinter:) indexOfOLECall    
11b634beb199 +ole queries
fm
parents: 10375
diff changeset
  1959
     (Win32OperatingSystem class compiledMethodAt:#primClosePrinter:) isExternalLibraryFunctionCall    
11b634beb199 +ole queries
fm
parents: 10375
diff changeset
  1960
     (Win32OperatingSystem class compiledMethodAt:#primClosePrinter:) externalLibraryFunctionCall    
11b634beb199 +ole queries
fm
parents: 10375
diff changeset
  1961
11b634beb199 +ole queries
fm
parents: 10375
diff changeset
  1962
     (IUnknownPointer compiledMethodAt:#invokeAddRef) isExternalLibraryFunctionCall    
11b634beb199 +ole queries
fm
parents: 10375
diff changeset
  1963
     (IUnknownPointer compiledMethodAt:#invokeAddRef) externalLibraryFunction    
11b634beb199 +ole queries
fm
parents: 10375
diff changeset
  1964
     (IUnknownPointer compiledMethodAt:#invokeAddRef) isOLECall    
11b634beb199 +ole queries
fm
parents: 10375
diff changeset
  1965
     (IUnknownPointer compiledMethodAt:#invokeAddRef) indexOfOLECall    
11b634beb199 +ole queries
fm
parents: 10375
diff changeset
  1966
    "
11b634beb199 +ole queries
fm
parents: 10375
diff changeset
  1967
!
11b634beb199 +ole queries
fm
parents: 10375
diff changeset
  1968
11b634beb199 +ole queries
fm
parents: 10375
diff changeset
  1969
isExternalLibraryFunctionCall
11b634beb199 +ole queries
fm
parents: 10375
diff changeset
  1970
    "Return true, if this is an externalLibraryFunction call."
11b634beb199 +ole queries
fm
parents: 10375
diff changeset
  1971
11b634beb199 +ole queries
fm
parents: 10375
diff changeset
  1972
    ^ self externalLibraryFunction notNil
11b634beb199 +ole queries
fm
parents: 10375
diff changeset
  1973
!
11b634beb199 +ole queries
fm
parents: 10375
diff changeset
  1974
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
  1975
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
  1976
    "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
  1977
     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
  1978
     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
  1979
     (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
  1980
2558
07e7d6fef46d removed unused var
Claus Gittinger <cg@exept.de>
parents: 2541
diff changeset
  1981
    |m myCode|
1873
3544a4a94a2a checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1870
diff changeset
  1982
3544a4a94a2a checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1870
diff changeset
  1983
    myCode := self code.
3544a4a94a2a checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1870
diff changeset
  1984
3544a4a94a2a checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1870
diff changeset
  1985
    m := self trapMethodForNumArgs:(self numArgs).
3544a4a94a2a checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1870
diff changeset
  1986
    (m notNil and:[self ~~ m]) ifTrue:[
10207
b5ca553d15ad localSourceFirst for extensions.
Claus Gittinger <cg@exept.de>
parents: 10201
diff changeset
  1987
        (myCode notNil and:[myCode = m code]) ifTrue:[^ true].
b5ca553d15ad localSourceFirst for extensions.
Claus Gittinger <cg@exept.de>
parents: 10201
diff changeset
  1988
        (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
  1989
    ].
159
514c749165c3 *** empty log message ***
claus
parents: 142
diff changeset
  1990
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
  1991
    m := Method compiledMethodAt:#uncompiledCodeObject.
1873
3544a4a94a2a checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1870
diff changeset
  1992
    (m notNil and:[self ~~ m]) ifTrue:[
10207
b5ca553d15ad localSourceFirst for extensions.
Claus Gittinger <cg@exept.de>
parents: 10201
diff changeset
  1993
        (myCode notNil and:[myCode = m code]) ifTrue:[^ true].
b5ca553d15ad localSourceFirst for extensions.
Claus Gittinger <cg@exept.de>
parents: 10201
diff changeset
  1994
        (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
  1995
    ].
1873
3544a4a94a2a checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1870
diff changeset
  1996
3544a4a94a2a checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1870
diff changeset
  1997
    m := Method compiledMethodAt:#unloadedCodeObject.
3544a4a94a2a checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1870
diff changeset
  1998
    (m notNil and:[self ~~ m]) ifTrue:[
10207
b5ca553d15ad localSourceFirst for extensions.
Claus Gittinger <cg@exept.de>
parents: 10201
diff changeset
  1999
        (myCode notNil and:[myCode = m code]) ifTrue:[^ true].
b5ca553d15ad localSourceFirst for extensions.
Claus Gittinger <cg@exept.de>
parents: 10201
diff changeset
  2000
        (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
  2001
    ].
1873
3544a4a94a2a checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1870
diff changeset
  2002
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
  2003
    ^ false
1194
628abcb5fbb6 moved some protocol from to upper levels
Claus Gittinger <cg@exept.de>
parents: 1190
diff changeset
  2004
1873
3544a4a94a2a checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1870
diff changeset
  2005
    "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
  2006
!
d600e08a5936 handle the case where a method has a sourceFileInfo, but the class has not
Claus Gittinger <cg@exept.de>
parents: 934
diff changeset
  2007
d600e08a5936 handle the case where a method has a sourceFileInfo, but the class has not
Claus Gittinger <cg@exept.de>
parents: 934
diff changeset
  2008
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
  2009
    "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
  2010
     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
  2011
d600e08a5936 handle the case where a method has a sourceFileInfo, but the class has not
Claus Gittinger <cg@exept.de>
parents: 934
diff changeset
  2012
    ^ 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
  2013
!
d600e08a5936 handle the case where a method has a sourceFileInfo, but the class has not
Claus Gittinger <cg@exept.de>
parents: 934
diff changeset
  2014
10482
11b634beb199 +ole queries
fm
parents: 10375
diff changeset
  2015
isOLECall
11b634beb199 +ole queries
fm
parents: 10375
diff changeset
  2016
    "return true, if the method is an ole call; false if not."
11b634beb199 +ole queries
fm
parents: 10375
diff changeset
  2017
11b634beb199 +ole queries
fm
parents: 10375
diff changeset
  2018
    |funcOrNil|
11b634beb199 +ole queries
fm
parents: 10375
diff changeset
  2019
11b634beb199 +ole queries
fm
parents: 10375
diff changeset
  2020
    funcOrNil := self externalLibraryFunction.
11b634beb199 +ole queries
fm
parents: 10375
diff changeset
  2021
    ^ funcOrNil notNil and:[funcOrNil isCallTypeOLE]
11b634beb199 +ole queries
fm
parents: 10375
diff changeset
  2022
!
11b634beb199 +ole queries
fm
parents: 10375
diff changeset
  2023
5894
ed6193fa6040 Define #isObsolete and fix various comments
Stefan Vogel <sv@exept.de>
parents: 5818
diff changeset
  2024
isObsolete
ed6193fa6040 Define #isObsolete and fix various comments
Stefan Vogel <sv@exept.de>
parents: 5818
diff changeset
  2025
    "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
  2026
ed6193fa6040 Define #isObsolete and fix various comments
Stefan Vogel <sv@exept.de>
parents: 5818
diff changeset
  2027
    |res|
ed6193fa6040 Define #isObsolete and fix various comments
Stefan Vogel <sv@exept.de>
parents: 5818
diff changeset
  2028
ed6193fa6040 Define #isObsolete and fix various comments
Stefan Vogel <sv@exept.de>
parents: 5818
diff changeset
  2029
    ^ (res := self resources) notNil and:[res includesKey:#obsolete]
ed6193fa6040 Define #isObsolete and fix various comments
Stefan Vogel <sv@exept.de>
parents: 5818
diff changeset
  2030
!
ed6193fa6040 Define #isObsolete and fix various comments
Stefan Vogel <sv@exept.de>
parents: 5818
diff changeset
  2031
2695
79229a9ab2da added #mclass for ST80 compatibility
Claus Gittinger <cg@exept.de>
parents: 2694
diff changeset
  2032
mclass
79229a9ab2da added #mclass for ST80 compatibility
Claus Gittinger <cg@exept.de>
parents: 2694
diff changeset
  2033
    "return the class in which the receiver was compiled.
79229a9ab2da added #mclass for ST80 compatibility
Claus Gittinger <cg@exept.de>
parents: 2694
diff changeset
  2034
     Same as #containingClass, for ST80 compatibility."
79229a9ab2da added #mclass for ST80 compatibility
Claus Gittinger <cg@exept.de>
parents: 2694
diff changeset
  2035
79229a9ab2da added #mclass for ST80 compatibility
Claus Gittinger <cg@exept.de>
parents: 2694
diff changeset
  2036
    ^ self containingClass
79229a9ab2da added #mclass for ST80 compatibility
Claus Gittinger <cg@exept.de>
parents: 2694
diff changeset
  2037
79229a9ab2da added #mclass for ST80 compatibility
Claus Gittinger <cg@exept.de>
parents: 2694
diff changeset
  2038
    "Created: 19.6.1997 / 16:26:13 / cg"
79229a9ab2da added #mclass for ST80 compatibility
Claus Gittinger <cg@exept.de>
parents: 2694
diff changeset
  2039
!
79229a9ab2da added #mclass for ST80 compatibility
Claus Gittinger <cg@exept.de>
parents: 2694
diff changeset
  2040
5696
958a0643496d compatibility
Claus Gittinger <cg@exept.de>
parents: 5676
diff changeset
  2041
messages
958a0643496d compatibility
Claus Gittinger <cg@exept.de>
parents: 5676
diff changeset
  2042
    "return a collection of message-selectors, sent by this method."
958a0643496d compatibility
Claus Gittinger <cg@exept.de>
parents: 5676
diff changeset
  2043
958a0643496d compatibility
Claus Gittinger <cg@exept.de>
parents: 5676
diff changeset
  2044
    ^ self messagesSent
958a0643496d compatibility
Claus Gittinger <cg@exept.de>
parents: 5676
diff changeset
  2045
!
958a0643496d compatibility
Claus Gittinger <cg@exept.de>
parents: 5676
diff changeset
  2046
5584
b175797a8c4d #messagesDo: (VW compatibility)
Claus Gittinger <cg@exept.de>
parents: 5582
diff changeset
  2047
messagesDo:aBlock
b175797a8c4d #messagesDo: (VW compatibility)
Claus Gittinger <cg@exept.de>
parents: 5582
diff changeset
  2048
    "evaluate aBlock for each message-selector sent by this method.
b175797a8c4d #messagesDo: (VW compatibility)
Claus Gittinger <cg@exept.de>
parents: 5582
diff changeset
  2049
     Uses Parser to parse methods source and extract the names."
b175797a8c4d #messagesDo: (VW compatibility)
Claus Gittinger <cg@exept.de>
parents: 5582
diff changeset
  2050
b175797a8c4d #messagesDo: (VW compatibility)
Claus Gittinger <cg@exept.de>
parents: 5582
diff changeset
  2051
    ^ self messagesSent do:aBlock
b175797a8c4d #messagesDo: (VW compatibility)
Claus Gittinger <cg@exept.de>
parents: 5582
diff changeset
  2052
!
b175797a8c4d #messagesDo: (VW compatibility)
Claus Gittinger <cg@exept.de>
parents: 5582
diff changeset
  2053
5582
737d121ae7de *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5564
diff changeset
  2054
messagesSent
737d121ae7de *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5564
diff changeset
  2055
    "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
  2056
     Uses Parser to parse methods source and extract the names.
737d121ae7de *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5564
diff changeset
  2057
     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
  2058
5633
15b028ad5e03 #usedGlobals check was wrong sometimes
Claus Gittinger <cg@exept.de>
parents: 5584
diff changeset
  2059
    ^ self parse:#'parseMethodSilent:in:' with:self mclass return:#messagesSent or:#() 
5582
737d121ae7de *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5564
diff changeset
  2060
737d121ae7de *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5564
diff changeset
  2061
    "
7690
8033752f2825 comment
Claus Gittinger <cg@exept.de>
parents: 7675
diff changeset
  2062
     (Method compiledMethodAt:#printOn:) messagesSent 
8033752f2825 comment
Claus Gittinger <cg@exept.de>
parents: 7675
diff changeset
  2063
     (Point compiledMethodAt:#x:) messagesSent 
5582
737d121ae7de *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5564
diff changeset
  2064
    "
737d121ae7de *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5564
diff changeset
  2065
!
737d121ae7de *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5564
diff changeset
  2066
737d121ae7de *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5564
diff changeset
  2067
messagesSentToSelf
737d121ae7de *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5564
diff changeset
  2068
    "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
  2069
     Uses Parser to parse methods source and extract the names."
737d121ae7de *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5564
diff changeset
  2070
5652
f832f4c5cfdd messagesSentTo* fixed
Claus Gittinger <cg@exept.de>
parents: 5644
diff changeset
  2071
    ^ self parse:#'parseMethodSilent:in:' with:self mclass return:#messagesSentToSelf or:#() 
f832f4c5cfdd messagesSentTo* fixed
Claus Gittinger <cg@exept.de>
parents: 5644
diff changeset
  2072
5582
737d121ae7de *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5564
diff changeset
  2073
!
737d121ae7de *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5564
diff changeset
  2074
737d121ae7de *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5564
diff changeset
  2075
messagesSentToSuper
737d121ae7de *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5564
diff changeset
  2076
    "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
  2077
     Uses Parser to parse methods source and extract the names."
737d121ae7de *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5564
diff changeset
  2078
5652
f832f4c5cfdd messagesSentTo* fixed
Claus Gittinger <cg@exept.de>
parents: 5644
diff changeset
  2079
    ^ self parse:#'parseMethodSilent:in:' with:self mclass return:#messagesSentToSuper or:#() 
f832f4c5cfdd messagesSentTo* fixed
Claus Gittinger <cg@exept.de>
parents: 5644
diff changeset
  2080
5582
737d121ae7de *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5564
diff changeset
  2081
!
737d121ae7de *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5564
diff changeset
  2082
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
  2083
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
  2084
    "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
  2085
     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
  2086
     Returns nil if the source is not available, or some other
d600e08a5936 handle the case where a method has a sourceFileInfo, but the class has not
Claus Gittinger <cg@exept.de>
parents: 934
diff changeset
  2087
     syntax/parse error occurred. For methods with no args and no vars,
d600e08a5936 handle the case where a method has a sourceFileInfo, but the class has not
Claus Gittinger <cg@exept.de>
parents: 934
diff changeset
  2088
     an empty collection 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
  2089
8427
bba41f189196 parserClass stuff
ca
parents: 8419
diff changeset
  2090
    |parserClass parser sourceString argNames varNames|
bba41f189196 parserClass stuff
ca
parents: 8419
diff changeset
  2091
bba41f189196 parserClass stuff
ca
parents: 8419
diff changeset
  2092
    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
  2093
    sourceString := self source.
8427
bba41f189196 parserClass stuff
ca
parents: 8419
diff changeset
  2094
    (parserClass notNil and:[sourceString notNil]) ifTrue:[
bba41f189196 parserClass stuff
ca
parents: 8419
diff changeset
  2095
        parser := parserClass parseMethodArgAndVarSpecificationSilent:sourceString.
8419
42a6fd0ef3bd allow for subclasses to redefine the parserClass
ca
parents: 8364
diff changeset
  2096
        (parser isNil or:[parser == #Error]) ifTrue:[^ nil].
42a6fd0ef3bd allow for subclasses to redefine the parserClass
ca
parents: 8364
diff changeset
  2097
        argNames := parser methodArgs.
42a6fd0ef3bd allow for subclasses to redefine the parserClass
ca
parents: 8364
diff changeset
  2098
        varNames := parser methodVars.
42a6fd0ef3bd allow for subclasses to redefine the parserClass
ca
parents: 8364
diff changeset
  2099
        argNames isNil ifTrue:[^ varNames].
42a6fd0ef3bd allow for subclasses to redefine the parserClass
ca
parents: 8364
diff changeset
  2100
        varNames isNil ifTrue:[^ argNames].
42a6fd0ef3bd allow for subclasses to redefine the parserClass
ca
parents: 8364
diff changeset
  2101
        ^ (argNames , varNames)
159
514c749165c3 *** empty log message ***
claus
parents: 142
diff changeset
  2102
    ].
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
  2103
    ^ 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
  2104
159
514c749165c3 *** empty log message ***
claus
parents: 142
diff changeset
  2105
    "
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
  2106
     (Method compiledMethodAt:#printOn:) methodArgAndVarNames
159
514c749165c3 *** empty log message ***
claus
parents: 142
diff changeset
  2107
    "
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
  2108
!
d600e08a5936 handle the case where a method has a sourceFileInfo, but the class has not
Claus Gittinger <cg@exept.de>
parents: 934
diff changeset
  2109
d600e08a5936 handle the case where a method has a sourceFileInfo, but the class has not
Claus Gittinger <cg@exept.de>
parents: 934
diff changeset
  2110
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
  2111
    "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
  2112
     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
  2113
d600e08a5936 handle the case where a method has a sourceFileInfo, but the class has not
Claus Gittinger <cg@exept.de>
parents: 934
diff changeset
  2114
    ^ 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
  2115
d600e08a5936 handle the case where a method has a sourceFileInfo, but the class has not
Claus Gittinger <cg@exept.de>
parents: 934
diff changeset
  2116
    "
d600e08a5936 handle the case where a method has a sourceFileInfo, but the class has not
Claus Gittinger <cg@exept.de>
parents: 934
diff changeset
  2117
     (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
  2118
    "
d600e08a5936 handle the case where a method has a sourceFileInfo, but the class has not
Claus Gittinger <cg@exept.de>
parents: 934
diff changeset
  2119
d600e08a5936 handle the case where a method has a sourceFileInfo, but the class has not
Claus Gittinger <cg@exept.de>
parents: 934
diff changeset
  2120
    "Modified: 31.10.1995 / 14:36:46 / cg"
872
af04035b443d binary class storage support
Claus Gittinger <cg@exept.de>
parents: 829
diff changeset
  2121
!
af04035b443d binary class storage support
Claus Gittinger <cg@exept.de>
parents: 829
diff changeset
  2122
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
  2123
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
  2124
    "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
  2125
     This is a somewhat stupid implementation."
872
af04035b443d binary class storage support
Claus Gittinger <cg@exept.de>
parents: 829
diff changeset
  2126
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
  2127
    |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
  2128
d600e08a5936 handle the case where a method has a sourceFileInfo, but the class has not
Claus Gittinger <cg@exept.de>
parents: 934
diff changeset
  2129
    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
  2130
    (text size < 2) ifTrue:[^nil].
872
af04035b443d binary class storage support
Claus Gittinger <cg@exept.de>
parents: 829
diff changeset
  2131
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
  2132
    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
  2133
    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
  2134
    (nQuote == 2) ifTrue:[
6956
23f0066163ff oops - EOL comments were handled wrong
Claus Gittinger <cg@exept.de>
parents: 6725
diff changeset
  2135
        qIndex := line indexOf:(Character doubleQuote).
23f0066163ff oops - EOL comments were handled wrong
Claus Gittinger <cg@exept.de>
parents: 6725
diff changeset
  2136
        qIndex2 := line indexOf:(Character doubleQuote) startingAt:(qIndex + 1).
23f0066163ff oops - EOL comments were handled wrong
Claus Gittinger <cg@exept.de>
parents: 6725
diff changeset
  2137
        ^ line copyFrom:(qIndex + 1) to:(qIndex2 - 1)
872
af04035b443d binary class storage support
Claus Gittinger <cg@exept.de>
parents: 829
diff changeset
  2138
    ].
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
  2139
    (nQuote == 1) ifTrue:[
6956
23f0066163ff oops - EOL comments were handled wrong
Claus Gittinger <cg@exept.de>
parents: 6725
diff changeset
  2140
        qIndex := line indexOf:(Character doubleQuote).
23f0066163ff oops - EOL comments were handled wrong
Claus Gittinger <cg@exept.de>
parents: 6725
diff changeset
  2141
        comment := line copyFrom:(qIndex + 1).
23f0066163ff oops - EOL comments were handled wrong
Claus Gittinger <cg@exept.de>
parents: 6725
diff changeset
  2142
        (line indexOf:$/ startingAt:qIndex) == (qIndex+1) ifTrue:[
23f0066163ff oops - EOL comments were handled wrong
Claus Gittinger <cg@exept.de>
parents: 6725
diff changeset
  2143
            "/ an EOL comment
23f0066163ff oops - EOL comments were handled wrong
Claus Gittinger <cg@exept.de>
parents: 6725
diff changeset
  2144
            ^ (comment copyFrom:2) withoutSeparators
23f0066163ff oops - EOL comments were handled wrong
Claus Gittinger <cg@exept.de>
parents: 6725
diff changeset
  2145
        ].
23f0066163ff oops - EOL comments were handled wrong
Claus Gittinger <cg@exept.de>
parents: 6725
diff changeset
  2146
23f0066163ff oops - EOL comments were handled wrong
Claus Gittinger <cg@exept.de>
parents: 6725
diff changeset
  2147
        "/ not an EOL comment
23f0066163ff oops - EOL comments were handled wrong
Claus Gittinger <cg@exept.de>
parents: 6725
diff changeset
  2148
        index := 3.
23f0066163ff oops - EOL comments were handled wrong
Claus Gittinger <cg@exept.de>
parents: 6725
diff changeset
  2149
        line := text at:index.
23f0066163ff oops - EOL comments were handled wrong
Claus Gittinger <cg@exept.de>
parents: 6725
diff changeset
  2150
        nQuote := line occurrencesOf:(Character doubleQuote).
23f0066163ff oops - EOL comments were handled wrong
Claus Gittinger <cg@exept.de>
parents: 6725
diff changeset
  2151
        [nQuote ~~ 1] whileTrue:[
23f0066163ff oops - EOL comments were handled wrong
Claus Gittinger <cg@exept.de>
parents: 6725
diff changeset
  2152
            comment := comment , Character cr asString , line withoutSpaces.
23f0066163ff oops - EOL comments were handled wrong
Claus Gittinger <cg@exept.de>
parents: 6725
diff changeset
  2153
            index := index + 1.
23f0066163ff oops - EOL comments were handled wrong
Claus Gittinger <cg@exept.de>
parents: 6725
diff changeset
  2154
            line := text at:index.
23f0066163ff oops - EOL comments were handled wrong
Claus Gittinger <cg@exept.de>
parents: 6725
diff changeset
  2155
            nQuote := line occurrencesOf:(Character doubleQuote)
23f0066163ff oops - EOL comments were handled wrong
Claus Gittinger <cg@exept.de>
parents: 6725
diff changeset
  2156
        ].
23f0066163ff oops - EOL comments were handled wrong
Claus Gittinger <cg@exept.de>
parents: 6725
diff changeset
  2157
        qIndex := line indexOf:(Character doubleQuote).
23f0066163ff oops - EOL comments were handled wrong
Claus Gittinger <cg@exept.de>
parents: 6725
diff changeset
  2158
        ^ 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
  2159
    ].
d600e08a5936 handle the case where a method has a sourceFileInfo, but the class has not
Claus Gittinger <cg@exept.de>
parents: 934
diff changeset
  2160
    ^ 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
  2161
d600e08a5936 handle the case where a method has a sourceFileInfo, but the class has not
Claus Gittinger <cg@exept.de>
parents: 934
diff changeset
  2162
    "
d600e08a5936 handle the case where a method has a sourceFileInfo, but the class has not
Claus Gittinger <cg@exept.de>
parents: 934
diff changeset
  2163
     (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
  2164
    "
d600e08a5936 handle the case where a method has a sourceFileInfo, but the class has not
Claus Gittinger <cg@exept.de>
parents: 934
diff changeset
  2165
!
872
af04035b443d binary class storage support
Claus Gittinger <cg@exept.de>
parents: 829
diff changeset
  2166
9364
beef5f0aa8bb New: #methodDefinitionTemplate
Stefan Vogel <sv@exept.de>
parents: 9288
diff changeset
  2167
methodDefinitionTemplate
beef5f0aa8bb New: #methodDefinitionTemplate
Stefan Vogel <sv@exept.de>
parents: 9288
diff changeset
  2168
    "return the string that defines the method and the arguments"
beef5f0aa8bb New: #methodDefinitionTemplate
Stefan Vogel <sv@exept.de>
parents: 9288
diff changeset
  2169
beef5f0aa8bb New: #methodDefinitionTemplate
Stefan Vogel <sv@exept.de>
parents: 9288
diff changeset
  2170
    ^ Method methodDefinitionTemplateForSelector:self selector andArgumentNames:self methodArgNames
beef5f0aa8bb New: #methodDefinitionTemplate
Stefan Vogel <sv@exept.de>
parents: 9288
diff changeset
  2171
beef5f0aa8bb New: #methodDefinitionTemplate
Stefan Vogel <sv@exept.de>
parents: 9288
diff changeset
  2172
    "
beef5f0aa8bb New: #methodDefinitionTemplate
Stefan Vogel <sv@exept.de>
parents: 9288
diff changeset
  2173
      (self compiledMethodAt:#printOn:) methodDefinitionTemplate
beef5f0aa8bb New: #methodDefinitionTemplate
Stefan Vogel <sv@exept.de>
parents: 9288
diff changeset
  2174
    "
beef5f0aa8bb New: #methodDefinitionTemplate
Stefan Vogel <sv@exept.de>
parents: 9288
diff changeset
  2175
!
beef5f0aa8bb New: #methodDefinitionTemplate
Stefan Vogel <sv@exept.de>
parents: 9288
diff changeset
  2176
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
  2177
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
  2178
    "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
  2179
     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
  2180
d600e08a5936 handle the case where a method has a sourceFileInfo, but the class has not
Claus Gittinger <cg@exept.de>
parents: 934
diff changeset
  2181
    ^ 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
  2182
d600e08a5936 handle the case where a method has a sourceFileInfo, but the class has not
Claus Gittinger <cg@exept.de>
parents: 934
diff changeset
  2183
    "
d600e08a5936 handle the case where a method has a sourceFileInfo, but the class has not
Claus Gittinger <cg@exept.de>
parents: 934
diff changeset
  2184
     (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
  2185
    "
d600e08a5936 handle the case where a method has a sourceFileInfo, but the class has not
Claus Gittinger <cg@exept.de>
parents: 934
diff changeset
  2186
d600e08a5936 handle the case where a method has a sourceFileInfo, but the class has not
Claus Gittinger <cg@exept.de>
parents: 934
diff changeset
  2187
    "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
  2188
!
d600e08a5936 handle the case where a method has a sourceFileInfo, but the class has not
Claus Gittinger <cg@exept.de>
parents: 934
diff changeset
  2189
d600e08a5936 handle the case where a method has a sourceFileInfo, but the class has not
Claus Gittinger <cg@exept.de>
parents: 934
diff changeset
  2190
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
  2191
    "try to extract the modificationTime as a timeStamp 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
  2192
     the receivers source. If there is no source or no history line, 
d600e08a5936 handle the case where a method has a sourceFileInfo, but the class has not
Claus Gittinger <cg@exept.de>
parents: 934
diff changeset
  2193
     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
  2194
d600e08a5936 handle the case where a method has a sourceFileInfo, but the class has not
Claus Gittinger <cg@exept.de>
parents: 934
diff changeset
  2195
    |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
  2196
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
  2197
    HistoryManager isNil ifTrue:[^ nil].
1873
3544a4a94a2a checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1870
diff changeset
  2198
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
  2199
    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
  2200
    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
  2201
    list := HistoryManager getAllHistoriesFrom:s.
d600e08a5936 handle the case where a method has a sourceFileInfo, but the class has not
Claus Gittinger <cg@exept.de>
parents: 934
diff changeset
  2202
    list size == 0 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
  2203
    histLine := list last.
8252
16ed6cd9868d Use Timestamp/#asTimestamp instead of AbsoluteTime/#asAbsoluteTime
Stefan Vogel <sv@exept.de>
parents: 8216
diff changeset
  2204
    ^ Timestamp 
16ed6cd9868d Use Timestamp/#asTimestamp instead of AbsoluteTime/#asAbsoluteTime
Stefan Vogel <sv@exept.de>
parents: 8216
diff changeset
  2205
        fromDate:histLine date 
16ed6cd9868d Use Timestamp/#asTimestamp instead of AbsoluteTime/#asAbsoluteTime
Stefan Vogel <sv@exept.de>
parents: 8216
diff changeset
  2206
        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
  2207
d600e08a5936 handle the case where a method has a sourceFileInfo, but the class has not
Claus Gittinger <cg@exept.de>
parents: 934
diff changeset
  2208
    "
d600e08a5936 handle the case where a method has a sourceFileInfo, but the class has not
Claus Gittinger <cg@exept.de>
parents: 934
diff changeset
  2209
     (Method compiledMethodAt:#modificationTime) 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
  2210
     (Method compiledMethodAt:#isMethod) 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
  2211
    "
d600e08a5936 handle the case where a method has a sourceFileInfo, but the class has not
Claus Gittinger <cg@exept.de>
parents: 934
diff changeset
  2212
d600e08a5936 handle the case where a method has a sourceFileInfo, but the class has not
Claus Gittinger <cg@exept.de>
parents: 934
diff changeset
  2213
    "Modified: 8.9.1995 / 15:08:22 / claus"
1873
3544a4a94a2a checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1870
diff changeset
  2214
    "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
  2215
!
d600e08a5936 handle the case where a method has a sourceFileInfo, but the class has not
Claus Gittinger <cg@exept.de>
parents: 934
diff changeset
  2216
3845
729fda604d59 added #name (for javaMethod compatibility)
Claus Gittinger <cg@exept.de>
parents: 3697
diff changeset
  2217
name
729fda604d59 added #name (for javaMethod compatibility)
Claus Gittinger <cg@exept.de>
parents: 3697
diff changeset
  2218
    "for compatibility with javaMethods"
729fda604d59 added #name (for javaMethod compatibility)
Claus Gittinger <cg@exept.de>
parents: 3697
diff changeset
  2219
729fda604d59 added #name (for javaMethod compatibility)
Claus Gittinger <cg@exept.de>
parents: 3697
diff changeset
  2220
    ^ self selector
729fda604d59 added #name (for javaMethod compatibility)
Claus Gittinger <cg@exept.de>
parents: 3697
diff changeset
  2221
729fda604d59 added #name (for javaMethod compatibility)
Claus Gittinger <cg@exept.de>
parents: 3697
diff changeset
  2222
    "Created: / 9.11.1998 / 06:15:08 / cg"
729fda604d59 added #name (for javaMethod compatibility)
Claus Gittinger <cg@exept.de>
parents: 3697
diff changeset
  2223
!
729fda604d59 added #name (for javaMethod compatibility)
Claus Gittinger <cg@exept.de>
parents: 3697
diff changeset
  2224
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
  2225
parse:parseSelector return:accessSelector or:valueIfNoSource 
d600e08a5936 handle the case where a method has a sourceFileInfo, but the class has not
Claus Gittinger <cg@exept.de>
parents: 934
diff changeset
  2226
    "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
  2227
     Get the source, let parser parse it using parseSelector,
1873
3544a4a94a2a checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1870
diff changeset
  2228
     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
  2229
5633
15b028ad5e03 #usedGlobals check was wrong sometimes
Claus Gittinger <cg@exept.de>
parents: 5584
diff changeset
  2230
    ^ self parse:parseSelector with:nil return:accessSelector or:valueIfNoSource
15b028ad5e03 #usedGlobals check was wrong sometimes
Claus Gittinger <cg@exept.de>
parents: 5584
diff changeset
  2231
15b028ad5e03 #usedGlobals check was wrong sometimes
Claus Gittinger <cg@exept.de>
parents: 5584
diff changeset
  2232
    "
15b028ad5e03 #usedGlobals check was wrong sometimes
Claus Gittinger <cg@exept.de>
parents: 5584
diff changeset
  2233
     (Method compiledMethodAt:#parse:return:or:)
10207
b5ca553d15ad localSourceFirst for extensions.
Claus Gittinger <cg@exept.de>
parents: 10201
diff changeset
  2234
        parse:#'parseMethodSilent:' return:#sentMessages or:#() 
5633
15b028ad5e03 #usedGlobals check was wrong sometimes
Claus Gittinger <cg@exept.de>
parents: 5584
diff changeset
  2235
    "
15b028ad5e03 #usedGlobals check was wrong sometimes
Claus Gittinger <cg@exept.de>
parents: 5584
diff changeset
  2236
!
15b028ad5e03 #usedGlobals check was wrong sometimes
Claus Gittinger <cg@exept.de>
parents: 5584
diff changeset
  2237
15b028ad5e03 #usedGlobals check was wrong sometimes
Claus Gittinger <cg@exept.de>
parents: 5584
diff changeset
  2238
parse:parseSelector with:arg2 return:accessSelector or:valueIfNoSource 
15b028ad5e03 #usedGlobals check was wrong sometimes
Claus Gittinger <cg@exept.de>
parents: 5584
diff changeset
  2239
    "helper for methodArgNames, methodVarNames etc.
15b028ad5e03 #usedGlobals check was wrong sometimes
Claus Gittinger <cg@exept.de>
parents: 5584
diff changeset
  2240
     Get the source, let parser parse it using parseSelector,
15b028ad5e03 #usedGlobals check was wrong sometimes
Claus Gittinger <cg@exept.de>
parents: 5584
diff changeset
  2241
     return parser-info using accessSelector"
15b028ad5e03 #usedGlobals check was wrong sometimes
Claus Gittinger <cg@exept.de>
parents: 5584
diff changeset
  2242
8427
bba41f189196 parserClass stuff
ca
parents: 8419
diff changeset
  2243
    |parser parserClass sourceString|
bba41f189196 parserClass stuff
ca
parents: 8419
diff changeset
  2244
bba41f189196 parserClass stuff
ca
parents: 8419
diff changeset
  2245
    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
  2246
    sourceString := self source.
8427
bba41f189196 parserClass stuff
ca
parents: 8419
diff changeset
  2247
    (parserClass notNil and:[sourceString notNil]) ifTrue:[
8419
42a6fd0ef3bd allow for subclasses to redefine the parserClass
ca
parents: 8364
diff changeset
  2248
        parseSelector numArgs == 2 ifTrue:[
8427
bba41f189196 parserClass stuff
ca
parents: 8419
diff changeset
  2249
            parser := parserClass perform:parseSelector with:sourceString with:arg2.
8419
42a6fd0ef3bd allow for subclasses to redefine the parserClass
ca
parents: 8364
diff changeset
  2250
        ] ifFalse:[
8427
bba41f189196 parserClass stuff
ca
parents: 8419
diff changeset
  2251
            parser := parserClass perform:parseSelector with:sourceString.
8419
42a6fd0ef3bd allow for subclasses to redefine the parserClass
ca
parents: 8364
diff changeset
  2252
        ].
42a6fd0ef3bd allow for subclasses to redefine the parserClass
ca
parents: 8364
diff changeset
  2253
        (parser isNil or:[parser == #Error]) ifTrue:[^ valueIfNoSource].
42a6fd0ef3bd allow for subclasses to redefine the parserClass
ca
parents: 8364
diff changeset
  2254
        ^ 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
  2255
    ].
1873
3544a4a94a2a checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1870
diff changeset
  2256
    ^ valueIfNoSource
3544a4a94a2a checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1870
diff changeset
  2257
5500
8bc3b30296ae more queries (sentMessages ...)
Claus Gittinger <cg@exept.de>
parents: 5406
diff changeset
  2258
    "
8bc3b30296ae more queries (sentMessages ...)
Claus Gittinger <cg@exept.de>
parents: 5406
diff changeset
  2259
     (Method compiledMethodAt:#parse:return:or:)
8419
42a6fd0ef3bd allow for subclasses to redefine the parserClass
ca
parents: 8364
diff changeset
  2260
        parse:#'parseMethodSilent:' return:#sentMessages or:#() 
5500
8bc3b30296ae more queries (sentMessages ...)
Claus Gittinger <cg@exept.de>
parents: 5406
diff changeset
  2261
    "
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
  2262
!
159
514c749165c3 *** empty log message ***
claus
parents: 142
diff changeset
  2263
5721
5f97733ff519 methods now send change-notifications when the category changes
Claus Gittinger <cg@exept.de>
parents: 5704
diff changeset
  2264
parseResources
5894
ed6193fa6040 Define #isObsolete and fix various comments
Stefan Vogel <sv@exept.de>
parents: 5818
diff changeset
  2265
    "return the methods resource spec; either nil or a collection of symbols."
5721
5f97733ff519 methods now send change-notifications when the category changes
Claus Gittinger <cg@exept.de>
parents: 5704
diff changeset
  2266
5f97733ff519 methods now send change-notifications when the category changes
Claus Gittinger <cg@exept.de>
parents: 5704
diff changeset
  2267
    |src parser|
5f97733ff519 methods now send change-notifications when the category changes
Claus Gittinger <cg@exept.de>
parents: 5704
diff changeset
  2268
5f97733ff519 methods now send change-notifications when the category changes
Claus Gittinger <cg@exept.de>
parents: 5704
diff changeset
  2269
    src := self source.
5f97733ff519 methods now send change-notifications when the category changes
Claus Gittinger <cg@exept.de>
parents: 5704
diff changeset
  2270
    src isNil ifTrue:[
5f97733ff519 methods now send change-notifications when the category changes
Claus Gittinger <cg@exept.de>
parents: 5704
diff changeset
  2271
        ^ nil "/ actually: dont know
5f97733ff519 methods now send change-notifications when the category changes
Claus Gittinger <cg@exept.de>
parents: 5704
diff changeset
  2272
    ].
5f97733ff519 methods now send change-notifications when the category changes
Claus Gittinger <cg@exept.de>
parents: 5704
diff changeset
  2273
5f97733ff519 methods now send change-notifications when the category changes
Claus Gittinger <cg@exept.de>
parents: 5704
diff changeset
  2274
    (src findString:'resource:') == 0 ifTrue:[
5f97733ff519 methods now send change-notifications when the category changes
Claus Gittinger <cg@exept.de>
parents: 5704
diff changeset
  2275
        ^ nil "/ actually: error
5f97733ff519 methods now send change-notifications when the category changes
Claus Gittinger <cg@exept.de>
parents: 5704
diff changeset
  2276
    ].
5f97733ff519 methods now send change-notifications when the category changes
Claus Gittinger <cg@exept.de>
parents: 5704
diff changeset
  2277
    "/ no need to parse all - only interested in resource-info
8427
bba41f189196 parserClass stuff
ca
parents: 8419
diff changeset
  2278
    self parserClass isNil ifTrue:[
bba41f189196 parserClass stuff
ca
parents: 8419
diff changeset
  2279
        ^ nil 
bba41f189196 parserClass stuff
ca
parents: 8419
diff changeset
  2280
    ].
8419
42a6fd0ef3bd allow for subclasses to redefine the parserClass
ca
parents: 8364
diff changeset
  2281
    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
  2282
    parser isNil ifTrue:[
5f97733ff519 methods now send change-notifications when the category changes
Claus Gittinger <cg@exept.de>
parents: 5704
diff changeset
  2283
        ^ nil "/ actually error
5f97733ff519 methods now send change-notifications when the category changes
Claus Gittinger <cg@exept.de>
parents: 5704
diff changeset
  2284
    ].
5f97733ff519 methods now send change-notifications when the category changes
Claus Gittinger <cg@exept.de>
parents: 5704
diff changeset
  2285
    ^ parser primitiveResources.
5f97733ff519 methods now send change-notifications when the category changes
Claus Gittinger <cg@exept.de>
parents: 5704
diff changeset
  2286
!
5f97733ff519 methods now send change-notifications when the category changes
Claus Gittinger <cg@exept.de>
parents: 5704
diff changeset
  2287
1923
97b099fef985 optionally keep a history of changed methods
Claus Gittinger <cg@exept.de>
parents: 1873
diff changeset
  2288
previousVersion
6644
141198d9b865 previousVersions stuff moved from NewSystemBrowser to here
Claus Gittinger <cg@exept.de>
parents: 6541
diff changeset
  2289
    "return the receivers previous versions source code"
141198d9b865 previousVersions stuff moved from NewSystemBrowser to here
Claus Gittinger <cg@exept.de>
parents: 6541
diff changeset
  2290
7210
80bb33c02780 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 7085
diff changeset
  2291
    |sel cls previous|
6644
141198d9b865 previousVersions stuff moved from NewSystemBrowser to here
Claus Gittinger <cg@exept.de>
parents: 6541
diff changeset
  2292
141198d9b865 previousVersions stuff moved from NewSystemBrowser to here
Claus Gittinger <cg@exept.de>
parents: 6541
diff changeset
  2293
    sel := self selector.
141198d9b865 previousVersions stuff moved from NewSystemBrowser to here
Claus Gittinger <cg@exept.de>
parents: 6541
diff changeset
  2294
    sel isNil ifTrue:[ ^ nil ].
141198d9b865 previousVersions stuff moved from NewSystemBrowser to here
Claus Gittinger <cg@exept.de>
parents: 6541
diff changeset
  2295
141198d9b865 previousVersions stuff moved from NewSystemBrowser to here
Claus Gittinger <cg@exept.de>
parents: 6541
diff changeset
  2296
    cls := self mclass.
141198d9b865 previousVersions stuff moved from NewSystemBrowser to here
Claus Gittinger <cg@exept.de>
parents: 6541
diff changeset
  2297
    cls isNil ifTrue:[ ^ nil ].
141198d9b865 previousVersions stuff moved from NewSystemBrowser to here
Claus Gittinger <cg@exept.de>
parents: 6541
diff changeset
  2298
141198d9b865 previousVersions stuff moved from NewSystemBrowser to here
Claus Gittinger <cg@exept.de>
parents: 6541
diff changeset
  2299
    ChangeSet current reverseDo:[:change | 
141198d9b865 previousVersions stuff moved from NewSystemBrowser to here
Claus Gittinger <cg@exept.de>
parents: 6541
diff changeset
  2300
        (change isMethodChange 
141198d9b865 previousVersions stuff moved from NewSystemBrowser to here
Claus Gittinger <cg@exept.de>
parents: 6541
diff changeset
  2301
        and:[ (change selector == sel)
141198d9b865 previousVersions stuff moved from NewSystemBrowser to here
Claus Gittinger <cg@exept.de>
parents: 6541
diff changeset
  2302
        and:[ change changeClass == cls ]]) 
141198d9b865 previousVersions stuff moved from NewSystemBrowser to here
Claus Gittinger <cg@exept.de>
parents: 6541
diff changeset
  2303
        ifTrue:[
7210
80bb33c02780 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 7085
diff changeset
  2304
            previous := change previousVersion.
80bb33c02780 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 7085
diff changeset
  2305
            previous notNil ifTrue:[
80bb33c02780 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 7085
diff changeset
  2306
                ^ previous
6644
141198d9b865 previousVersions stuff moved from NewSystemBrowser to here
Claus Gittinger <cg@exept.de>
parents: 6541
diff changeset
  2307
            ]
141198d9b865 previousVersions stuff moved from NewSystemBrowser to here
Claus Gittinger <cg@exept.de>
parents: 6541
diff changeset
  2308
        ]
141198d9b865 previousVersions stuff moved from NewSystemBrowser to here
Claus Gittinger <cg@exept.de>
parents: 6541
diff changeset
  2309
    ].
141198d9b865 previousVersions stuff moved from NewSystemBrowser to here
Claus Gittinger <cg@exept.de>
parents: 6541
diff changeset
  2310
    ^ nil.
141198d9b865 previousVersions stuff moved from NewSystemBrowser to here
Claus Gittinger <cg@exept.de>
parents: 6541
diff changeset
  2311
141198d9b865 previousVersions stuff moved from NewSystemBrowser to here
Claus Gittinger <cg@exept.de>
parents: 6541
diff changeset
  2312
"/    history := Class methodHistory.
141198d9b865 previousVersions stuff moved from NewSystemBrowser to here
Claus Gittinger <cg@exept.de>
parents: 6541
diff changeset
  2313
"/    history isNil ifTrue:[^ nil].
141198d9b865 previousVersions stuff moved from NewSystemBrowser to here
Claus Gittinger <cg@exept.de>
parents: 6541
diff changeset
  2314
"/
141198d9b865 previousVersions stuff moved from NewSystemBrowser to here
Claus Gittinger <cg@exept.de>
parents: 6541
diff changeset
  2315
"/    entry := history detect:[:entry | |type old new|
141198d9b865 previousVersions stuff moved from NewSystemBrowser to here
Claus Gittinger <cg@exept.de>
parents: 6541
diff changeset
  2316
"/                                    type := entry first.
141198d9b865 previousVersions stuff moved from NewSystemBrowser to here
Claus Gittinger <cg@exept.de>
parents: 6541
diff changeset
  2317
"/                                    type == #methodChange ifTrue:[
141198d9b865 previousVersions stuff moved from NewSystemBrowser to here
Claus Gittinger <cg@exept.de>
parents: 6541
diff changeset
  2318
"/                                        old := entry second.
141198d9b865 previousVersions stuff moved from NewSystemBrowser to here
Claus Gittinger <cg@exept.de>
parents: 6541
diff changeset
  2319
"/                                        new := entry third.
141198d9b865 previousVersions stuff moved from NewSystemBrowser to here
Claus Gittinger <cg@exept.de>
parents: 6541
diff changeset
  2320
"/                                        new == self
141198d9b865 previousVersions stuff moved from NewSystemBrowser to here
Claus Gittinger <cg@exept.de>
parents: 6541
diff changeset
  2321
"/                                    ] ifFalse:[
141198d9b865 previousVersions stuff moved from NewSystemBrowser to here
Claus Gittinger <cg@exept.de>
parents: 6541
diff changeset
  2322
"/                                        false
141198d9b865 previousVersions stuff moved from NewSystemBrowser to here
Claus Gittinger <cg@exept.de>
parents: 6541
diff changeset
  2323
"/                                    ]
141198d9b865 previousVersions stuff moved from NewSystemBrowser to here
Claus Gittinger <cg@exept.de>
parents: 6541
diff changeset
  2324
"/                             ] 
141198d9b865 previousVersions stuff moved from NewSystemBrowser to here
Claus Gittinger <cg@exept.de>
parents: 6541
diff changeset
  2325
"/                     ifNone:nil.
141198d9b865 previousVersions stuff moved from NewSystemBrowser to here
Claus Gittinger <cg@exept.de>
parents: 6541
diff changeset
  2326
"/    entry isNil ifTrue:[^nil].
141198d9b865 previousVersions stuff moved from NewSystemBrowser to here
Claus Gittinger <cg@exept.de>
parents: 6541
diff changeset
  2327
"/    ^ entry second.
5339
c922450b57b5 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5324
diff changeset
  2328
"/    ^ history at:self ifAbsent:nil
1923
97b099fef985 optionally keep a history of changed methods
Claus Gittinger <cg@exept.de>
parents: 1873
diff changeset
  2329
1925
f1c8c6374af8 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1923
diff changeset
  2330
    "Modified: 7.11.1996 / 19:06:22 / cg"
1923
97b099fef985 optionally keep a history of changed methods
Claus Gittinger <cg@exept.de>
parents: 1873
diff changeset
  2331
!
97b099fef985 optionally keep a history of changed methods
Claus Gittinger <cg@exept.de>
parents: 1873
diff changeset
  2332
7210
80bb33c02780 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 7085
diff changeset
  2333
previousVersionCode
80bb33c02780 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 7085
diff changeset
  2334
    "return the receivers previous versions source code"
80bb33c02780 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 7085
diff changeset
  2335
80bb33c02780 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 7085
diff changeset
  2336
    |previous|
80bb33c02780 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 7085
diff changeset
  2337
80bb33c02780 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 7085
diff changeset
  2338
    previous := self previousVersion.
80bb33c02780 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 7085
diff changeset
  2339
    previous isNil ifTrue:[ ^ nil ].
80bb33c02780 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 7085
diff changeset
  2340
80bb33c02780 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 7085
diff changeset
  2341
    ^ previous source
80bb33c02780 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 7085
diff changeset
  2342
!
80bb33c02780 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 7085
diff changeset
  2343
6644
141198d9b865 previousVersions stuff moved from NewSystemBrowser to here
Claus Gittinger <cg@exept.de>
parents: 6541
diff changeset
  2344
previousVersions
141198d9b865 previousVersions stuff moved from NewSystemBrowser to here
Claus Gittinger <cg@exept.de>
parents: 6541
diff changeset
  2345
    "return a collection of the receivers previous versions (sources)"
141198d9b865 previousVersions stuff moved from NewSystemBrowser to here
Claus Gittinger <cg@exept.de>
parents: 6541
diff changeset
  2346
7453
48c427d125f4 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 7328
diff changeset
  2347
    |sel cls versions lastChange firstSrc last|
6644
141198d9b865 previousVersions stuff moved from NewSystemBrowser to here
Claus Gittinger <cg@exept.de>
parents: 6541
diff changeset
  2348
141198d9b865 previousVersions stuff moved from NewSystemBrowser to here
Claus Gittinger <cg@exept.de>
parents: 6541
diff changeset
  2349
    sel := self selector.
141198d9b865 previousVersions stuff moved from NewSystemBrowser to here
Claus Gittinger <cg@exept.de>
parents: 6541
diff changeset
  2350
    sel isNil ifTrue:[^ #()].
141198d9b865 previousVersions stuff moved from NewSystemBrowser to here
Claus Gittinger <cg@exept.de>
parents: 6541
diff changeset
  2351
141198d9b865 previousVersions stuff moved from NewSystemBrowser to here
Claus Gittinger <cg@exept.de>
parents: 6541
diff changeset
  2352
    cls := self mclass.
141198d9b865 previousVersions stuff moved from NewSystemBrowser to here
Claus Gittinger <cg@exept.de>
parents: 6541
diff changeset
  2353
    cls isNil ifTrue:[^ #()].
141198d9b865 previousVersions stuff moved from NewSystemBrowser to here
Claus Gittinger <cg@exept.de>
parents: 6541
diff changeset
  2354
141198d9b865 previousVersions stuff moved from NewSystemBrowser to here
Claus Gittinger <cg@exept.de>
parents: 6541
diff changeset
  2355
    versions := OrderedCollection new.
141198d9b865 previousVersions stuff moved from NewSystemBrowser to here
Claus Gittinger <cg@exept.de>
parents: 6541
diff changeset
  2356
141198d9b865 previousVersions stuff moved from NewSystemBrowser to here
Claus Gittinger <cg@exept.de>
parents: 6541
diff changeset
  2357
    ChangeSet current reverseDo:[:change | 
7457
3e0ec3d09cdd adapt to changed class in ClassChange
Claus Gittinger <cg@exept.de>
parents: 7453
diff changeset
  2358
         (change isMethodChange 
6644
141198d9b865 previousVersions stuff moved from NewSystemBrowser to here
Claus Gittinger <cg@exept.de>
parents: 6541
diff changeset
  2359
        and:[ (change selector == sel)
141198d9b865 previousVersions stuff moved from NewSystemBrowser to here
Claus Gittinger <cg@exept.de>
parents: 6541
diff changeset
  2360
        and:[ change changeClass == cls ]]) 
141198d9b865 previousVersions stuff moved from NewSystemBrowser to here
Claus Gittinger <cg@exept.de>
parents: 6541
diff changeset
  2361
        ifTrue:[
141198d9b865 previousVersions stuff moved from NewSystemBrowser to here
Claus Gittinger <cg@exept.de>
parents: 6541
diff changeset
  2362
            versions addFirst:change.
141198d9b865 previousVersions stuff moved from NewSystemBrowser to here
Claus Gittinger <cg@exept.de>
parents: 6541
diff changeset
  2363
            lastChange := change.    
141198d9b865 previousVersions stuff moved from NewSystemBrowser to here
Claus Gittinger <cg@exept.de>
parents: 6541
diff changeset
  2364
        ]
141198d9b865 previousVersions stuff moved from NewSystemBrowser to here
Claus Gittinger <cg@exept.de>
parents: 6541
diff changeset
  2365
    ].
141198d9b865 previousVersions stuff moved from NewSystemBrowser to here
Claus Gittinger <cg@exept.de>
parents: 6541
diff changeset
  2366
141198d9b865 previousVersions stuff moved from NewSystemBrowser to here
Claus Gittinger <cg@exept.de>
parents: 6541
diff changeset
  2367
    lastChange notNil ifTrue:[
7453
48c427d125f4 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 7328
diff changeset
  2368
        last := lastChange previousVersion.
48c427d125f4 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 7328
diff changeset
  2369
        last notNil ifTrue:[
48c427d125f4 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 7328
diff changeset
  2370
            firstSrc := last source.
48c427d125f4 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 7328
diff changeset
  2371
            (firstSrc size > 0
48c427d125f4 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 7328
diff changeset
  2372
            and:[ firstSrc ~= lastChange source]) ifTrue:[
48c427d125f4 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 7328
diff changeset
  2373
                versions addFirst:(MethodChange 
48c427d125f4 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 7328
diff changeset
  2374
                                    className:lastChange className 
48c427d125f4 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 7328
diff changeset
  2375
                                    selector:lastChange selector
48c427d125f4 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 7328
diff changeset
  2376
                                    source:firstSrc
48c427d125f4 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 7328
diff changeset
  2377
                                    category:lastChange category).
48c427d125f4 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 7328
diff changeset
  2378
            ]
6644
141198d9b865 previousVersions stuff moved from NewSystemBrowser to here
Claus Gittinger <cg@exept.de>
parents: 6541
diff changeset
  2379
        ]
141198d9b865 previousVersions stuff moved from NewSystemBrowser to here
Claus Gittinger <cg@exept.de>
parents: 6541
diff changeset
  2380
    ].
141198d9b865 previousVersions stuff moved from NewSystemBrowser to here
Claus Gittinger <cg@exept.de>
parents: 6541
diff changeset
  2381
    ^ versions
141198d9b865 previousVersions stuff moved from NewSystemBrowser to here
Claus Gittinger <cg@exept.de>
parents: 6541
diff changeset
  2382
!
141198d9b865 previousVersions stuff moved from NewSystemBrowser to here
Claus Gittinger <cg@exept.de>
parents: 6541
diff changeset
  2383
5564
0f513f04c50f #readsFields: and #writesField: for st80 compatibility
Claus Gittinger <cg@exept.de>
parents: 5562
diff changeset
  2384
readsField:instVarIndex
0f513f04c50f #readsFields: and #writesField: for st80 compatibility
Claus Gittinger <cg@exept.de>
parents: 5562
diff changeset
  2385
    "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
  2386
     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
  2387
0f513f04c50f #readsFields: and #writesField: for st80 compatibility
Claus Gittinger <cg@exept.de>
parents: 5562
diff changeset
  2388
    |varName readInstVars|
0f513f04c50f #readsFields: and #writesField: for st80 compatibility
Claus Gittinger <cg@exept.de>
parents: 5562
diff changeset
  2389
0f513f04c50f #readsFields: and #writesField: for st80 compatibility
Claus Gittinger <cg@exept.de>
parents: 5562
diff changeset
  2390
    varName := (self mclass allInstVarNames) at:instVarIndex.
5636
eab6a71fb3d0 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5634
diff changeset
  2391
    readInstVars := self parse:#'parseMethodSilent:in:' with:self mclass  return:#readInstVars or:#().
5564
0f513f04c50f #readsFields: and #writesField: for st80 compatibility
Claus Gittinger <cg@exept.de>
parents: 5562
diff changeset
  2392
    ^ readInstVars includes:varName.
0f513f04c50f #readsFields: and #writesField: for st80 compatibility
Claus Gittinger <cg@exept.de>
parents: 5562
diff changeset
  2393
!
0f513f04c50f #readsFields: and #writesField: for st80 compatibility
Claus Gittinger <cg@exept.de>
parents: 5562
diff changeset
  2394
3052
f384e7082ee9 more resource stuff (VW compatibility)
Claus Gittinger <cg@exept.de>
parents: 3030
diff changeset
  2395
resourceType
f384e7082ee9 more resource stuff (VW compatibility)
Claus Gittinger <cg@exept.de>
parents: 3030
diff changeset
  2396
    "ST-80 compatibility:
8526
326e7dcb212a *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 8518
diff changeset
  2397
     return the methods first resource specs key. 
326e7dcb212a *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 8518
diff changeset
  2398
     Returns either nil, or a single symbol."
3052
f384e7082ee9 more resource stuff (VW compatibility)
Claus Gittinger <cg@exept.de>
parents: 3030
diff changeset
  2399
3387
dbe1b3cf7b83 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 3372
diff changeset
  2400
    |resources|
dbe1b3cf7b83 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 3372
diff changeset
  2401
dbe1b3cf7b83 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 3372
diff changeset
  2402
    (resources := self resources) notNil ifTrue:[
8526
326e7dcb212a *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 8518
diff changeset
  2403
        resources keysAndValuesDo:[:key :val|
326e7dcb212a *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 8518
diff changeset
  2404
            ^ key
326e7dcb212a *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 8518
diff changeset
  2405
        ].
3341
c5773eb96bd2 resource icons moved to class BrowserView
tz
parents: 3297
diff changeset
  2406
    ].
3387
dbe1b3cf7b83 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 3372
diff changeset
  2407
    ^ nil
3052
f384e7082ee9 more resource stuff (VW compatibility)
Claus Gittinger <cg@exept.de>
parents: 3030
diff changeset
  2408
!
f384e7082ee9 more resource stuff (VW compatibility)
Claus Gittinger <cg@exept.de>
parents: 3030
diff changeset
  2409
f384e7082ee9 more resource stuff (VW compatibility)
Claus Gittinger <cg@exept.de>
parents: 3030
diff changeset
  2410
resources
5894
ed6193fa6040 Define #isObsolete and fix various comments
Stefan Vogel <sv@exept.de>
parents: 5818
diff changeset
  2411
    "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
  2412
f384e7082ee9 more resource stuff (VW compatibility)
Claus Gittinger <cg@exept.de>
parents: 3030
diff changeset
  2413
    self hasResource ifFalse:[^ nil].
5721
5f97733ff519 methods now send change-notifications when the category changes
Claus Gittinger <cg@exept.de>
parents: 5704
diff changeset
  2414
    ^ self parseResources.
3052
f384e7082ee9 more resource stuff (VW compatibility)
Claus Gittinger <cg@exept.de>
parents: 3030
diff changeset
  2415
!
f384e7082ee9 more resource stuff (VW compatibility)
Claus Gittinger <cg@exept.de>
parents: 3030
diff changeset
  2416
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
  2417
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
  2418
    "return the selector under which I am found in my containingClasses
d600e08a5936 handle the case where a method has a sourceFileInfo, but the class has not
Claus Gittinger <cg@exept.de>
parents: 934
diff changeset
  2419
     method-table. 
d600e08a5936 handle the case where a method has a sourceFileInfo, but the class has not
Claus Gittinger <cg@exept.de>
parents: 934
diff changeset
  2420
     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
  2421
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
    "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
  2423
1851
4accc9fafd19 change #who to return a proper object
Claus Gittinger <cg@exept.de>
parents: 1813
diff changeset
  2424
    |who|
68
59faa75185ba *** empty log message ***
claus
parents: 56
diff changeset
  2425
1851
4accc9fafd19 change #who to return a proper object
Claus Gittinger <cg@exept.de>
parents: 1813
diff changeset
  2426
    who := self who.
4accc9fafd19 change #who to return a proper object
Claus Gittinger <cg@exept.de>
parents: 1813
diff changeset
  2427
    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
  2428
    "
d600e08a5936 handle the case where a method has a sourceFileInfo, but the class has not
Claus Gittinger <cg@exept.de>
parents: 934
diff changeset
  2429
     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
  2430
    "
d600e08a5936 handle the case where a method has a sourceFileInfo, but the class has not
Claus Gittinger <cg@exept.de>
parents: 934
diff changeset
  2431
    ^ 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
  2432
d600e08a5936 handle the case where a method has a sourceFileInfo, but the class has not
Claus Gittinger <cg@exept.de>
parents: 934
diff changeset
  2433
    "
d600e08a5936 handle the case where a method has a sourceFileInfo, but the class has not
Claus Gittinger <cg@exept.de>
parents: 934
diff changeset
  2434
     |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
  2435
     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
  2436
     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
  2437
    "
1851
4accc9fafd19 change #who to return a proper object
Claus Gittinger <cg@exept.de>
parents: 1813
diff changeset
  2438
4accc9fafd19 change #who to return a proper object
Claus Gittinger <cg@exept.de>
parents: 1813
diff changeset
  2439
    "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
  2440
!
68
59faa75185ba *** empty log message ***
claus
parents: 56
diff changeset
  2441
5534
bf00d9a2dfd5 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5530
diff changeset
  2442
sends:aSelectorSymbol
bf00d9a2dfd5 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5530
diff changeset
  2443
    "return true, if this method contains a message-send
bf00d9a2dfd5 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5530
diff changeset
  2444
     with aSelectorSymbol as selector."
bf00d9a2dfd5 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5530
diff changeset
  2445
bf00d9a2dfd5 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5530
diff changeset
  2446
    (self referencesLiteral:aSelectorSymbol) ifTrue:[
10207
b5ca553d15ad localSourceFirst for extensions.
Claus Gittinger <cg@exept.de>
parents: 10201
diff changeset
  2447
        ^ self messagesSent includesIdentical:aSelectorSymbol
5534
bf00d9a2dfd5 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5530
diff changeset
  2448
    ].
bf00d9a2dfd5 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5530
diff changeset
  2449
    ^ false
bf00d9a2dfd5 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5530
diff changeset
  2450
!
bf00d9a2dfd5 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5530
diff changeset
  2451
11022
8dd9f699915f +shouldBeSkippedInDebuggersWalkBack
Claus Gittinger <cg@exept.de>
parents: 11016
diff changeset
  2452
shouldBeSkippedInDebuggersWalkBack
8dd9f699915f +shouldBeSkippedInDebuggersWalkBack
Claus Gittinger <cg@exept.de>
parents: 11016
diff changeset
  2453
    "return true, if this method thinks, it should be skipped in a walkback.
8dd9f699915f +shouldBeSkippedInDebuggersWalkBack
Claus Gittinger <cg@exept.de>
parents: 11016
diff changeset
  2454
     This is done by looking for a #skipInDebuggersWalkBack flag in the methods resources."
8dd9f699915f +shouldBeSkippedInDebuggersWalkBack
Claus Gittinger <cg@exept.de>
parents: 11016
diff changeset
  2455
8dd9f699915f +shouldBeSkippedInDebuggersWalkBack
Claus Gittinger <cg@exept.de>
parents: 11016
diff changeset
  2456
    |resources|
8dd9f699915f +shouldBeSkippedInDebuggersWalkBack
Claus Gittinger <cg@exept.de>
parents: 11016
diff changeset
  2457
8dd9f699915f +shouldBeSkippedInDebuggersWalkBack
Claus Gittinger <cg@exept.de>
parents: 11016
diff changeset
  2458
    resources := self resources.
8dd9f699915f +shouldBeSkippedInDebuggersWalkBack
Claus Gittinger <cg@exept.de>
parents: 11016
diff changeset
  2459
    ^ resources notNil and:[ resources includesKey:#skipInDebuggersWalkBack ].
8dd9f699915f +shouldBeSkippedInDebuggersWalkBack
Claus Gittinger <cg@exept.de>
parents: 11016
diff changeset
  2460
!
8dd9f699915f +shouldBeSkippedInDebuggersWalkBack
Claus Gittinger <cg@exept.de>
parents: 11016
diff changeset
  2461
5696
958a0643496d compatibility
Claus Gittinger <cg@exept.de>
parents: 5676
diff changeset
  2462
superMessages
958a0643496d compatibility
Claus Gittinger <cg@exept.de>
parents: 5676
diff changeset
  2463
    "return a collection of message-selectors, sent to super by this method."
958a0643496d compatibility
Claus Gittinger <cg@exept.de>
parents: 5676
diff changeset
  2464
958a0643496d compatibility
Claus Gittinger <cg@exept.de>
parents: 5676
diff changeset
  2465
    ^ self messagesSentToSuper
958a0643496d compatibility
Claus Gittinger <cg@exept.de>
parents: 5676
diff changeset
  2466
!
958a0643496d compatibility
Claus Gittinger <cg@exept.de>
parents: 5676
diff changeset
  2467
5523
86ad12f4afc9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5509
diff changeset
  2468
usedGlobals
86ad12f4afc9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5509
diff changeset
  2469
    "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
  2470
     Uses Parser to parse methods source and extract them."
86ad12f4afc9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5509
diff changeset
  2471
5633
15b028ad5e03 #usedGlobals check was wrong sometimes
Claus Gittinger <cg@exept.de>
parents: 5584
diff changeset
  2472
    ^ self parse:#'parseMethodSilent:in:' with:self mclass return:#usedGlobals or:#() 
5523
86ad12f4afc9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5509
diff changeset
  2473
86ad12f4afc9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5509
diff changeset
  2474
    "
86ad12f4afc9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5509
diff changeset
  2475
     (Method compiledMethodAt:#resources) usedGlobals 
86ad12f4afc9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5509
diff changeset
  2476
    "
86ad12f4afc9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5509
diff changeset
  2477
!
86ad12f4afc9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5509
diff changeset
  2478
5509
c0277123fe4a added #usedSymbols query
Claus Gittinger <cg@exept.de>
parents: 5500
diff changeset
  2479
usedSymbols
c0277123fe4a added #usedSymbols query
Claus Gittinger <cg@exept.de>
parents: 5500
diff changeset
  2480
    "return a collection with the symbols referred to by the receiver.
c0277123fe4a added #usedSymbols query
Claus Gittinger <cg@exept.de>
parents: 5500
diff changeset
  2481
     Uses Parser to parse methods source and extract them.
8895
81e4e78ef244 comment
Claus Gittinger <cg@exept.de>
parents: 8854
diff changeset
  2482
     This collection only includes implicit symbols references 
81e4e78ef244 comment
Claus Gittinger <cg@exept.de>
parents: 8854
diff changeset
  2483
     (i.e. not messages sent)"
5509
c0277123fe4a added #usedSymbols query
Claus Gittinger <cg@exept.de>
parents: 5500
diff changeset
  2484
5634
47327d0e8dbb checkin from browser
Claus Gittinger <cg@exept.de>
parents: 5633
diff changeset
  2485
    ^ self parse:#'parseMethodSilent:in:' with:self mclass return:#usedSymbols or:#() 
5509
c0277123fe4a added #usedSymbols query
Claus Gittinger <cg@exept.de>
parents: 5500
diff changeset
  2486
c0277123fe4a added #usedSymbols query
Claus Gittinger <cg@exept.de>
parents: 5500
diff changeset
  2487
    "
c0277123fe4a added #usedSymbols query
Claus Gittinger <cg@exept.de>
parents: 5500
diff changeset
  2488
     (Method compiledMethodAt:#usedSymbols) usedSymbols 
8896
519261134330 comment
Claus Gittinger <cg@exept.de>
parents: 8895
diff changeset
  2489
     (Method compiledMethodAt:#usedSymbols) messagesSent 
5509
c0277123fe4a added #usedSymbols query
Claus Gittinger <cg@exept.de>
parents: 5500
diff changeset
  2490
    "
c0277123fe4a added #usedSymbols query
Claus Gittinger <cg@exept.de>
parents: 5500
diff changeset
  2491
!
c0277123fe4a added #usedSymbols query
Claus Gittinger <cg@exept.de>
parents: 5500
diff changeset
  2492
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
  2493
who
1851
4accc9fafd19 change #who to return a proper object
Claus Gittinger <cg@exept.de>
parents: 1813
diff changeset
  2494
    "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
  2495
     nil is returned for unbound methods.
4accc9fafd19 change #who to return a proper object
Claus Gittinger <cg@exept.de>
parents: 1813
diff changeset
  2496
4accc9fafd19 change #who to return a proper object
Claus Gittinger <cg@exept.de>
parents: 1813
diff changeset
  2497
     ST/X special notice: 
5665
9a0e73dc5efb cache mclass in #who
Claus Gittinger <cg@exept.de>
parents: 5652
diff changeset
  2498
        returns an instance of MethodWhoInfo, which
9a0e73dc5efb cache mclass in #who
Claus Gittinger <cg@exept.de>
parents: 5652
diff changeset
  2499
        responds to #methodClass and #methodSelector query messages.
9a0e73dc5efb cache mclass in #who
Claus Gittinger <cg@exept.de>
parents: 5652
diff changeset
  2500
        For backward- (& ST-80) compatibility, the returned object also
9a0e73dc5efb cache mclass in #who
Claus Gittinger <cg@exept.de>
parents: 5652
diff changeset
  2501
        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
  2502
4accc9fafd19 change #who to return a proper object
Claus Gittinger <cg@exept.de>
parents: 1813
diff changeset
  2503
     Implementation notice:
5665
9a0e73dc5efb cache mclass in #who
Claus Gittinger <cg@exept.de>
parents: 5652
diff changeset
  2504
        Since there is no information of the containing class 
9a0e73dc5efb cache mclass in #who
Claus Gittinger <cg@exept.de>
parents: 5652
diff changeset
  2505
        in the method, we have to do a search here.
9a0e73dc5efb cache mclass in #who
Claus Gittinger <cg@exept.de>
parents: 5652
diff changeset
  2506
9a0e73dc5efb cache mclass in #who
Claus Gittinger <cg@exept.de>
parents: 5652
diff changeset
  2507
        Normally, this is not a problem, except when a method is
9a0e73dc5efb cache mclass in #who
Claus Gittinger <cg@exept.de>
parents: 5652
diff changeset
  2508
        accepted in the debugger or redefined from within a method
9a0e73dc5efb cache mclass in #who
Claus Gittinger <cg@exept.de>
parents: 5652
diff changeset
  2509
        (maybe done indirectly, if #doIt is done recursively)
9a0e73dc5efb cache mclass in #who
Claus Gittinger <cg@exept.de>
parents: 5652
diff changeset
  2510
        - the information about which class the original method was 
9a0e73dc5efb cache mclass in #who
Claus Gittinger <cg@exept.de>
parents: 5652
diff changeset
  2511
        defined in is lost in this case.
68
59faa75185ba *** empty log message ***
claus
parents: 56
diff changeset
  2512
1851
4accc9fafd19 change #who to return a proper object
Claus Gittinger <cg@exept.de>
parents: 1813
diff changeset
  2513
     Problem: 
5665
9a0e73dc5efb cache mclass in #who
Claus Gittinger <cg@exept.de>
parents: 5652
diff changeset
  2514
        this is heavily called for in the debugger to create
9a0e73dc5efb cache mclass in #who
Claus Gittinger <cg@exept.de>
parents: 5652
diff changeset
  2515
        a readable context walkback. For unbound methods, it is
9a0e73dc5efb cache mclass in #who
Claus Gittinger <cg@exept.de>
parents: 5652
diff changeset
  2516
        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
  2517
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
  2518
     Q: should we add a backref from the method to the class 
5665
9a0e73dc5efb cache mclass in #who
Claus Gittinger <cg@exept.de>
parents: 5652
diff changeset
  2519
        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
  2520
     Q2: if so, what about the bad guy then, who copies methods around to
5665
9a0e73dc5efb cache mclass in #who
Claus Gittinger <cg@exept.de>
parents: 5652
diff changeset
  2521
         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
  2522
6420
ba05391a71af *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6397
diff changeset
  2523
    |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
  2524
5324
5c9959ce98af make use of mclass
Claus Gittinger <cg@exept.de>
parents: 5322
diff changeset
  2525
    mclass notNil ifTrue:[
5665
9a0e73dc5efb cache mclass in #who
Claus Gittinger <cg@exept.de>
parents: 5652
diff changeset
  2526
        sel := mclass selectorAtMethod:self.
9a0e73dc5efb cache mclass in #who
Claus Gittinger <cg@exept.de>
parents: 5652
diff changeset
  2527
        sel notNil ifTrue:[
9a0e73dc5efb cache mclass in #who
Claus Gittinger <cg@exept.de>
parents: 5652
diff changeset
  2528
            ^ MethodWhoInfo class:mclass selector:sel
9a0e73dc5efb cache mclass in #who
Claus Gittinger <cg@exept.de>
parents: 5652
diff changeset
  2529
        ].
5704
aeeece3a93ef flush mclass, if no longer valid
Claus Gittinger <cg@exept.de>
parents: 5700
diff changeset
  2530
        "/ flush outdated mclass info
aeeece3a93ef flush mclass, if no longer valid
Claus Gittinger <cg@exept.de>
parents: 5700
diff changeset
  2531
        mclass := nil.
5324
5c9959ce98af make use of mclass
Claus Gittinger <cg@exept.de>
parents: 5322
diff changeset
  2532
    ].
5c9959ce98af make use of mclass
Claus Gittinger <cg@exept.de>
parents: 5322
diff changeset
  2533
6420
ba05391a71af *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6397
diff changeset
  2534
    checkBlock := [:cls |
ba05391a71af *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6397
diff changeset
  2535
        |sel|
ba05391a71af *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6397
diff changeset
  2536
ba05391a71af *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6397
diff changeset
  2537
        sel := cls selectorAtMethod:self.
ba05391a71af *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6397
diff changeset
  2538
        sel notNil ifTrue:[
ba05391a71af *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6397
diff changeset
  2539
            LastWhoClass := cls theNonMetaclass name.
ba05391a71af *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6397
diff changeset
  2540
            mclass isNil ifTrue:[
ba05391a71af *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6397
diff changeset
  2541
                mclass := cls
ba05391a71af *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6397
diff changeset
  2542
            ].
ba05391a71af *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6397
diff changeset
  2543
            ^ MethodWhoInfo class:cls selector:sel
ba05391a71af *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6397
diff changeset
  2544
        ].
ba05391a71af *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6397
diff changeset
  2545
    ].
ba05391a71af *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6397
diff changeset
  2546
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
  2547
    "
5294
f2d689cf7be4 speedup #who (guess className from sourceFileName)
Claus Gittinger <cg@exept.de>
parents: 5284
diff changeset
  2548
     speedup kludge: if my sourceFileName is valid,
f2d689cf7be4 speedup #who (guess className from sourceFileName)
Claus Gittinger <cg@exept.de>
parents: 5284
diff changeset
  2549
     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
  2550
    "
f2d689cf7be4 speedup #who (guess className from sourceFileName)
Claus Gittinger <cg@exept.de>
parents: 5284
diff changeset
  2551
    (fn := self sourceFilename) notNil ifTrue:[
10156
d35f30a7fde5 changed #who
Claus Gittinger <cg@exept.de>
parents: 10083
diff changeset
  2552
        clsName := fn asFilename nameWithoutSuffix.
5665
9a0e73dc5efb cache mclass in #who
Claus Gittinger <cg@exept.de>
parents: 5652
diff changeset
  2553
        clsName := clsName asSymbolIfInterned.
9a0e73dc5efb cache mclass in #who
Claus Gittinger <cg@exept.de>
parents: 5652
diff changeset
  2554
        clsName notNil ifTrue:[
9a0e73dc5efb cache mclass in #who
Claus Gittinger <cg@exept.de>
parents: 5652
diff changeset
  2555
            cls := Smalltalk at:clsName ifAbsent:nil.
9a0e73dc5efb cache mclass in #who
Claus Gittinger <cg@exept.de>
parents: 5652
diff changeset
  2556
            cls notNil ifTrue:[
6420
ba05391a71af *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6397
diff changeset
  2557
                checkBlock value:cls theNonMetaclass.
ba05391a71af *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6397
diff changeset
  2558
                checkBlock value:cls theMetaclass.
5665
9a0e73dc5efb cache mclass in #who
Claus Gittinger <cg@exept.de>
parents: 5652
diff changeset
  2559
            ]
9a0e73dc5efb cache mclass in #who
Claus Gittinger <cg@exept.de>
parents: 5652
diff changeset
  2560
        ].
5294
f2d689cf7be4 speedup #who (guess className from sourceFileName)
Claus Gittinger <cg@exept.de>
parents: 5284
diff changeset
  2561
    ].
f2d689cf7be4 speedup #who (guess className from sourceFileName)
Claus Gittinger <cg@exept.de>
parents: 5284
diff changeset
  2562
f2d689cf7be4 speedup #who (guess className from sourceFileName)
Claus Gittinger <cg@exept.de>
parents: 5284
diff changeset
  2563
    "
f2d689cf7be4 speedup #who (guess className from sourceFileName)
Claus Gittinger <cg@exept.de>
parents: 5284
diff changeset
  2564
     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
  2565
     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
  2566
     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
  2567
     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
  2568
    "
d600e08a5936 handle the case where a method has a sourceFileInfo, but the class has not
Claus Gittinger <cg@exept.de>
parents: 934
diff changeset
  2569
    LastWhoClass notNil ifTrue:[
5665
9a0e73dc5efb cache mclass in #who
Claus Gittinger <cg@exept.de>
parents: 5652
diff changeset
  2570
        cls := Smalltalk at:LastWhoClass ifAbsent:nil.
9a0e73dc5efb cache mclass in #who
Claus Gittinger <cg@exept.de>
parents: 5652
diff changeset
  2571
        cls notNil ifTrue:[
6420
ba05391a71af *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6397
diff changeset
  2572
            checkBlock value:cls theNonMetaclass.
ba05391a71af *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6397
diff changeset
  2573
            checkBlock value:cls theMetaclass.
5665
9a0e73dc5efb cache mclass in #who
Claus Gittinger <cg@exept.de>
parents: 5652
diff changeset
  2574
        ]
68
59faa75185ba *** empty log message ***
claus
parents: 56
diff changeset
  2575
    ].
227
23b1c4de3402 package & cleanup
claus
parents: 216
diff changeset
  2576
142
c7844287bddf *** empty log message ***
claus
parents: 109
diff changeset
  2577
    "
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
  2578
     first, limit the search to global classes only - 
d600e08a5936 handle the case where a method has a sourceFileInfo, but the class has not
Claus Gittinger <cg@exept.de>
parents: 934
diff changeset
  2579
     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
  2580
    "
d600e08a5936 handle the case where a method has a sourceFileInfo, but the class has not
Claus Gittinger <cg@exept.de>
parents: 934
diff changeset
  2581
    classes := Smalltalk allClasses.
142
c7844287bddf *** empty log message ***
claus
parents: 109
diff changeset
  2582
    "
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
  2583
     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
  2584
    "
6420
ba05391a71af *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6397
diff changeset
  2585
    classes do:[:cls |
ba05391a71af *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6397
diff changeset
  2586
        checkBlock value:cls theNonMetaclass.
ba05391a71af *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6397
diff changeset
  2587
        checkBlock value:cls theMetaclass.
142
c7844287bddf *** empty log message ***
claus
parents: 109
diff changeset
  2588
    ].
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
  2589
d600e08a5936 handle the case where a method has a sourceFileInfo, but the class has not
Claus Gittinger <cg@exept.de>
parents: 934
diff changeset
  2590
    LastWhoClass := nil.
6397
311358bdeed6 do not search for anonymous classes in #who
Claus Gittinger <cg@exept.de>
parents: 6365
diff changeset
  2591
"/    "
311358bdeed6 do not search for anonymous classes in #who
Claus Gittinger <cg@exept.de>
parents: 6365
diff changeset
  2592
"/     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
  2593
"/     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
  2594
"/    "
6420
ba05391a71af *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6397
diff changeset
  2595
"/    Behavior allSubInstancesDo:[:someClassLikeThingy |
ba05391a71af *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6397
diff changeset
  2596
"/        (classes includes:someClassLikeThingy) ifFalse:[
ba05391a71af *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 6397
diff changeset
  2597
"/            checkBlock value:someClassLikeThingy.
6397
311358bdeed6 do not search for anonymous classes in #who
Claus Gittinger <cg@exept.de>
parents: 6365
diff changeset
  2598
"/        ]
311358bdeed6 do not search for anonymous classes in #who
Claus Gittinger <cg@exept.de>
parents: 6365
diff changeset
  2599
"/    ].
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
  2600
    "
d600e08a5936 handle the case where a method has a sourceFileInfo, but the class has not
Claus Gittinger <cg@exept.de>
parents: 934
diff changeset
  2601
     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
  2602
    "
d600e08a5936 handle the case where a method has a sourceFileInfo, but the class has not
Claus Gittinger <cg@exept.de>
parents: 934
diff changeset
  2603
    ^ nil
444
071b4f32272c *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 443
diff changeset
  2604
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
  2605
    "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
  2606
    "
d600e08a5936 handle the case where a method has a sourceFileInfo, but the class has not
Claus Gittinger <cg@exept.de>
parents: 934
diff changeset
  2607
     |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
  2608
     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
  2609
     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
  2610
    "
d600e08a5936 handle the case where a method has a sourceFileInfo, but the class has not
Claus Gittinger <cg@exept.de>
parents: 934
diff changeset
  2611
d600e08a5936 handle the case where a method has a sourceFileInfo, but the class has not
Claus Gittinger <cg@exept.de>
parents: 934
diff changeset
  2612
    "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
  2613
    "
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
     |m cls|
444
071b4f32272c *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 443
diff changeset
  2615
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
  2616
     Object 
5665
9a0e73dc5efb cache mclass in #who
Claus Gittinger <cg@exept.de>
parents: 5652
diff changeset
  2617
        subclass:#FunnyClass 
9a0e73dc5efb cache mclass in #who
Claus Gittinger <cg@exept.de>
parents: 5652
diff changeset
  2618
        instanceVariableNames:'foo'
9a0e73dc5efb cache mclass in #who
Claus Gittinger <cg@exept.de>
parents: 5652
diff changeset
  2619
        classVariableNames:''
9a0e73dc5efb cache mclass in #who
Claus Gittinger <cg@exept.de>
parents: 5652
diff changeset
  2620
        poolDictionaries:''
9a0e73dc5efb cache mclass in #who
Claus Gittinger <cg@exept.de>
parents: 5652
diff changeset
  2621
        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
  2622
     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
  2623
     Smalltalk removeClass:cls.
444
071b4f32272c *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 443
diff changeset
  2624
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
     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
  2626
     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
  2627
     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
  2628
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
     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
  2630
    "
1851
4accc9fafd19 change #who to return a proper object
Claus Gittinger <cg@exept.de>
parents: 1813
diff changeset
  2631
10156
d35f30a7fde5 changed #who
Claus Gittinger <cg@exept.de>
parents: 10083
diff changeset
  2632
    "Modified: / 07-11-2006 / 13:58:50 / cg"
68
59faa75185ba *** empty log message ***
claus
parents: 56
diff changeset
  2633
!
59faa75185ba *** empty log message ***
claus
parents: 56
diff changeset
  2634
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
  2635
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
  2636
    "only for wrapped methods: return the 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
  2637
     Thats the WrapperMethod which contains myself."
159
514c749165c3 *** empty log message ***
claus
parents: 142
diff changeset
  2638
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
  2639
    WrappedMethod allInstancesDo:[:m |
10207
b5ca553d15ad localSourceFirst for extensions.
Claus Gittinger <cg@exept.de>
parents: 10201
diff changeset
  2640
        m originalMethod == self ifTrue:[^ m].
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
  2641
    ].
d600e08a5936 handle the case where a method has a sourceFileInfo, but the class has not
Claus Gittinger <cg@exept.de>
parents: 934
diff changeset
  2642
    ^ nil
5564
0f513f04c50f #readsFields: and #writesField: for st80 compatibility
Claus Gittinger <cg@exept.de>
parents: 5562
diff changeset
  2643
!
0f513f04c50f #readsFields: and #writesField: for st80 compatibility
Claus Gittinger <cg@exept.de>
parents: 5562
diff changeset
  2644
0f513f04c50f #readsFields: and #writesField: for st80 compatibility
Claus Gittinger <cg@exept.de>
parents: 5562
diff changeset
  2645
writesField:instVarIndex
0f513f04c50f #readsFields: and #writesField: for st80 compatibility
Claus Gittinger <cg@exept.de>
parents: 5562
diff changeset
  2646
    "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
  2647
     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
  2648
0f513f04c50f #readsFields: and #writesField: for st80 compatibility
Claus Gittinger <cg@exept.de>
parents: 5562
diff changeset
  2649
    |varName modifiedInstVars|
0f513f04c50f #readsFields: and #writesField: for st80 compatibility
Claus Gittinger <cg@exept.de>
parents: 5562
diff changeset
  2650
0f513f04c50f #readsFields: and #writesField: for st80 compatibility
Claus Gittinger <cg@exept.de>
parents: 5562
diff changeset
  2651
    varName := (self mclass allInstVarNames) at:instVarIndex.
5636
eab6a71fb3d0 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5634
diff changeset
  2652
    modifiedInstVars := self parse:#'parseMethodSilent:in:' with:self mclass return:#modifiedInstVars or:#().
5564
0f513f04c50f #readsFields: and #writesField: for st80 compatibility
Claus Gittinger <cg@exept.de>
parents: 5562
diff changeset
  2653
    ^ modifiedInstVars includes:varName.
952
d600e08a5936 handle the case where a method has a sourceFileInfo, but the class has not
Claus Gittinger <cg@exept.de>
parents: 934
diff changeset
  2654
! !
13
62303f84ff5f *** empty log message ***
claus
parents: 10
diff changeset
  2655
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
  2656
!Method methodsFor:'trap methods'!
13
62303f84ff5f *** empty log message ***
claus
parents: 10
diff changeset
  2657
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
  2658
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
  2659
    "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
  2660
     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
  2661
     the objectFileLoader to invalidate methods whose code is unloaded."
1
a27a279701f8 Initial revision
claus
parents:
diff changeset
  2662
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
  2663
    |invldMethod|
159
514c749165c3 *** empty log message ***
claus
parents: 142
diff changeset
  2664
1873
3544a4a94a2a checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1870
diff changeset
  2665
    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
  2666
    self code:invldMethod code.
1873
3544a4a94a2a checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1870
diff changeset
  2667
    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
  2668
d600e08a5936 handle the case where a method has a sourceFileInfo, but the class has not
Claus Gittinger <cg@exept.de>
parents: 934
diff changeset
  2669
    "Created: 17.9.1995 / 15:00:52 / claus"
1873
3544a4a94a2a checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1870
diff changeset
  2670
    "Modified: 4.11.1996 / 23:04:34 / cg"
1
a27a279701f8 Initial revision
claus
parents:
diff changeset
  2671
!
a27a279701f8 Initial revision
claus
parents:
diff changeset
  2672
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
  2673
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
  2674
    "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
  2675
     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
  2676
     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
  2677
     after a class definition change (for example: instvars are no longer there)."
1
a27a279701f8 Initial revision
claus
parents:
diff changeset
  2678
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
  2679
    |invldMethod|
872
af04035b443d binary class storage support
Claus Gittinger <cg@exept.de>
parents: 829
diff changeset
  2680
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
  2681
    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
  2682
    self code:invldMethod code.
1873
3544a4a94a2a checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1870
diff changeset
  2683
    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
  2684
d600e08a5936 handle the case where a method has a sourceFileInfo, but the class has not
Claus Gittinger <cg@exept.de>
parents: 934
diff changeset
  2685
    "Created: 17.9.1995 / 15:01:14 / claus"
1873
3544a4a94a2a checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1870
diff changeset
  2686
    "Modified: 4.11.1996 / 23:04:46 / cg"
3544a4a94a2a checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1870
diff changeset
  2687
!
3544a4a94a2a checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1870
diff changeset
  2688
3544a4a94a2a checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1870
diff changeset
  2689
makeUnloaded
3544a4a94a2a checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1870
diff changeset
  2690
    "make the receiver an unloaded method, which raises an invalidCodeObject
3544a4a94a2a checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1870
diff changeset
  2691
     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
  2692
     the objectFileLoader to invalidate methods for which a shared library has
3544a4a94a2a checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1870
diff changeset
  2693
     been removed."
3544a4a94a2a checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1870
diff changeset
  2694
3544a4a94a2a checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1870
diff changeset
  2695
    |invldMethod|
3544a4a94a2a checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1870
diff changeset
  2696
3544a4a94a2a checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1870
diff changeset
  2697
    invldMethod := self class compiledMethodAt:#unloadedCodeObject.
3544a4a94a2a checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1870
diff changeset
  2698
    self code:invldMethod code.
3544a4a94a2a checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1870
diff changeset
  2699
    self byteCode:nil.
3544a4a94a2a checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1870
diff changeset
  2700
3544a4a94a2a checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1870
diff changeset
  2701
    "Created: 4.11.1996 / 22:59:21 / cg"
3544a4a94a2a checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1870
diff changeset
  2702
    "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
  2703
!
2623b60c27e1 lifted numVars; added access for invalidCodeObject-trappers
Claus Gittinger <cg@exept.de>
parents: 1855
diff changeset
  2704
2623b60c27e1 lifted numVars; added access for invalidCodeObject-trappers
Claus Gittinger <cg@exept.de>
parents: 1855
diff changeset
  2705
trapMethodForNumArgs:numArgs
2623b60c27e1 lifted numVars; added access for invalidCodeObject-trappers
Claus Gittinger <cg@exept.de>
parents: 1855
diff changeset
  2706
    |trapSel|
2623b60c27e1 lifted numVars; added access for invalidCodeObject-trappers
Claus Gittinger <cg@exept.de>
parents: 1855
diff changeset
  2707
2623b60c27e1 lifted numVars; added access for invalidCodeObject-trappers
Claus Gittinger <cg@exept.de>
parents: 1855
diff changeset
  2708
    trapSel := #(
10207
b5ca553d15ad localSourceFirst for extensions.
Claus Gittinger <cg@exept.de>
parents: 10201
diff changeset
  2709
                  #'invalidCodeObject'
b5ca553d15ad localSourceFirst for extensions.
Claus Gittinger <cg@exept.de>
parents: 10201
diff changeset
  2710
                  #'invalidCodeObjectWith:'
b5ca553d15ad localSourceFirst for extensions.
Claus Gittinger <cg@exept.de>
parents: 10201
diff changeset
  2711
                  #'invalidCodeObjectWith:with:'
b5ca553d15ad localSourceFirst for extensions.
Claus Gittinger <cg@exept.de>
parents: 10201
diff changeset
  2712
                  #'invalidCodeObjectWith:with:with:'
b5ca553d15ad localSourceFirst for extensions.
Claus Gittinger <cg@exept.de>
parents: 10201
diff changeset
  2713
                  #'invalidCodeObjectWith:with:with:with:'
b5ca553d15ad localSourceFirst for extensions.
Claus Gittinger <cg@exept.de>
parents: 10201
diff changeset
  2714
                  #'invalidCodeObjectWith:with:with:with:with:'
b5ca553d15ad localSourceFirst for extensions.
Claus Gittinger <cg@exept.de>
parents: 10201
diff changeset
  2715
                  #'invalidCodeObjectWith:with:with:with:with:with:'
b5ca553d15ad localSourceFirst for extensions.
Claus Gittinger <cg@exept.de>
parents: 10201
diff changeset
  2716
                  #'invalidCodeObjectWith:with:with:with:with:with:with:'
b5ca553d15ad localSourceFirst for extensions.
Claus Gittinger <cg@exept.de>
parents: 10201
diff changeset
  2717
                  #'invalidCodeObjectWith:with:with:with:with:with:with:with:'
b5ca553d15ad localSourceFirst for extensions.
Claus Gittinger <cg@exept.de>
parents: 10201
diff changeset
  2718
                  #'invalidCodeObjectWith:with:with:with:with:with:with:with:with:'
b5ca553d15ad localSourceFirst for extensions.
Claus Gittinger <cg@exept.de>
parents: 10201
diff changeset
  2719
                  #'invalidCodeObjectWith:with:with:with:with:with:with:with:with:with:'
b5ca553d15ad localSourceFirst for extensions.
Claus Gittinger <cg@exept.de>
parents: 10201
diff changeset
  2720
                  #'invalidCodeObjectWith:with:with:with:with:with:with:with:with:with:with:'
b5ca553d15ad localSourceFirst for extensions.
Claus Gittinger <cg@exept.de>
parents: 10201
diff changeset
  2721
                  #'invalidCodeObjectWith:with:with:with:with:with:with:with:with:with:with:with:'
b5ca553d15ad localSourceFirst for extensions.
Claus Gittinger <cg@exept.de>
parents: 10201
diff changeset
  2722
                  #'invalidCodeObjectWith:with:with:with:with:with:with:with:with:with:with:with:with:'
b5ca553d15ad localSourceFirst for extensions.
Claus Gittinger <cg@exept.de>
parents: 10201
diff changeset
  2723
                  #'invalidCodeObjectWith:with:with:with:with:with:with:with:with:with:with:with:with:with:'
b5ca553d15ad localSourceFirst for extensions.
Claus Gittinger <cg@exept.de>
parents: 10201
diff changeset
  2724
                  #'invalidCodeObjectWith:with:with:with:with:with:with:with:with:with:with:with:with:with:with:'
b5ca553d15ad localSourceFirst for extensions.
Claus Gittinger <cg@exept.de>
parents: 10201
diff changeset
  2725
                ) at:(numArgs + 1).
1870
2623b60c27e1 lifted numVars; added access for invalidCodeObject-trappers
Claus Gittinger <cg@exept.de>
parents: 1855
diff changeset
  2726
2623b60c27e1 lifted numVars; added access for invalidCodeObject-trappers
Claus Gittinger <cg@exept.de>
parents: 1855
diff changeset
  2727
    ^ Method compiledMethodAt:trapSel.
2623b60c27e1 lifted numVars; added access for invalidCodeObject-trappers
Claus Gittinger <cg@exept.de>
parents: 1855
diff changeset
  2728
2623b60c27e1 lifted numVars; added access for invalidCodeObject-trappers
Claus Gittinger <cg@exept.de>
parents: 1855
diff changeset
  2729
    "Created: 4.11.1996 / 21:58:58 / cg"
1873
3544a4a94a2a checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1870
diff changeset
  2730
    "Modified: 4.11.1996 / 23:18:05 / 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
  2731
! !
872
af04035b443d binary class storage support
Claus Gittinger <cg@exept.de>
parents: 829
diff changeset
  2732
2022
24529e2b7cee commentary for MethodWhoInfo
Claus Gittinger <cg@exept.de>
parents: 1995
diff changeset
  2733
!Method::MethodWhoInfo class methodsFor:'documentation'!
24529e2b7cee commentary for MethodWhoInfo
Claus Gittinger <cg@exept.de>
parents: 1995
diff changeset
  2734
24529e2b7cee commentary for MethodWhoInfo
Claus Gittinger <cg@exept.de>
parents: 1995
diff changeset
  2735
documentation
24529e2b7cee commentary for MethodWhoInfo
Claus Gittinger <cg@exept.de>
parents: 1995
diff changeset
  2736
"
24529e2b7cee commentary for MethodWhoInfo
Claus Gittinger <cg@exept.de>
parents: 1995
diff changeset
  2737
    In earlier times, Method>>who returned an array filled
24529e2b7cee commentary for MethodWhoInfo
Claus Gittinger <cg@exept.de>
parents: 1995
diff changeset
  2738
    with the methods class and selector.
24529e2b7cee commentary for MethodWhoInfo
Claus Gittinger <cg@exept.de>
parents: 1995
diff changeset
  2739
    This was done, since a smalltalk method cannot return multiple
24529e2b7cee commentary for MethodWhoInfo
Claus Gittinger <cg@exept.de>
parents: 1995
diff changeset
  2740
    values, but 2 values had to be returned from that method.
24529e2b7cee commentary for MethodWhoInfo
Claus Gittinger <cg@exept.de>
parents: 1995
diff changeset
  2741
    Thus, the who-interface was used as:
10207
b5ca553d15ad localSourceFirst for extensions.
Claus Gittinger <cg@exept.de>
parents: 10201
diff changeset
  2742
        info := <someMethod> who.
b5ca553d15ad localSourceFirst for extensions.
Claus Gittinger <cg@exept.de>
parents: 10201
diff changeset
  2743
        class := info at:1.
b5ca553d15ad localSourceFirst for extensions.
Claus Gittinger <cg@exept.de>
parents: 10201
diff changeset
  2744
        sel := info at:2.
2022
24529e2b7cee commentary for MethodWhoInfo
Claus Gittinger <cg@exept.de>
parents: 1995
diff changeset
  2745
24529e2b7cee commentary for MethodWhoInfo
Claus Gittinger <cg@exept.de>
parents: 1995
diff changeset
  2746
    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
  2747
    an object (an instance of MethodWhoInfo) which responds to the two
24529e2b7cee commentary for MethodWhoInfo
Claus Gittinger <cg@exept.de>
parents: 1995
diff changeset
  2748
    messages: #methodClass and #methodSelector.
24529e2b7cee commentary for MethodWhoInfo
Claus Gittinger <cg@exept.de>
parents: 1995
diff changeset
  2749
    This allows to write things much more intuitive:
10207
b5ca553d15ad localSourceFirst for extensions.
Claus Gittinger <cg@exept.de>
parents: 10201
diff changeset
  2750
        info := <someMethod> who.
b5ca553d15ad localSourceFirst for extensions.
Claus Gittinger <cg@exept.de>
parents: 10201
diff changeset
  2751
        class := info methodClass.
b5ca553d15ad localSourceFirst for extensions.
Claus Gittinger <cg@exept.de>
parents: 10201
diff changeset
  2752
        sel := info methodSelector.
2022
24529e2b7cee commentary for MethodWhoInfo
Claus Gittinger <cg@exept.de>
parents: 1995
diff changeset
  2753
24529e2b7cee commentary for MethodWhoInfo
Claus Gittinger <cg@exept.de>
parents: 1995
diff changeset
  2754
    However, to be backward compatible, the returned object still responds to
24529e2b7cee commentary for MethodWhoInfo
Claus Gittinger <cg@exept.de>
parents: 1995
diff changeset
  2755
    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
  2756
24529e2b7cee commentary for MethodWhoInfo
Claus Gittinger <cg@exept.de>
parents: 1995
diff changeset
  2757
    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
  2758
    classes.
2242
5037033b8002 commentary
Claus Gittinger <cg@exept.de>
parents: 2218
diff changeset
  2759
5037033b8002 commentary
Claus Gittinger <cg@exept.de>
parents: 2218
diff changeset
  2760
    [author:]
10207
b5ca553d15ad localSourceFirst for extensions.
Claus Gittinger <cg@exept.de>
parents: 10201
diff changeset
  2761
        Claus Gittinger
2242
5037033b8002 commentary
Claus Gittinger <cg@exept.de>
parents: 2218
diff changeset
  2762
5037033b8002 commentary
Claus Gittinger <cg@exept.de>
parents: 2218
diff changeset
  2763
    [see also:]
10207
b5ca553d15ad localSourceFirst for extensions.
Claus Gittinger <cg@exept.de>
parents: 10201
diff changeset
  2764
        Method
2022
24529e2b7cee commentary for MethodWhoInfo
Claus Gittinger <cg@exept.de>
parents: 1995
diff changeset
  2765
"
24529e2b7cee commentary for MethodWhoInfo
Claus Gittinger <cg@exept.de>
parents: 1995
diff changeset
  2766
! !
24529e2b7cee commentary for MethodWhoInfo
Claus Gittinger <cg@exept.de>
parents: 1995
diff changeset
  2767
1851
4accc9fafd19 change #who to return a proper object
Claus Gittinger <cg@exept.de>
parents: 1813
diff changeset
  2768
!Method::MethodWhoInfo class methodsFor:'instance creation'!
4accc9fafd19 change #who to return a proper object
Claus Gittinger <cg@exept.de>
parents: 1813
diff changeset
  2769
4accc9fafd19 change #who to return a proper object
Claus Gittinger <cg@exept.de>
parents: 1813
diff changeset
  2770
class:cls selector:sel
2023
4c6416d1a54d checkin from browser
Claus Gittinger <cg@exept.de>
parents: 2022
diff changeset
  2771
    "return a new MethodWhoInfo object;
4c6416d1a54d checkin from browser
Claus Gittinger <cg@exept.de>
parents: 2022
diff changeset
  2772
     this is a private interface for Method"
4c6416d1a54d checkin from browser
Claus Gittinger <cg@exept.de>
parents: 2022
diff changeset
  2773
1851
4accc9fafd19 change #who to return a proper object
Claus Gittinger <cg@exept.de>
parents: 1813
diff changeset
  2774
    ^ self basicNew class:cls selector:sel
2023
4c6416d1a54d checkin from browser
Claus Gittinger <cg@exept.de>
parents: 2022
diff changeset
  2775
4c6416d1a54d checkin from browser
Claus Gittinger <cg@exept.de>
parents: 2022
diff changeset
  2776
    "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
  2777
! !
4accc9fafd19 change #who to return a proper object
Claus Gittinger <cg@exept.de>
parents: 1813
diff changeset
  2778
4accc9fafd19 change #who to return a proper object
Claus Gittinger <cg@exept.de>
parents: 1813
diff changeset
  2779
!Method::MethodWhoInfo methodsFor:'accessing'!
4accc9fafd19 change #who to return a proper object
Claus Gittinger <cg@exept.de>
parents: 1813
diff changeset
  2780
4669
828addb1c376 source code access - care for package different from my classes
Claus Gittinger <cg@exept.de>
parents: 4595
diff changeset
  2781
method
828addb1c376 source code access - care for package different from my classes
Claus Gittinger <cg@exept.de>
parents: 4595
diff changeset
  2782
    ^ myClass compiledMethodAt:mySelector
828addb1c376 source code access - care for package different from my classes
Claus Gittinger <cg@exept.de>
parents: 4595
diff changeset
  2783
!
828addb1c376 source code access - care for package different from my classes
Claus Gittinger <cg@exept.de>
parents: 4595
diff changeset
  2784
1851
4accc9fafd19 change #who to return a proper object
Claus Gittinger <cg@exept.de>
parents: 1813
diff changeset
  2785
methodClass
2022
24529e2b7cee commentary for MethodWhoInfo
Claus Gittinger <cg@exept.de>
parents: 1995
diff changeset
  2786
    "return the class which contains the method represented by myself"
24529e2b7cee commentary for MethodWhoInfo
Claus Gittinger <cg@exept.de>
parents: 1995
diff changeset
  2787
1851
4accc9fafd19 change #who to return a proper object
Claus Gittinger <cg@exept.de>
parents: 1813
diff changeset
  2788
    ^ myClass
2022
24529e2b7cee commentary for MethodWhoInfo
Claus Gittinger <cg@exept.de>
parents: 1995
diff changeset
  2789
24529e2b7cee commentary for MethodWhoInfo
Claus Gittinger <cg@exept.de>
parents: 1995
diff changeset
  2790
    "
24529e2b7cee commentary for MethodWhoInfo
Claus Gittinger <cg@exept.de>
parents: 1995
diff changeset
  2791
     (Method compiledMethodAt:#who) who methodClass
24529e2b7cee commentary for MethodWhoInfo
Claus Gittinger <cg@exept.de>
parents: 1995
diff changeset
  2792
     (Method::MethodWhoInfo compiledMethodAt:#methodClass) who methodClass
24529e2b7cee commentary for MethodWhoInfo
Claus Gittinger <cg@exept.de>
parents: 1995
diff changeset
  2793
    "
24529e2b7cee commentary for MethodWhoInfo
Claus Gittinger <cg@exept.de>
parents: 1995
diff changeset
  2794
24529e2b7cee commentary for MethodWhoInfo
Claus Gittinger <cg@exept.de>
parents: 1995
diff changeset
  2795
    "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
  2796
!
4accc9fafd19 change #who to return a proper object
Claus Gittinger <cg@exept.de>
parents: 1813
diff changeset
  2797
4accc9fafd19 change #who to return a proper object
Claus Gittinger <cg@exept.de>
parents: 1813
diff changeset
  2798
methodSelector
2022
24529e2b7cee commentary for MethodWhoInfo
Claus Gittinger <cg@exept.de>
parents: 1995
diff changeset
  2799
    "return the selector under which the the method represented by myself
24529e2b7cee commentary for MethodWhoInfo
Claus Gittinger <cg@exept.de>
parents: 1995
diff changeset
  2800
     is found in the class"
24529e2b7cee commentary for MethodWhoInfo
Claus Gittinger <cg@exept.de>
parents: 1995
diff changeset
  2801
1851
4accc9fafd19 change #who to return a proper object
Claus Gittinger <cg@exept.de>
parents: 1813
diff changeset
  2802
    ^ mySelector
2022
24529e2b7cee commentary for MethodWhoInfo
Claus Gittinger <cg@exept.de>
parents: 1995
diff changeset
  2803
24529e2b7cee commentary for MethodWhoInfo
Claus Gittinger <cg@exept.de>
parents: 1995
diff changeset
  2804
    "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
  2805
! !
4accc9fafd19 change #who to return a proper object
Claus Gittinger <cg@exept.de>
parents: 1813
diff changeset
  2806
4accc9fafd19 change #who to return a proper object
Claus Gittinger <cg@exept.de>
parents: 1813
diff changeset
  2807
!Method::MethodWhoInfo methodsFor:'compatibility'!
4accc9fafd19 change #who to return a proper object
Claus Gittinger <cg@exept.de>
parents: 1813
diff changeset
  2808
4accc9fafd19 change #who to return a proper object
Claus Gittinger <cg@exept.de>
parents: 1813
diff changeset
  2809
at:index
4accc9fafd19 change #who to return a proper object
Claus Gittinger <cg@exept.de>
parents: 1813
diff changeset
  2810
    "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
  2811
4accc9fafd19 change #who to return a proper object
Claus Gittinger <cg@exept.de>
parents: 1813
diff changeset
  2812
    index == 1 ifTrue:[
7219
7c7b9d76af21 subscriptBoundsError -> subscriptBoundsError:
Claus Gittinger <cg@exept.de>
parents: 7210
diff changeset
  2813
        ^ myClass
1851
4accc9fafd19 change #who to return a proper object
Claus Gittinger <cg@exept.de>
parents: 1813
diff changeset
  2814
    ].
4accc9fafd19 change #who to return a proper object
Claus Gittinger <cg@exept.de>
parents: 1813
diff changeset
  2815
    index == 2 ifTrue:[
7219
7c7b9d76af21 subscriptBoundsError -> subscriptBoundsError:
Claus Gittinger <cg@exept.de>
parents: 7210
diff changeset
  2816
        ^ mySelector
1851
4accc9fafd19 change #who to return a proper object
Claus Gittinger <cg@exept.de>
parents: 1813
diff changeset
  2817
    ].
4accc9fafd19 change #who to return a proper object
Claus Gittinger <cg@exept.de>
parents: 1813
diff changeset
  2818
4accc9fafd19 change #who to return a proper object
Claus Gittinger <cg@exept.de>
parents: 1813
diff changeset
  2819
    "/ sigh - full compatibility ?
7219
7c7b9d76af21 subscriptBoundsError -> subscriptBoundsError:
Claus Gittinger <cg@exept.de>
parents: 7210
diff changeset
  2820
    ^ self indexNotIntegerOrOutOfBounds:index
1851
4accc9fafd19 change #who to return a proper object
Claus Gittinger <cg@exept.de>
parents: 1813
diff changeset
  2821
! !
4accc9fafd19 change #who to return a proper object
Claus Gittinger <cg@exept.de>
parents: 1813
diff changeset
  2822
7258
9ccdbee7d1ad method category rename
Claus Gittinger <cg@exept.de>
parents: 7219
diff changeset
  2823
!Method::MethodWhoInfo methodsFor:'private-accessing'!
1851
4accc9fafd19 change #who to return a proper object
Claus Gittinger <cg@exept.de>
parents: 1813
diff changeset
  2824
4accc9fafd19 change #who to return a proper object
Claus Gittinger <cg@exept.de>
parents: 1813
diff changeset
  2825
class:cls selector:sel
4accc9fafd19 change #who to return a proper object
Claus Gittinger <cg@exept.de>
parents: 1813
diff changeset
  2826
    myClass := cls.
4accc9fafd19 change #who to return a proper object
Claus Gittinger <cg@exept.de>
parents: 1813
diff changeset
  2827
    mySelector := sel
4accc9fafd19 change #who to return a proper object
Claus Gittinger <cg@exept.de>
parents: 1813
diff changeset
  2828
4accc9fafd19 change #who to return a proper object
Claus Gittinger <cg@exept.de>
parents: 1813
diff changeset
  2829
4accc9fafd19 change #who to return a proper object
Claus Gittinger <cg@exept.de>
parents: 1813
diff changeset
  2830
! !
4accc9fafd19 change #who to return a proper object
Claus Gittinger <cg@exept.de>
parents: 1813
diff changeset
  2831
1775
6892b91ddc0b F_CALLED flag is no longer present
Claus Gittinger <cg@exept.de>
parents: 1692
diff changeset
  2832
!Method class methodsFor:'documentation'!
872
af04035b443d binary class storage support
Claus Gittinger <cg@exept.de>
parents: 829
diff changeset
  2833
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
  2834
version
11066
95bf9204e56b changed #rawSourceStream
Stefan Vogel <sv@exept.de>
parents: 11022
diff changeset
  2835
    ^ '$Header: /cvs/stx/stx/libbasic/Method.st,v 1.315 2008-06-28 12:17:18 stefan Exp $'
1
a27a279701f8 Initial revision
claus
parents:
diff changeset
  2836
! !
6956
23f0066163ff oops - EOL comments were handled wrong
Claus Gittinger <cg@exept.de>
parents: 6725
diff changeset
  2837
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
  2838
Method initialize!