Method.st
author Claus Gittinger <cg@exept.de>
Wed, 22 Nov 2000 00:31:50 +0100
changeset 5721 5f97733ff519
parent 5704 aeeece3a93ef
child 5724 96c2a5cf4217
permissions -rw-r--r--
methods now send change-notifications when the category changes faster resources-parsing
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
159
514c749165c3 *** empty log message ***
claus
parents: 142
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
"
a27a279701f8 Initial revision
claus
parents:
diff changeset
    12
5385
7637332d7b38 care for nil package
Claus Gittinger <cg@exept.de>
parents: 5339
diff changeset
    13
"{ Package: 'stx:libbasic' }"
7637332d7b38 care for nil package
Claus Gittinger <cg@exept.de>
parents: 5339
diff changeset
    14
3934
a8c6075f9988 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 3845
diff changeset
    15
CompiledCode variableSubclass:#Method
5322
411b6c0f7250 renamed sone structures;
Claus Gittinger <cg@exept.de>
parents: 5294
diff changeset
    16
	instanceVariableNames:'source sourcePosition category package mclass'
952
d600e08a5936 handle the case where a method has a sourceFileInfo, but the class has not
Claus Gittinger <cg@exept.de>
parents: 934
diff changeset
    17
	classVariableNames:'PrivateMethodSignal LastFileReference LastSourceFileName
4290
5e43473d7a35 moved recompilation semaphore from LazyMethod to Method
Claus Gittinger <cg@exept.de>
parents: 4015
diff changeset
    18
		LastWhoClass LastFileLock LastMethodSources CompilationLock'
952
d600e08a5936 handle the case where a method has a sourceFileInfo, but the class has not
Claus Gittinger <cg@exept.de>
parents: 934
diff changeset
    19
	poolDictionaries:''
d600e08a5936 handle the case where a method has a sourceFileInfo, but the class has not
Claus Gittinger <cg@exept.de>
parents: 934
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
4accc9fafd19 change #who to return a proper object
Claus Gittinger <cg@exept.de>
parents: 1813
diff changeset
    24
	instanceVariableNames:'myClass mySelector'
4accc9fafd19 change #who to return a proper object
Claus Gittinger <cg@exept.de>
parents: 1813
diff changeset
    25
	classVariableNames:''
4accc9fafd19 change #who to return a proper object
Claus Gittinger <cg@exept.de>
parents: 1813
diff changeset
    26
	poolDictionaries:''
4accc9fafd19 change #who to return a proper object
Claus Gittinger <cg@exept.de>
parents: 1813
diff changeset
    27
	privateIn:Method
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
159
514c749165c3 *** empty log message ***
claus
parents: 142
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
5322
411b6c0f7250 renamed sone structures;
Claus Gittinger <cg@exept.de>
parents: 5294
diff changeset
    76
	source          <String>        the source itself (if sourcePosition isNil)
411b6c0f7250 renamed sone structures;
Claus Gittinger <cg@exept.de>
parents: 5294
diff changeset
    77
					or the fileName where the source is found
411b6c0f7250 renamed sone structures;
Claus Gittinger <cg@exept.de>
parents: 5294
diff changeset
    78
411b6c0f7250 renamed sone structures;
Claus Gittinger <cg@exept.de>
parents: 5294
diff changeset
    79
	sourcePosition  <Integer>       the position of the methods chunk in the file
411b6c0f7250 renamed sone structures;
Claus Gittinger <cg@exept.de>
parents: 5294
diff changeset
    80
411b6c0f7250 renamed sone structures;
Claus Gittinger <cg@exept.de>
parents: 5294
diff changeset
    81
	category        <Symbol>        the methods category
411b6c0f7250 renamed sone structures;
Claus Gittinger <cg@exept.de>
parents: 5294
diff changeset
    82
	package         <Symbol>        the package, in which the methods was defined
411b6c0f7250 renamed sone structures;
Claus Gittinger <cg@exept.de>
parents: 5294
diff changeset
    83
	mclass          <Class>         the class in which I am defined
411b6c0f7250 renamed sone structures;
Claus Gittinger <cg@exept.de>
parents: 5294
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
5322
411b6c0f7250 renamed sone structures;
Claus Gittinger <cg@exept.de>
parents: 5294
diff changeset
    88
	PrivateMethodSignal             raised on privacy violation (see docu)
411b6c0f7250 renamed sone structures;
Claus Gittinger <cg@exept.de>
parents: 5294
diff changeset
    89
411b6c0f7250 renamed sone structures;
Claus Gittinger <cg@exept.de>
parents: 5294
diff changeset
    90
	LastFileReference               weak reference to the last sourceFile
411b6c0f7250 renamed sone structures;
Claus Gittinger <cg@exept.de>
parents: 5294
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:]
5322
411b6c0f7250 renamed sone structures;
Claus Gittinger <cg@exept.de>
parents: 5294
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
5277
d457937a69e5 comments & code-cleanup in #who
Claus Gittinger <cg@exept.de>
parents: 5241
diff changeset
   130
    Private methods may be executed only when called via a self-send
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.
d457937a69e5 comments & code-cleanup in #who
Claus Gittinger <cg@exept.de>
parents: 5241
diff changeset
   133
    Protected methods may not be called from subclasses-methods, 
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.
415
claus
parents: 414
diff changeset
   135
    (i.e. private methods are less private than protected 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):
5322
411b6c0f7250 renamed sone structures;
Claus Gittinger <cg@exept.de>
parents: 5294
diff changeset
   155
	the privacy feature has new been in ST/X for some years and was NOT heavily
411b6c0f7250 renamed sone structures;
Claus Gittinger <cg@exept.de>
parents: 5294
diff changeset
   156
	used - neither at eXept, nor by customers.
411b6c0f7250 renamed sone structures;
Claus Gittinger <cg@exept.de>
parents: 5294
diff changeset
   157
	In Smalltalk, it seems to be a very questionable feature, actually limiting
411b6c0f7250 renamed sone structures;
Claus Gittinger <cg@exept.de>
parents: 5294
diff changeset
   158
	code reusability.
411b6c0f7250 renamed sone structures;
Claus Gittinger <cg@exept.de>
parents: 5294
diff changeset
   159
	The privacy features are left in the system to demonstrate that it can be
411b6c0f7250 renamed sone structures;
Claus Gittinger <cg@exept.de>
parents: 5294
diff changeset
   160
	done in Smalltalk (for religious C++ fans ... to avoid useless discussions)
411b6c0f7250 renamed sone structures;
Claus Gittinger <cg@exept.de>
parents: 5294
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:[
5644
8d0d817060ec *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5636
diff changeset
   171
	"EXPERIMENTAL"
8d0d817060ec *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5636
diff changeset
   172
	PrivateMethodSignal := ExecutionErrorSignal newSignalMayProceed:true.
8d0d817060ec *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5636
diff changeset
   173
	PrivateMethodSignal nameClass:self message:#privateMethodSignal.
8d0d817060ec *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5636
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:[
5644
8d0d817060ec *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5636
diff changeset
   178
	LastFileLock := Semaphore forMutualExclusion name:'LastFileLock'.
8d0d817060ec *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5636
diff changeset
   179
	LastFileReference := WeakArray new:1.
8d0d817060ec *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5636
diff changeset
   180
	LastFileReference at:1 put:0.
2079
bcf84ab30304 Make cached sourcefile thread-protected.
Stefan Vogel <sv@exept.de>
parents: 2066
diff changeset
   181
    ].
1254
48c2748b5197 commentary
Claus Gittinger <cg@exept.de>
parents: 1236
diff changeset
   182
5387
f855cf3b2f67 need a recursionLock as compilationLock
Claus Gittinger <cg@exept.de>
parents: 5386
diff changeset
   183
    CompilationLock := RecursionLock new name:'MethodCompilation'.
4290
5e43473d7a35 moved recompilation semaphore from LazyMethod to Method
Claus Gittinger <cg@exept.de>
parents: 4015
diff changeset
   184
1254
48c2748b5197 commentary
Claus Gittinger <cg@exept.de>
parents: 1236
diff changeset
   185
    "Modified: 22.4.1996 / 16:34:38 / cg"
2079
bcf84ab30304 Make cached sourcefile thread-protected.
Stefan Vogel <sv@exept.de>
parents: 2066
diff changeset
   186
    "Modified: 3.1.1997 / 16:58:16 / stefan"
109
1fae65190b17 errors raise signals; check arg-count in valueWith...
claus
parents: 93
diff changeset
   187
! !
1fae65190b17 errors raise signals; check arg-count in valueWith...
claus
parents: 93
diff changeset
   188
1775
6892b91ddc0b F_CALLED flag is no longer present
Claus Gittinger <cg@exept.de>
parents: 1692
diff changeset
   189
!Method class methodsFor:'Signal constants'!
159
514c749165c3 *** empty log message ***
claus
parents: 142
diff changeset
   190
514c749165c3 *** empty log message ***
claus
parents: 142
diff changeset
   191
privateMethodSignal
176
48061f8659aa more queries
claus
parents: 159
diff changeset
   192
    "return the signal raised when a private/protected method is called
48061f8659aa more queries
claus
parents: 159
diff changeset
   193
     by some other object (i.e. not a self- or super send)"
48061f8659aa more queries
claus
parents: 159
diff changeset
   194
159
514c749165c3 *** empty log message ***
claus
parents: 142
diff changeset
   195
    ^ PrivateMethodSignal
514c749165c3 *** empty log message ***
claus
parents: 142
diff changeset
   196
! !
514c749165c3 *** empty log message ***
claus
parents: 142
diff changeset
   197
1775
6892b91ddc0b F_CALLED flag is no longer present
Claus Gittinger <cg@exept.de>
parents: 1692
diff changeset
   198
!Method class methodsFor:'binary storage'!
952
d600e08a5936 handle the case where a method has a sourceFileInfo, but the class has not
Claus Gittinger <cg@exept.de>
parents: 934
diff changeset
   199
d600e08a5936 handle the case where a method has a sourceFileInfo, but the class has not
Claus Gittinger <cg@exept.de>
parents: 934
diff changeset
   200
binaryDefinitionFrom: stream manager: manager
d600e08a5936 handle the case where a method has a sourceFileInfo, but the class has not
Claus Gittinger <cg@exept.de>
parents: 934
diff changeset
   201
    "read my definition from stream."
d600e08a5936 handle the case where a method has a sourceFileInfo, but the class has not
Claus Gittinger <cg@exept.de>
parents: 934
diff changeset
   202
d600e08a5936 handle the case where a method has a sourceFileInfo, but the class has not
Claus Gittinger <cg@exept.de>
parents: 934
diff changeset
   203
    |cls sel|
d600e08a5936 handle the case where a method has a sourceFileInfo, but the class has not
Claus Gittinger <cg@exept.de>
parents: 934
diff changeset
   204
d600e08a5936 handle the case where a method has a sourceFileInfo, but the class has not
Claus Gittinger <cg@exept.de>
parents: 934
diff changeset
   205
    "type-byte"
d600e08a5936 handle the case where a method has a sourceFileInfo, but the class has not
Claus Gittinger <cg@exept.de>
parents: 934
diff changeset
   206
    stream nextByte == 0 ifTrue:[
d600e08a5936 handle the case where a method has a sourceFileInfo, but the class has not
Claus Gittinger <cg@exept.de>
parents: 934
diff changeset
   207
	"
d600e08a5936 handle the case where a method has a sourceFileInfo, but the class has not
Claus Gittinger <cg@exept.de>
parents: 934
diff changeset
   208
	 built-in 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
   209
	"
d600e08a5936 handle the case where a method has a sourceFileInfo, but the class has not
Claus Gittinger <cg@exept.de>
parents: 934
diff changeset
   210
	cls := manager nextObject.
d600e08a5936 handle the case where a method has a sourceFileInfo, but the class has not
Claus Gittinger <cg@exept.de>
parents: 934
diff changeset
   211
	sel := manager nextObject.
d600e08a5936 handle the case where a method has a sourceFileInfo, but the class has not
Claus Gittinger <cg@exept.de>
parents: 934
diff changeset
   212
d600e08a5936 handle the case where a method has a sourceFileInfo, but the class has not
Claus Gittinger <cg@exept.de>
parents: 934
diff changeset
   213
	"
d600e08a5936 handle the case where a method has a sourceFileInfo, but the class has not
Claus Gittinger <cg@exept.de>
parents: 934
diff changeset
   214
	 mhmh - on the source system, this was a machinecode
d600e08a5936 handle the case where a method has a sourceFileInfo, but the class has not
Claus Gittinger <cg@exept.de>
parents: 934
diff changeset
   215
	 method, while here its an interpreted one ...
d600e08a5936 handle the case where a method has a sourceFileInfo, but the class has not
Claus Gittinger <cg@exept.de>
parents: 934
diff changeset
   216
	"
d600e08a5936 handle the case where a method has a sourceFileInfo, but the class has not
Claus Gittinger <cg@exept.de>
parents: 934
diff changeset
   217
	cls isLoaded ifFalse:[
d600e08a5936 handle the case where a method has a sourceFileInfo, but the class has not
Claus Gittinger <cg@exept.de>
parents: 934
diff changeset
   218
	    cls autoload
d600e08a5936 handle the case where a method has a sourceFileInfo, but the class has not
Claus Gittinger <cg@exept.de>
parents: 934
diff changeset
   219
	].
d600e08a5936 handle the case where a method has a sourceFileInfo, but the class has not
Claus Gittinger <cg@exept.de>
parents: 934
diff changeset
   220
	^ cls compiledMethodAt:sel
d600e08a5936 handle the case where a method has a sourceFileInfo, but the class has not
Claus Gittinger <cg@exept.de>
parents: 934
diff changeset
   221
    ].
d600e08a5936 handle the case where a method has a sourceFileInfo, but the class has not
Claus Gittinger <cg@exept.de>
parents: 934
diff changeset
   222
    "
d600e08a5936 handle the case where a method has a sourceFileInfo, but the class has not
Claus Gittinger <cg@exept.de>
parents: 934
diff changeset
   223
     bytecode 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
   224
    "
d600e08a5936 handle the case where a method has a sourceFileInfo, but the class has not
Claus Gittinger <cg@exept.de>
parents: 934
diff changeset
   225
    ^ super binaryDefinitionFrom:stream manager:manager
d600e08a5936 handle the case where a method has a sourceFileInfo, but the class has not
Claus Gittinger <cg@exept.de>
parents: 934
diff changeset
   226
!
d600e08a5936 handle the case where a method has a sourceFileInfo, but the class has not
Claus Gittinger <cg@exept.de>
parents: 934
diff changeset
   227
d600e08a5936 handle the case where a method has a sourceFileInfo, but the class has not
Claus Gittinger <cg@exept.de>
parents: 934
diff changeset
   228
binaryFullDefinitionFrom:stream manager:manager
d600e08a5936 handle the case where a method has a sourceFileInfo, but the class has not
Claus Gittinger <cg@exept.de>
parents: 934
diff changeset
   229
    "retrieve a full bytecoded-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
   230
d600e08a5936 handle the case where a method has a sourceFileInfo, but the class has not
Claus Gittinger <cg@exept.de>
parents: 934
diff changeset
   231
    |snapId cat flags code lits m sourceFilename sourcePos 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
   232
d600e08a5936 handle the case where a method has a sourceFileInfo, but the class has not
Claus Gittinger <cg@exept.de>
parents: 934
diff changeset
   233
    snapId := manager nextObject.
d600e08a5936 handle the case where a method has a sourceFileInfo, but the class has not
Claus Gittinger <cg@exept.de>
parents: 934
diff changeset
   234
    cat := manager nextObject.
d600e08a5936 handle the case where a method has a sourceFileInfo, but the class has not
Claus Gittinger <cg@exept.de>
parents: 934
diff changeset
   235
    flags := manager nextObject.
d600e08a5936 handle the case where a method has a sourceFileInfo, but the class has not
Claus Gittinger <cg@exept.de>
parents: 934
diff changeset
   236
    lits := manager nextObject.
d600e08a5936 handle the case where a method has a sourceFileInfo, but the class has not
Claus Gittinger <cg@exept.de>
parents: 934
diff changeset
   237
    sourceFilename := manager nextObject.
d600e08a5936 handle the case where a method has a sourceFileInfo, but the class has not
Claus Gittinger <cg@exept.de>
parents: 934
diff changeset
   238
    sourcePos := manager nextObject.
d600e08a5936 handle the case where a method has a sourceFileInfo, but the class has not
Claus Gittinger <cg@exept.de>
parents: 934
diff changeset
   239
    sourcePos isNil ifTrue:[
5721
5f97733ff519 methods now send change-notifications when the category changes
Claus Gittinger <cg@exept.de>
parents: 5704
diff changeset
   240
        source := manager nextObject.
952
d600e08a5936 handle the case where a method has a sourceFileInfo, but the class has not
Claus Gittinger <cg@exept.de>
parents: 934
diff changeset
   241
    ].
d600e08a5936 handle the case where a method has a sourceFileInfo, but the class has not
Claus Gittinger <cg@exept.de>
parents: 934
diff changeset
   242
    code := manager nextObject.
d600e08a5936 handle the case where a method has a sourceFileInfo, but the class has not
Claus Gittinger <cg@exept.de>
parents: 934
diff changeset
   243
d600e08a5936 handle the case where a method has a sourceFileInfo, but the class has not
Claus Gittinger <cg@exept.de>
parents: 934
diff changeset
   244
    snapId == ObjectMemory snapshotID ifTrue:[
5721
5f97733ff519 methods now send change-notifications when the category changes
Claus Gittinger <cg@exept.de>
parents: 5704
diff changeset
   245
        ObjectMemory incrementSnapshotID
952
d600e08a5936 handle the case where a method has a sourceFileInfo, but the class has not
Claus Gittinger <cg@exept.de>
parents: 934
diff changeset
   246
    ].
d600e08a5936 handle the case where a method has a sourceFileInfo, but the class has not
Claus Gittinger <cg@exept.de>
parents: 934
diff changeset
   247
1493
33e226c7d187 Move method's literals form literalArray to indexed instvars.
Stefan Vogel <sv@exept.de>
parents: 1477
diff changeset
   248
    m := Method basicNew:(lits size).
5721
5f97733ff519 methods now send change-notifications when the category changes
Claus Gittinger <cg@exept.de>
parents: 5704
diff changeset
   249
    cat notNil ifTrue:[m setCategory:cat].
952
d600e08a5936 handle the case where a method has a sourceFileInfo, but the class has not
Claus Gittinger <cg@exept.de>
parents: 934
diff changeset
   250
    m flags:flags.
d600e08a5936 handle the case where a method has a sourceFileInfo, but the class has not
Claus Gittinger <cg@exept.de>
parents: 934
diff changeset
   251
    m literals:lits.
d600e08a5936 handle the case where a method has a sourceFileInfo, but the class has not
Claus Gittinger <cg@exept.de>
parents: 934
diff changeset
   252
    m byteCode: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
   253
    sourcePos isNil ifTrue:[
5721
5f97733ff519 methods now send change-notifications when the category changes
Claus Gittinger <cg@exept.de>
parents: 5704
diff changeset
   254
        m source: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
   255
    ] ifFalse:[
5721
5f97733ff519 methods now send change-notifications when the category changes
Claus Gittinger <cg@exept.de>
parents: 5704
diff changeset
   256
        m sourceFilename:sourceFilename position:sourcePos
952
d600e08a5936 handle the case where a method has a sourceFileInfo, but the class has not
Claus Gittinger <cg@exept.de>
parents: 934
diff changeset
   257
    ].
d600e08a5936 handle the case where a method has a sourceFileInfo, but the class has not
Claus Gittinger <cg@exept.de>
parents: 934
diff changeset
   258
    ^ 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
   259
d600e08a5936 handle the case where a method has a sourceFileInfo, but the class has not
Claus Gittinger <cg@exept.de>
parents: 934
diff changeset
   260
    "Created: 16.1.1996 / 14:44:08 / cg"
1493
33e226c7d187 Move method's literals form literalArray to indexed instvars.
Stefan Vogel <sv@exept.de>
parents: 1477
diff changeset
   261
    "Modified: 24.6.1996 / 12:29:35 / stefan"
2064
68b185fbddb6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 2063
diff changeset
   262
    "Modified: 5.1.1997 / 01:09:56 / 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
   263
! !
d600e08a5936 handle the case where a method has a sourceFileInfo, but the class has not
Claus Gittinger <cg@exept.de>
parents: 934
diff changeset
   264
1775
6892b91ddc0b F_CALLED flag is no longer present
Claus Gittinger <cg@exept.de>
parents: 1692
diff changeset
   265
!Method class methodsFor:'queries'!
3
24d81bf47225 *** empty log message ***
claus
parents: 2
diff changeset
   266
24d81bf47225 *** empty log message ***
claus
parents: 2
diff changeset
   267
isBuiltInClass
1264
8d916aa63bce commentary
Claus Gittinger <cg@exept.de>
parents: 1260
diff changeset
   268
    "return true if this class is known by the run-time-system.
8d916aa63bce commentary
Claus Gittinger <cg@exept.de>
parents: 1260
diff changeset
   269
     Here, true is returned for myself, false for subclasses."
3
24d81bf47225 *** empty log message ***
claus
parents: 2
diff changeset
   270
24d81bf47225 *** empty log message ***
claus
parents: 2
diff changeset
   271
    ^ self == Method
1264
8d916aa63bce commentary
Claus Gittinger <cg@exept.de>
parents: 1260
diff changeset
   272
8d916aa63bce commentary
Claus Gittinger <cg@exept.de>
parents: 1260
diff changeset
   273
    "Modified: 23.4.1996 / 15:59:50 / cg"
44
b262907c93ea *** empty log message ***
claus
parents: 42
diff changeset
   274
!
b262907c93ea *** empty log message ***
claus
parents: 42
diff changeset
   275
747
ea3b6f7fd7ce added ignoredMethods
Claus Gittinger <cg@exept.de>
parents: 737
diff changeset
   276
methodPrivacySupported
ea3b6f7fd7ce added ignoredMethods
Claus Gittinger <cg@exept.de>
parents: 737
diff changeset
   277
    "return true, if the system was compiled to support methodPrivacy.
ea3b6f7fd7ce added ignoredMethods
Claus Gittinger <cg@exept.de>
parents: 737
diff changeset
   278
     You should not depend on that feature being available."
ea3b6f7fd7ce added ignoredMethods
Claus Gittinger <cg@exept.de>
parents: 737
diff changeset
   279
ea3b6f7fd7ce added ignoredMethods
Claus Gittinger <cg@exept.de>
parents: 737
diff changeset
   280
%{  /* NOCONTEXT */
ea3b6f7fd7ce added ignoredMethods
Claus Gittinger <cg@exept.de>
parents: 737
diff changeset
   281
#if defined(F_PRIVATE) || defined(F_CLASSPRIVATE)
ea3b6f7fd7ce added ignoredMethods
Claus Gittinger <cg@exept.de>
parents: 737
diff changeset
   282
    RETURN (true);
ea3b6f7fd7ce added ignoredMethods
Claus Gittinger <cg@exept.de>
parents: 737
diff changeset
   283
#else
ea3b6f7fd7ce added ignoredMethods
Claus Gittinger <cg@exept.de>
parents: 737
diff changeset
   284
    RETURN (false);
ea3b6f7fd7ce added ignoredMethods
Claus Gittinger <cg@exept.de>
parents: 737
diff changeset
   285
#endif
ea3b6f7fd7ce added ignoredMethods
Claus Gittinger <cg@exept.de>
parents: 737
diff changeset
   286
%}
3342
8bcf0fc80a21 class method #resourceTypes re-added
tz
parents: 3341
diff changeset
   287
!
8bcf0fc80a21 class method #resourceTypes re-added
tz
parents: 3341
diff changeset
   288
8bcf0fc80a21 class method #resourceTypes re-added
tz
parents: 3341
diff changeset
   289
resourceTypes
8bcf0fc80a21 class method #resourceTypes re-added
tz
parents: 3341
diff changeset
   290
    "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
   291
3343
16b4d80b89c9 #help as resource type for help specs added
tz
parents: 3342
diff changeset
   292
    ^#(canvas menu image fileImage help hierarchicalList tabList tableColumns)
3
24d81bf47225 *** empty log message ***
claus
parents: 2
diff changeset
   293
! !
24d81bf47225 *** empty log message ***
claus
parents: 2
diff changeset
   294
1775
6892b91ddc0b F_CALLED flag is no longer present
Claus Gittinger <cg@exept.de>
parents: 1692
diff changeset
   295
!Method class methodsFor:'special'!
957
b405ae99d437 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 952
diff changeset
   296
b405ae99d437 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 952
diff changeset
   297
flushSourceStreamCache
5115
f1622b061539 comment
ca
parents: 5025
diff changeset
   298
    LastSourceFileName := LastMethodSources := nil
957
b405ae99d437 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 952
diff changeset
   299
b405ae99d437 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 952
diff changeset
   300
    "Created: 9.2.1996 / 19:05:28 / cg"
5115
f1622b061539 comment
ca
parents: 5025
diff changeset
   301
f1622b061539 comment
ca
parents: 5025
diff changeset
   302
"
f1622b061539 comment
ca
parents: 5025
diff changeset
   303
self flushSourceStreamCache
f1622b061539 comment
ca
parents: 5025
diff changeset
   304
"
957
b405ae99d437 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 952
diff changeset
   305
! !
b405ae99d437 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 952
diff changeset
   306
1
a27a279701f8 Initial revision
claus
parents:
diff changeset
   307
!Method methodsFor:'accessing'!
a27a279701f8 Initial revision
claus
parents:
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
d600e08a5936 handle the case where a method has a sourceFileInfo, but the class has not
Claus Gittinger <cg@exept.de>
parents: 934
diff changeset
   310
    "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
   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
1
a27a279701f8 Initial revision
claus
parents:
diff changeset
   313
!
a27a279701f8 Initial revision
claus
parents:
diff changeset
   314
952
d600e08a5936 handle the case where a method has a sourceFileInfo, but the class has not
Claus Gittinger <cg@exept.de>
parents: 934
diff changeset
   315
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
   316
    "set the methods category"
1
a27a279701f8 Initial revision
claus
parents:
diff changeset
   317
5721
5f97733ff519 methods now send change-notifications when the category changes
Claus Gittinger <cg@exept.de>
parents: 5704
diff changeset
   318
    |newCategory oldCategory|
5f97733ff519 methods now send change-notifications when the category changes
Claus Gittinger <cg@exept.de>
parents: 5704
diff changeset
   319
3934
a8c6075f9988 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 3845
diff changeset
   320
    aStringOrSymbol notNil ifTrue:[
5721
5f97733ff519 methods now send change-notifications when the category changes
Claus Gittinger <cg@exept.de>
parents: 5704
diff changeset
   321
        newCategory := aStringOrSymbol.
5f97733ff519 methods now send change-notifications when the category changes
Claus Gittinger <cg@exept.de>
parents: 5704
diff changeset
   322
        newCategory ~= (oldCategory := category) ifTrue:[
5f97733ff519 methods now send change-notifications when the category changes
Claus Gittinger <cg@exept.de>
parents: 5704
diff changeset
   323
            self setCategory:newCategory.
5f97733ff519 methods now send change-notifications when the category changes
Claus Gittinger <cg@exept.de>
parents: 5704
diff changeset
   324
            self changed:#category with:oldCategory.
5f97733ff519 methods now send change-notifications when the category changes
Claus Gittinger <cg@exept.de>
parents: 5704
diff changeset
   325
            self mclass changed:#organization with:self selector.
5f97733ff519 methods now send change-notifications when the category changes
Claus Gittinger <cg@exept.de>
parents: 5704
diff changeset
   326
            Smalltalk changed:#methodCategory with:(Array with:self mclass with:self with:oldCategory). 
5f97733ff519 methods now send change-notifications when the category changes
Claus Gittinger <cg@exept.de>
parents: 5704
diff changeset
   327
        ]
3934
a8c6075f9988 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 3845
diff changeset
   328
    ]
a8c6075f9988 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 3845
diff changeset
   329
a8c6075f9988 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 3845
diff changeset
   330
    "Modified: / 13.11.1998 / 23:55:05 / cg"
1
a27a279701f8 Initial revision
claus
parents:
diff changeset
   331
!
a27a279701f8 Initial revision
claus
parents:
diff changeset
   332
39
bcf183a31bbb *** empty log message ***
claus
parents: 13
diff changeset
   333
comment
bcf183a31bbb *** empty log message ***
claus
parents: 13
diff changeset
   334
    "return the methods comment.
68
59faa75185ba *** empty log message ***
claus
parents: 56
diff changeset
   335
     This is done by searching for and returning the first comment
159
514c749165c3 *** empty log message ***
claus
parents: 142
diff changeset
   336
     from the methods source (excluding any double-quotes). 
68
59faa75185ba *** empty log message ***
claus
parents: 56
diff changeset
   337
     Returns nil if there is no comment (or source is not available)."
39
bcf183a31bbb *** empty log message ***
claus
parents: 13
diff changeset
   338
3297
309058293d49 Fix #comment to return a string (instead of Scanner::Comment).
Stefan Vogel <sv@exept.de>
parents: 3289
diff changeset
   339
    |src comment comments parser|
39
bcf183a31bbb *** empty log message ***
claus
parents: 13
diff changeset
   340
159
514c749165c3 *** empty log message ***
claus
parents: 142
diff changeset
   341
    src := self source.
514c749165c3 *** empty log message ***
claus
parents: 142
diff changeset
   342
    src isNil ifTrue:[^ nil].
93
e31220cb391f *** empty log message ***
claus
parents: 88
diff changeset
   343
1236
5c9bc68e3c71 use new scanner feature to extract comment
Claus Gittinger <cg@exept.de>
parents: 1194
diff changeset
   344
    parser := Parser for:src in:nil.
5c9bc68e3c71 use new scanner feature to extract comment
Claus Gittinger <cg@exept.de>
parents: 1194
diff changeset
   345
    parser ignoreErrors; ignoreWarnings; saveComments:true.
5c9bc68e3c71 use new scanner feature to extract comment
Claus Gittinger <cg@exept.de>
parents: 1194
diff changeset
   346
    parser parseMethodSpec.
5c9bc68e3c71 use new scanner feature to extract comment
Claus Gittinger <cg@exept.de>
parents: 1194
diff changeset
   347
    comments := parser comments.
3297
309058293d49 Fix #comment to return a string (instead of Scanner::Comment).
Stefan Vogel <sv@exept.de>
parents: 3289
diff changeset
   348
    comments size ~~ 0 ifTrue:[
5322
411b6c0f7250 renamed sone structures;
Claus Gittinger <cg@exept.de>
parents: 5294
diff changeset
   349
	comment := comments first string.
411b6c0f7250 renamed sone structures;
Claus Gittinger <cg@exept.de>
parents: 5294
diff changeset
   350
	(comment withoutSpaces endsWith:'}') ifTrue:[
411b6c0f7250 renamed sone structures;
Claus Gittinger <cg@exept.de>
parents: 5294
diff changeset
   351
	    "if first comment is a pragma, take next comment"
411b6c0f7250 renamed sone structures;
Claus Gittinger <cg@exept.de>
parents: 5294
diff changeset
   352
	    comment := comments at:2 ifAbsent:nil.
411b6c0f7250 renamed sone structures;
Claus Gittinger <cg@exept.de>
parents: 5294
diff changeset
   353
	    comment notNil ifTrue:[
411b6c0f7250 renamed sone structures;
Claus Gittinger <cg@exept.de>
parents: 5294
diff changeset
   354
		comment := comment string.
411b6c0f7250 renamed sone structures;
Claus Gittinger <cg@exept.de>
parents: 5294
diff changeset
   355
	    ].
411b6c0f7250 renamed sone structures;
Claus Gittinger <cg@exept.de>
parents: 5294
diff changeset
   356
	].
1254
48c2748b5197 commentary
Claus Gittinger <cg@exept.de>
parents: 1236
diff changeset
   357
    ].
3297
309058293d49 Fix #comment to return a string (instead of Scanner::Comment).
Stefan Vogel <sv@exept.de>
parents: 3289
diff changeset
   358
    ^ comment.
93
e31220cb391f *** empty log message ***
claus
parents: 88
diff changeset
   359
e31220cb391f *** empty log message ***
claus
parents: 88
diff changeset
   360
    "
1236
5c9bc68e3c71 use new scanner feature to extract comment
Claus Gittinger <cg@exept.de>
parents: 1194
diff changeset
   361
     (Method compiledMethodAt:#comment) comment  
1254
48c2748b5197 commentary
Claus Gittinger <cg@exept.de>
parents: 1236
diff changeset
   362
     (Object class compiledMethodAt:#infoPrinting:) comment  
93
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
3289
9e52625965cc care for commentType
Claus Gittinger <cg@exept.de>
parents: 3247
diff changeset
   365
    "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
   366
    "Modified: / 23.2.1998 / 10:26:08 / stefan"
39
bcf183a31bbb *** empty log message ***
claus
parents: 13
diff changeset
   367
!
bcf183a31bbb *** empty log message ***
claus
parents: 13
diff changeset
   368
952
d600e08a5936 handle the case where a method has a sourceFileInfo, but the class has not
Claus Gittinger <cg@exept.de>
parents: 934
diff changeset
   369
getSource
3160
db5c1aa38fda comment
Claus Gittinger <cg@exept.de>
parents: 3144
diff changeset
   370
    "low-level access to the source instance-variable.
4751
174a92d4ba3f checkin from browser
Claus Gittinger <cg@exept.de>
parents: 4669
diff changeset
   371
     For internal (compiler) use only.
3160
db5c1aa38fda comment
Claus Gittinger <cg@exept.de>
parents: 3144
diff changeset
   372
     This is NOT always the methods source string"
db5c1aa38fda comment
Claus Gittinger <cg@exept.de>
parents: 3144
diff changeset
   373
952
d600e08a5936 handle the case where a method has a sourceFileInfo, but the class has not
Claus Gittinger <cg@exept.de>
parents: 934
diff changeset
   374
    ^ source
414
claus
parents: 400
diff changeset
   375
!
claus
parents: 400
diff changeset
   376
4751
174a92d4ba3f checkin from browser
Claus Gittinger <cg@exept.de>
parents: 4669
diff changeset
   377
getSourcePosition
174a92d4ba3f checkin from browser
Claus Gittinger <cg@exept.de>
parents: 4669
diff changeset
   378
    "low-level access to the sourcePosition instance-variable.
174a92d4ba3f checkin from browser
Claus Gittinger <cg@exept.de>
parents: 4669
diff changeset
   379
     For internal (compiler) use only.
174a92d4ba3f checkin from browser
Claus Gittinger <cg@exept.de>
parents: 4669
diff changeset
   380
     This is NOT always the methods sourcePosition"
174a92d4ba3f checkin from browser
Claus Gittinger <cg@exept.de>
parents: 4669
diff changeset
   381
174a92d4ba3f checkin from browser
Claus Gittinger <cg@exept.de>
parents: 4669
diff changeset
   382
    ^ sourcePosition
174a92d4ba3f checkin from browser
Claus Gittinger <cg@exept.de>
parents: 4669
diff changeset
   383
!
174a92d4ba3f checkin from browser
Claus Gittinger <cg@exept.de>
parents: 4669
diff changeset
   384
2176
1a24b0cef25a when compressing sources, make certain to avoid later
Claus Gittinger <cg@exept.de>
parents: 2171
diff changeset
   385
localSourceFilename:aFileName position:aNumber
1a24b0cef25a when compressing sources, make certain to avoid later
Claus Gittinger <cg@exept.de>
parents: 2171
diff changeset
   386
    "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
   387
     this is a local file."
1a24b0cef25a when compressing sources, make certain to avoid later
Claus Gittinger <cg@exept.de>
parents: 2171
diff changeset
   388
1a24b0cef25a when compressing sources, make certain to avoid later
Claus Gittinger <cg@exept.de>
parents: 2171
diff changeset
   389
    source := aFileName.
1a24b0cef25a when compressing sources, make certain to avoid later
Claus Gittinger <cg@exept.de>
parents: 2171
diff changeset
   390
    sourcePosition := aNumber negated
1a24b0cef25a when compressing sources, make certain to avoid later
Claus Gittinger <cg@exept.de>
parents: 2171
diff changeset
   391
1a24b0cef25a when compressing sources, make certain to avoid later
Claus Gittinger <cg@exept.de>
parents: 2171
diff changeset
   392
    "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
   393
!
1a24b0cef25a when compressing sources, make certain to avoid later
Claus Gittinger <cg@exept.de>
parents: 2171
diff changeset
   394
4669
828addb1c376 source code access - care for package different from my classes
Claus Gittinger <cg@exept.de>
parents: 4595
diff changeset
   395
localSourceStream
828addb1c376 source code access - care for package different from my classes
Claus Gittinger <cg@exept.de>
parents: 4595
diff changeset
   396
    "try to open a stream from a local source file,
828addb1c376 source code access - care for package different from my classes
Claus Gittinger <cg@exept.de>
parents: 4595
diff changeset
   397
     searching in standard places."
828addb1c376 source code access - care for package different from my classes
Claus Gittinger <cg@exept.de>
parents: 4595
diff changeset
   398
828addb1c376 source code access - care for package different from my classes
Claus Gittinger <cg@exept.de>
parents: 4595
diff changeset
   399
    |fileName aStream|
828addb1c376 source code access - care for package different from my classes
Claus Gittinger <cg@exept.de>
parents: 4595
diff changeset
   400
828addb1c376 source code access - care for package different from my classes
Claus Gittinger <cg@exept.de>
parents: 4595
diff changeset
   401
    package notNil ifTrue:[
5322
411b6c0f7250 renamed sone structures;
Claus Gittinger <cg@exept.de>
parents: 5294
diff changeset
   402
	fileName := Smalltalk getSourceFileName:(package copyReplaceAll:$: with:$/) , '/' , source.
411b6c0f7250 renamed sone structures;
Claus Gittinger <cg@exept.de>
parents: 5294
diff changeset
   403
	fileName notNil ifTrue:[
411b6c0f7250 renamed sone structures;
Claus Gittinger <cg@exept.de>
parents: 5294
diff changeset
   404
	    aStream := fileName asFilename readStream.
411b6c0f7250 renamed sone structures;
Claus Gittinger <cg@exept.de>
parents: 5294
diff changeset
   405
	    aStream notNil ifTrue:[^ aStream].
411b6c0f7250 renamed sone structures;
Claus Gittinger <cg@exept.de>
parents: 5294
diff changeset
   406
	].
4669
828addb1c376 source code access - care for package different from my classes
Claus Gittinger <cg@exept.de>
parents: 4595
diff changeset
   407
    ].
828addb1c376 source code access - care for package different from my classes
Claus Gittinger <cg@exept.de>
parents: 4595
diff changeset
   408
    fileName := Smalltalk getSourceFileName:source.
828addb1c376 source code access - care for package different from my classes
Claus Gittinger <cg@exept.de>
parents: 4595
diff changeset
   409
    fileName notNil ifTrue:[
5322
411b6c0f7250 renamed sone structures;
Claus Gittinger <cg@exept.de>
parents: 5294
diff changeset
   410
	aStream := fileName asFilename readStream.
411b6c0f7250 renamed sone structures;
Claus Gittinger <cg@exept.de>
parents: 5294
diff changeset
   411
	aStream notNil ifTrue:[^ aStream].
4669
828addb1c376 source code access - care for package different from my classes
Claus Gittinger <cg@exept.de>
parents: 4595
diff changeset
   412
    ].
828addb1c376 source code access - care for package different from my classes
Claus Gittinger <cg@exept.de>
parents: 4595
diff changeset
   413
    ^ nil
828addb1c376 source code access - care for package different from my classes
Claus Gittinger <cg@exept.de>
parents: 4595
diff changeset
   414
!
828addb1c376 source code access - care for package different from my classes
Claus Gittinger <cg@exept.de>
parents: 4595
diff changeset
   415
5152
2aacfb3976d4 when changing the package, make certain that the source
Claus Gittinger <cg@exept.de>
parents: 5115
diff changeset
   416
makeLocalStringSource
2aacfb3976d4 when changing the package, make certain that the source
Claus Gittinger <cg@exept.de>
parents: 5115
diff changeset
   417
    "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
   418
     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
   419
     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
   420
     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
   421
     sourceCode is not lost."
2aacfb3976d4 when changing the package, make certain that the source
Claus Gittinger <cg@exept.de>
parents: 5115
diff changeset
   422
2aacfb3976d4 when changing the package, make certain that the source
Claus Gittinger <cg@exept.de>
parents: 5115
diff changeset
   423
    source notNil ifTrue:[
5322
411b6c0f7250 renamed sone structures;
Claus Gittinger <cg@exept.de>
parents: 5294
diff changeset
   424
	sourcePosition notNil ifTrue:[
411b6c0f7250 renamed sone structures;
Claus Gittinger <cg@exept.de>
parents: 5294
diff changeset
   425
	    self source:(self source)
411b6c0f7250 renamed sone structures;
Claus Gittinger <cg@exept.de>
parents: 5294
diff changeset
   426
	]
5152
2aacfb3976d4 when changing the package, make certain that the source
Claus Gittinger <cg@exept.de>
parents: 5115
diff changeset
   427
    ].
2aacfb3976d4 when changing the package, make certain that the source
Claus Gittinger <cg@exept.de>
parents: 5115
diff changeset
   428
!
2aacfb3976d4 when changing the package, make certain that the source
Claus Gittinger <cg@exept.de>
parents: 5115
diff changeset
   429
5324
5c9959ce98af make use of mclass
Claus Gittinger <cg@exept.de>
parents: 5322
diff changeset
   430
mclass:aClass
5676
db728e9fe276 must flush cached mclass, when copying methods around
src
parents: 5665
diff changeset
   431
    (mclass notNil and:[aClass notNil]) ifTrue:[
db728e9fe276 must flush cached mclass, when copying methods around
src
parents: 5665
diff changeset
   432
        'Method [warning]: mclass already set' errorPrintCR.
5324
5c9959ce98af make use of mclass
Claus Gittinger <cg@exept.de>
parents: 5322
diff changeset
   433
    ].
5696
958a0643496d compatibility
Claus Gittinger <cg@exept.de>
parents: 5676
diff changeset
   434
    mclass := aClass.
958a0643496d compatibility
Claus Gittinger <cg@exept.de>
parents: 5676
diff changeset
   435
!
5324
5c9959ce98af make use of mclass
Claus Gittinger <cg@exept.de>
parents: 5322
diff changeset
   436
1093
1e742016eea0 category rename / added access to RESOURCE and CALLED flags
Claus Gittinger <cg@exept.de>
parents: 1087
diff changeset
   437
package
1e742016eea0 category rename / added access to RESOURCE and CALLED flags
Claus Gittinger <cg@exept.de>
parents: 1087
diff changeset
   438
    "return the package-symbol"
1e742016eea0 category rename / added access to RESOURCE and CALLED flags
Claus Gittinger <cg@exept.de>
parents: 1087
diff changeset
   439
5385
7637332d7b38 care for nil package
Claus Gittinger <cg@exept.de>
parents: 5339
diff changeset
   440
    |cls|
7637332d7b38 care for nil package
Claus Gittinger <cg@exept.de>
parents: 5339
diff changeset
   441
7637332d7b38 care for nil package
Claus Gittinger <cg@exept.de>
parents: 5339
diff changeset
   442
    package notNil ifTrue:[ ^ package ].
7637332d7b38 care for nil package
Claus Gittinger <cg@exept.de>
parents: 5339
diff changeset
   443
    (cls := self mclass) isNil ifTrue:[
5644
8d0d817060ec *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5636
diff changeset
   444
	^ ''
5385
7637332d7b38 care for nil package
Claus Gittinger <cg@exept.de>
parents: 5339
diff changeset
   445
    ].
5562
76675d5a0da9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5551
diff changeset
   446
    ^ cls package ? ''
3950
f9c4485a91d1 avoid nil package return
Claus Gittinger <cg@exept.de>
parents: 3934
diff changeset
   447
f9c4485a91d1 avoid nil package return
Claus Gittinger <cg@exept.de>
parents: 3934
diff changeset
   448
    "Modified: / 29.12.1998 / 01:16:05 / cg"
1093
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
1e742016eea0 category rename / added access to RESOURCE and CALLED flags
Claus Gittinger <cg@exept.de>
parents: 1087
diff changeset
   451
package:aSymbol
1e742016eea0 category rename / added access to RESOURCE and CALLED flags
Claus Gittinger <cg@exept.de>
parents: 1087
diff changeset
   452
    "set the package-symbol"
1e742016eea0 category rename / added access to RESOURCE and CALLED flags
Claus Gittinger <cg@exept.de>
parents: 1087
diff changeset
   453
5152
2aacfb3976d4 when changing the package, make certain that the source
Claus Gittinger <cg@exept.de>
parents: 5115
diff changeset
   454
    self makeLocalStringSource.
1093
1e742016eea0 category rename / added access to RESOURCE and CALLED flags
Claus Gittinger <cg@exept.de>
parents: 1087
diff changeset
   455
    package := aSymbol
1e742016eea0 category rename / added access to RESOURCE and CALLED flags
Claus Gittinger <cg@exept.de>
parents: 1087
diff changeset
   456
!
1e742016eea0 category rename / added access to RESOURCE and CALLED flags
Claus Gittinger <cg@exept.de>
parents: 1087
diff changeset
   457
5721
5f97733ff519 methods now send change-notifications when the category changes
Claus Gittinger <cg@exept.de>
parents: 5704
diff changeset
   458
setCategory:aStringOrSymbol
5f97733ff519 methods now send change-notifications when the category changes
Claus Gittinger <cg@exept.de>
parents: 5704
diff changeset
   459
    "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
   460
5f97733ff519 methods now send change-notifications when the category changes
Claus Gittinger <cg@exept.de>
parents: 5704
diff changeset
   461
    aStringOrSymbol notNil ifTrue:[
5f97733ff519 methods now send change-notifications when the category changes
Claus Gittinger <cg@exept.de>
parents: 5704
diff changeset
   462
        category := aStringOrSymbol asSymbol
5f97733ff519 methods now send change-notifications when the category changes
Claus Gittinger <cg@exept.de>
parents: 5704
diff changeset
   463
    ]
5f97733ff519 methods now send change-notifications when the category changes
Claus Gittinger <cg@exept.de>
parents: 5704
diff changeset
   464
5f97733ff519 methods now send change-notifications when the category changes
Claus Gittinger <cg@exept.de>
parents: 5704
diff changeset
   465
    "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
   466
!
5f97733ff519 methods now send change-notifications when the category changes
Claus Gittinger <cg@exept.de>
parents: 5704
diff changeset
   467
5398
b15f5eca2060 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5387
diff changeset
   468
setPackage:aSymbol
b15f5eca2060 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5387
diff changeset
   469
    "set the package-symbol"
b15f5eca2060 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5387
diff changeset
   470
b15f5eca2060 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5387
diff changeset
   471
    package := aSymbol
b15f5eca2060 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5387
diff changeset
   472
!
b15f5eca2060 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5387
diff changeset
   473
1093
1e742016eea0 category rename / added access to RESOURCE and CALLED flags
Claus Gittinger <cg@exept.de>
parents: 1087
diff changeset
   474
source
1e742016eea0 category rename / added access to RESOURCE and CALLED flags
Claus Gittinger <cg@exept.de>
parents: 1087
diff changeset
   475
    "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
   476
1851
4accc9fafd19 change #who to return a proper object
Claus Gittinger <cg@exept.de>
parents: 1813
diff changeset
   477
    |aStream fileName junk who myClass mgr className|
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
    "
1e742016eea0 category rename / added access to RESOURCE and CALLED flags
Claus Gittinger <cg@exept.de>
parents: 1087
diff changeset
   480
     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
   481
     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
   482
     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
   483
    "
1e742016eea0 category rename / added access to RESOURCE and CALLED flags
Claus Gittinger <cg@exept.de>
parents: 1087
diff changeset
   484
    sourcePosition isNil ifTrue:[^ source].
1e742016eea0 category rename / added access to RESOURCE and CALLED flags
Claus Gittinger <cg@exept.de>
parents: 1087
diff changeset
   485
1e742016eea0 category rename / added access to RESOURCE and CALLED flags
Claus Gittinger <cg@exept.de>
parents: 1087
diff changeset
   486
    source notNil ifTrue:[
5322
411b6c0f7250 renamed sone structures;
Claus Gittinger <cg@exept.de>
parents: 5294
diff changeset
   487
	LastMethodSources notNil ifTrue:[
411b6c0f7250 renamed sone structures;
Claus Gittinger <cg@exept.de>
parents: 5294
diff changeset
   488
	    junk := LastMethodSources at:self ifAbsent:nil.
411b6c0f7250 renamed sone structures;
Claus Gittinger <cg@exept.de>
parents: 5294
diff changeset
   489
	    junk notNil ifTrue:[
411b6c0f7250 renamed sone structures;
Claus Gittinger <cg@exept.de>
parents: 5294
diff changeset
   490
		^ junk
411b6c0f7250 renamed sone structures;
Claus Gittinger <cg@exept.de>
parents: 5294
diff changeset
   491
	    ]
411b6c0f7250 renamed sone structures;
Claus Gittinger <cg@exept.de>
parents: 5294
diff changeset
   492
	].
411b6c0f7250 renamed sone structures;
Claus Gittinger <cg@exept.de>
parents: 5294
diff changeset
   493
411b6c0f7250 renamed sone structures;
Claus Gittinger <cg@exept.de>
parents: 5294
diff changeset
   494
	aStream := self sourceStream.
411b6c0f7250 renamed sone structures;
Claus Gittinger <cg@exept.de>
parents: 5294
diff changeset
   495
	aStream notNil ifTrue:[
411b6c0f7250 renamed sone structures;
Claus Gittinger <cg@exept.de>
parents: 5294
diff changeset
   496
	    Stream positionErrorSignal handle:[:ex |
411b6c0f7250 renamed sone structures;
Claus Gittinger <cg@exept.de>
parents: 5294
diff changeset
   497
		^ nil
411b6c0f7250 renamed sone structures;
Claus Gittinger <cg@exept.de>
parents: 5294
diff changeset
   498
	    ] do:[
411b6c0f7250 renamed sone structures;
Claus Gittinger <cg@exept.de>
parents: 5294
diff changeset
   499
		aStream position:sourcePosition abs.
411b6c0f7250 renamed sone structures;
Claus Gittinger <cg@exept.de>
parents: 5294
diff changeset
   500
	    ].
411b6c0f7250 renamed sone structures;
Claus Gittinger <cg@exept.de>
parents: 5294
diff changeset
   501
	    junk := aStream nextChunk.
411b6c0f7250 renamed sone structures;
Claus Gittinger <cg@exept.de>
parents: 5294
diff changeset
   502
411b6c0f7250 renamed sone structures;
Claus Gittinger <cg@exept.de>
parents: 5294
diff changeset
   503
	    OperatingSystem isMSDOSlike ifTrue:[
411b6c0f7250 renamed sone structures;
Claus Gittinger <cg@exept.de>
parents: 5294
diff changeset
   504
		"
411b6c0f7250 renamed sone structures;
Claus Gittinger <cg@exept.de>
parents: 5294
diff changeset
   505
		 kludge for now - somehow this does not work under win32 (sigh)
411b6c0f7250 renamed sone structures;
Claus Gittinger <cg@exept.de>
parents: 5294
diff changeset
   506
		"
411b6c0f7250 renamed sone structures;
Claus Gittinger <cg@exept.de>
parents: 5294
diff changeset
   507
		aStream close.
411b6c0f7250 renamed sone structures;
Claus Gittinger <cg@exept.de>
parents: 5294
diff changeset
   508
		(LastFileReference at:1) == aStream ifTrue:[
411b6c0f7250 renamed sone structures;
Claus Gittinger <cg@exept.de>
parents: 5294
diff changeset
   509
		    LastFileReference at:1 put:0.
411b6c0f7250 renamed sone structures;
Claus Gittinger <cg@exept.de>
parents: 5294
diff changeset
   510
		    LastSourceFileName := nil.
411b6c0f7250 renamed sone structures;
Claus Gittinger <cg@exept.de>
parents: 5294
diff changeset
   511
		]
411b6c0f7250 renamed sone structures;
Claus Gittinger <cg@exept.de>
parents: 5294
diff changeset
   512
	    ].
411b6c0f7250 renamed sone structures;
Claus Gittinger <cg@exept.de>
parents: 5294
diff changeset
   513
	]
1093
1e742016eea0 category rename / added access to RESOURCE and CALLED flags
Claus Gittinger <cg@exept.de>
parents: 1087
diff changeset
   514
    ].
2979
6bb06c5e49d8 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2868
diff changeset
   515
6bb06c5e49d8 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2868
diff changeset
   516
    junk notNil ifTrue:[
5322
411b6c0f7250 renamed sone structures;
Claus Gittinger <cg@exept.de>
parents: 5294
diff changeset
   517
	LastMethodSources isNil ifTrue:[
411b6c0f7250 renamed sone structures;
Claus Gittinger <cg@exept.de>
parents: 5294
diff changeset
   518
	    LastMethodSources := CacheDictionary new:20.
411b6c0f7250 renamed sone structures;
Claus Gittinger <cg@exept.de>
parents: 5294
diff changeset
   519
	].
411b6c0f7250 renamed sone structures;
Claus Gittinger <cg@exept.de>
parents: 5294
diff changeset
   520
	LastMethodSources at:self put:junk.
2979
6bb06c5e49d8 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2868
diff changeset
   521
    ].
6bb06c5e49d8 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 2868
diff changeset
   522
1093
1e742016eea0 category rename / added access to RESOURCE and CALLED flags
Claus Gittinger <cg@exept.de>
parents: 1087
diff changeset
   523
    ^ junk
1e742016eea0 category rename / added access to RESOURCE and CALLED flags
Claus Gittinger <cg@exept.de>
parents: 1087
diff changeset
   524
3160
db5c1aa38fda comment
Claus Gittinger <cg@exept.de>
parents: 3144
diff changeset
   525
    "Modified: / 7.1.1997 / 16:20:09 / stefan"
4817
097ef6d01ce6 dont keep the last source stream open under mswin.
Claus Gittinger <cg@exept.de>
parents: 4811
diff changeset
   526
    "Modified: / 25.9.1999 / 23:31:52 / cg"
1093
1e742016eea0 category rename / added access to RESOURCE and CALLED flags
Claus Gittinger <cg@exept.de>
parents: 1087
diff changeset
   527
!
1e742016eea0 category rename / added access to RESOURCE and CALLED flags
Claus Gittinger <cg@exept.de>
parents: 1087
diff changeset
   528
1e742016eea0 category rename / added access to RESOURCE and CALLED flags
Claus Gittinger <cg@exept.de>
parents: 1087
diff changeset
   529
source:aString
1e742016eea0 category rename / added access to RESOURCE and CALLED flags
Claus Gittinger <cg@exept.de>
parents: 1087
diff changeset
   530
    "set the methods sourcestring"
1e742016eea0 category rename / added access to RESOURCE and CALLED flags
Claus Gittinger <cg@exept.de>
parents: 1087
diff changeset
   531
1e742016eea0 category rename / added access to RESOURCE and CALLED flags
Claus Gittinger <cg@exept.de>
parents: 1087
diff changeset
   532
    source := aString.
1e742016eea0 category rename / added access to RESOURCE and CALLED flags
Claus Gittinger <cg@exept.de>
parents: 1087
diff changeset
   533
    sourcePosition := nil
1e742016eea0 category rename / added access to RESOURCE and CALLED flags
Claus Gittinger <cg@exept.de>
parents: 1087
diff changeset
   534
!
1e742016eea0 category rename / added access to RESOURCE and CALLED flags
Claus Gittinger <cg@exept.de>
parents: 1087
diff changeset
   535
1e742016eea0 category rename / added access to RESOURCE and CALLED flags
Claus Gittinger <cg@exept.de>
parents: 1087
diff changeset
   536
sourceFilename
1e742016eea0 category rename / added access to RESOURCE and CALLED flags
Claus Gittinger <cg@exept.de>
parents: 1087
diff changeset
   537
    "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
   538
1e742016eea0 category rename / added access to RESOURCE and CALLED flags
Claus Gittinger <cg@exept.de>
parents: 1087
diff changeset
   539
    sourcePosition notNil ifTrue:[^ source].
1e742016eea0 category rename / added access to RESOURCE and CALLED flags
Claus Gittinger <cg@exept.de>
parents: 1087
diff changeset
   540
    ^ nil
1e742016eea0 category rename / added access to RESOURCE and CALLED flags
Claus Gittinger <cg@exept.de>
parents: 1087
diff changeset
   541
!
1e742016eea0 category rename / added access to RESOURCE and CALLED flags
Claus Gittinger <cg@exept.de>
parents: 1087
diff changeset
   542
1e742016eea0 category rename / added access to RESOURCE and CALLED flags
Claus Gittinger <cg@exept.de>
parents: 1087
diff changeset
   543
sourceFilename:aFileName position:aNumber
1e742016eea0 category rename / added access to RESOURCE and CALLED flags
Claus Gittinger <cg@exept.de>
parents: 1087
diff changeset
   544
    "set the methods sourcefile/position"
1e742016eea0 category rename / added access to RESOURCE and CALLED flags
Claus Gittinger <cg@exept.de>
parents: 1087
diff changeset
   545
1e742016eea0 category rename / added access to RESOURCE and CALLED flags
Claus Gittinger <cg@exept.de>
parents: 1087
diff changeset
   546
    source := aFileName.
1e742016eea0 category rename / added access to RESOURCE and CALLED flags
Claus Gittinger <cg@exept.de>
parents: 1087
diff changeset
   547
    sourcePosition := aNumber
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
2812
660a3a2a0ef3 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 2805
diff changeset
   550
sourceLineNumber
660a3a2a0ef3 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 2805
diff changeset
   551
    "return the lineNumber of my source within the returned
660a3a2a0ef3 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 2805
diff changeset
   552
     source sourcestring.
660a3a2a0ef3 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 2805
diff changeset
   553
     For ST methods, the returned sourceString is always the
660a3a2a0ef3 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 2805
diff changeset
   554
     methods pure source; therefore, the lineNumber is always 1."
660a3a2a0ef3 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 2805
diff changeset
   555
660a3a2a0ef3 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 2805
diff changeset
   556
    ^ 1
660a3a2a0ef3 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 2805
diff changeset
   557
660a3a2a0ef3 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 2805
diff changeset
   558
    "Created: 30.7.1997 / 15:42:01 / cg"
660a3a2a0ef3 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 2805
diff changeset
   559
!
660a3a2a0ef3 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 2805
diff changeset
   560
1093
1e742016eea0 category rename / added access to RESOURCE and CALLED flags
Claus Gittinger <cg@exept.de>
parents: 1087
diff changeset
   561
sourcePosition
1e742016eea0 category rename / added access to RESOURCE and CALLED flags
Claus Gittinger <cg@exept.de>
parents: 1087
diff changeset
   562
    "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
   563
2176
1a24b0cef25a when compressing sources, make certain to avoid later
Claus Gittinger <cg@exept.de>
parents: 2171
diff changeset
   564
    sourcePosition isNil ifTrue:[^ sourcePosition].
1a24b0cef25a when compressing sources, make certain to avoid later
Claus Gittinger <cg@exept.de>
parents: 2171
diff changeset
   565
    ^ sourcePosition abs
1a24b0cef25a when compressing sources, make certain to avoid later
Claus Gittinger <cg@exept.de>
parents: 2171
diff changeset
   566
1a24b0cef25a when compressing sources, make certain to avoid later
Claus Gittinger <cg@exept.de>
parents: 2171
diff changeset
   567
    "Modified: 16.1.1997 / 01:28:25 / cg"
4669
828addb1c376 source code access - care for package different from my classes
Claus Gittinger <cg@exept.de>
parents: 4595
diff changeset
   568
!
828addb1c376 source code access - care for package different from my classes
Claus Gittinger <cg@exept.de>
parents: 4595
diff changeset
   569
828addb1c376 source code access - care for package different from my classes
Claus Gittinger <cg@exept.de>
parents: 4595
diff changeset
   570
sourceStream
828addb1c376 source code access - care for package different from my classes
Claus Gittinger <cg@exept.de>
parents: 4595
diff changeset
   571
    "return an open sourceStream (needs positioning)"
828addb1c376 source code access - care for package different from my classes
Claus Gittinger <cg@exept.de>
parents: 4595
diff changeset
   572
828addb1c376 source code access - care for package different from my classes
Claus Gittinger <cg@exept.de>
parents: 4595
diff changeset
   573
    |aStream fileName junk who myClass mgr className sep dir mod|
828addb1c376 source code access - care for package different from my classes
Claus Gittinger <cg@exept.de>
parents: 4595
diff changeset
   574
828addb1c376 source code access - care for package different from my classes
Claus Gittinger <cg@exept.de>
parents: 4595
diff changeset
   575
    "
828addb1c376 source code access - care for package different from my classes
Claus Gittinger <cg@exept.de>
parents: 4595
diff changeset
   576
     if sourcePosition is nonNil, its the fileName and
828addb1c376 source code access - care for package different from my classes
Claus Gittinger <cg@exept.de>
parents: 4595
diff changeset
   577
     abs(sourcePosition) is the offset.
828addb1c376 source code access - care for package different from my classes
Claus Gittinger <cg@exept.de>
parents: 4595
diff changeset
   578
     Otherwise, source is the real source
828addb1c376 source code access - care for package different from my classes
Claus Gittinger <cg@exept.de>
parents: 4595
diff changeset
   579
    "
828addb1c376 source code access - care for package different from my classes
Claus Gittinger <cg@exept.de>
parents: 4595
diff changeset
   580
    source isNil ifTrue:[^ nil].
5025
8b1b6a4f4202 fixed the keep-last-file-open mechanism (I hope)
Claus Gittinger <cg@exept.de>
parents: 4817
diff changeset
   581
    sourcePosition isNil ifTrue:[^ source readStream].
4669
828addb1c376 source code access - care for package different from my classes
Claus Gittinger <cg@exept.de>
parents: 4595
diff changeset
   582
828addb1c376 source code access - care for package different from my classes
Claus Gittinger <cg@exept.de>
parents: 4595
diff changeset
   583
    "/ keep the last source file open, because open/close
828addb1c376 source code access - care for package different from my classes
Claus Gittinger <cg@exept.de>
parents: 4595
diff changeset
   584
    "/ operations maybe slow on NFS-mounted file systems.
828addb1c376 source code access - care for package different from my classes
Claus Gittinger <cg@exept.de>
parents: 4595
diff changeset
   585
    "/ Since the reference to the file is weak, it will be closed
828addb1c376 source code access - care for package different from my classes
Claus Gittinger <cg@exept.de>
parents: 4595
diff changeset
   586
    "/ automatically if the file is not referenced for a while. 
828addb1c376 source code access - care for package different from my classes
Claus Gittinger <cg@exept.de>
parents: 4595
diff changeset
   587
    "/ Neat trick.
828addb1c376 source code access - care for package different from my classes
Claus Gittinger <cg@exept.de>
parents: 4595
diff changeset
   588
828addb1c376 source code access - care for package different from my classes
Claus Gittinger <cg@exept.de>
parents: 4595
diff changeset
   589
    LastFileLock critical:[
5322
411b6c0f7250 renamed sone structures;
Claus Gittinger <cg@exept.de>
parents: 5294
diff changeset
   590
	aStream := LastFileReference at:1.
411b6c0f7250 renamed sone structures;
Claus Gittinger <cg@exept.de>
parents: 5294
diff changeset
   591
	LastFileReference at:1 put:0.
411b6c0f7250 renamed sone structures;
Claus Gittinger <cg@exept.de>
parents: 5294
diff changeset
   592
411b6c0f7250 renamed sone structures;
Claus Gittinger <cg@exept.de>
parents: 5294
diff changeset
   593
	aStream == 0 ifTrue:[
411b6c0f7250 renamed sone structures;
Claus Gittinger <cg@exept.de>
parents: 5294
diff changeset
   594
	    aStream := nil.
411b6c0f7250 renamed sone structures;
Claus Gittinger <cg@exept.de>
parents: 5294
diff changeset
   595
	] ifFalse:[
411b6c0f7250 renamed sone structures;
Claus Gittinger <cg@exept.de>
parents: 5294
diff changeset
   596
	    LastSourceFileName = source ifFalse:[
411b6c0f7250 renamed sone structures;
Claus Gittinger <cg@exept.de>
parents: 5294
diff changeset
   597
		aStream close.
411b6c0f7250 renamed sone structures;
Claus Gittinger <cg@exept.de>
parents: 5294
diff changeset
   598
		aStream := nil.
411b6c0f7250 renamed sone structures;
Claus Gittinger <cg@exept.de>
parents: 5294
diff changeset
   599
	    ]
411b6c0f7250 renamed sone structures;
Claus Gittinger <cg@exept.de>
parents: 5294
diff changeset
   600
	].
411b6c0f7250 renamed sone structures;
Claus Gittinger <cg@exept.de>
parents: 5294
diff changeset
   601
	LastSourceFileName := nil.
5025
8b1b6a4f4202 fixed the keep-last-file-open mechanism (I hope)
Claus Gittinger <cg@exept.de>
parents: 4817
diff changeset
   602
    ].
8b1b6a4f4202 fixed the keep-last-file-open mechanism (I hope)
Claus Gittinger <cg@exept.de>
parents: 4817
diff changeset
   603
8b1b6a4f4202 fixed the keep-last-file-open mechanism (I hope)
Claus Gittinger <cg@exept.de>
parents: 4817
diff changeset
   604
    aStream notNil ifTrue:[
5322
411b6c0f7250 renamed sone structures;
Claus Gittinger <cg@exept.de>
parents: 5294
diff changeset
   605
	LastSourceFileName := source.
411b6c0f7250 renamed sone structures;
Claus Gittinger <cg@exept.de>
parents: 5294
diff changeset
   606
	LastFileReference at:1 put:aStream.
411b6c0f7250 renamed sone structures;
Claus Gittinger <cg@exept.de>
parents: 5294
diff changeset
   607
	^ aStream
4669
828addb1c376 source code access - care for package different from my classes
Claus Gittinger <cg@exept.de>
parents: 4595
diff changeset
   608
    ].
828addb1c376 source code access - care for package different from my classes
Claus Gittinger <cg@exept.de>
parents: 4595
diff changeset
   609
828addb1c376 source code access - care for package different from my classes
Claus Gittinger <cg@exept.de>
parents: 4595
diff changeset
   610
    "/ a negative sourcePosition indicates
828addb1c376 source code access - care for package different from my classes
Claus Gittinger <cg@exept.de>
parents: 4595
diff changeset
   611
    "/ that this is a local file (not to be requested
828addb1c376 source code access - care for package different from my classes
Claus Gittinger <cg@exept.de>
parents: 4595
diff changeset
   612
    "/ via the sourceCodeManager)
828addb1c376 source code access - care for package different from my classes
Claus Gittinger <cg@exept.de>
parents: 4595
diff changeset
   613
    "/ This kludge was added, to allow sourceCode to be
828addb1c376 source code access - care for package different from my classes
Claus Gittinger <cg@exept.de>
parents: 4595
diff changeset
   614
    "/ saved to a local source file (i.e. 'st.src')
828addb1c376 source code access - care for package different from my classes
Claus Gittinger <cg@exept.de>
parents: 4595
diff changeset
   615
    "/ and having a clue for which file is meant later.
828addb1c376 source code access - care for package different from my classes
Claus Gittinger <cg@exept.de>
parents: 4595
diff changeset
   616
828addb1c376 source code access - care for package different from my classes
Claus Gittinger <cg@exept.de>
parents: 4595
diff changeset
   617
    sourcePosition < 0 ifTrue:[
5322
411b6c0f7250 renamed sone structures;
Claus Gittinger <cg@exept.de>
parents: 5294
diff changeset
   618
	aStream := source asFilename readStream.
411b6c0f7250 renamed sone structures;
Claus Gittinger <cg@exept.de>
parents: 5294
diff changeset
   619
	aStream notNil ifTrue:[
411b6c0f7250 renamed sone structures;
Claus Gittinger <cg@exept.de>
parents: 5294
diff changeset
   620
	    LastSourceFileName := source.
411b6c0f7250 renamed sone structures;
Claus Gittinger <cg@exept.de>
parents: 5294
diff changeset
   621
	    LastFileReference at:1 put:aStream.
411b6c0f7250 renamed sone structures;
Claus Gittinger <cg@exept.de>
parents: 5294
diff changeset
   622
	    ^ aStream
411b6c0f7250 renamed sone structures;
Claus Gittinger <cg@exept.de>
parents: 5294
diff changeset
   623
	].
411b6c0f7250 renamed sone structures;
Claus Gittinger <cg@exept.de>
parents: 5294
diff changeset
   624
411b6c0f7250 renamed sone structures;
Claus Gittinger <cg@exept.de>
parents: 5294
diff changeset
   625
	fileName := Smalltalk getSourceFileName:source.
411b6c0f7250 renamed sone structures;
Claus Gittinger <cg@exept.de>
parents: 5294
diff changeset
   626
	fileName notNil ifTrue:[
411b6c0f7250 renamed sone structures;
Claus Gittinger <cg@exept.de>
parents: 5294
diff changeset
   627
	    aStream := fileName asFilename readStream.
411b6c0f7250 renamed sone structures;
Claus Gittinger <cg@exept.de>
parents: 5294
diff changeset
   628
	    aStream notNil ifTrue:[
411b6c0f7250 renamed sone structures;
Claus Gittinger <cg@exept.de>
parents: 5294
diff changeset
   629
		LastSourceFileName := source.
411b6c0f7250 renamed sone structures;
Claus Gittinger <cg@exept.de>
parents: 5294
diff changeset
   630
		LastFileReference at:1 put:aStream.
411b6c0f7250 renamed sone structures;
Claus Gittinger <cg@exept.de>
parents: 5294
diff changeset
   631
		^ aStream
411b6c0f7250 renamed sone structures;
Claus Gittinger <cg@exept.de>
parents: 5294
diff changeset
   632
	    ].
411b6c0f7250 renamed sone structures;
Claus Gittinger <cg@exept.de>
parents: 5294
diff changeset
   633
	].
4669
828addb1c376 source code access - care for package different from my classes
Claus Gittinger <cg@exept.de>
parents: 4595
diff changeset
   634
    ].
828addb1c376 source code access - care for package different from my classes
Claus Gittinger <cg@exept.de>
parents: 4595
diff changeset
   635
828addb1c376 source code access - care for package different from my classes
Claus Gittinger <cg@exept.de>
parents: 4595
diff changeset
   636
    "/
828addb1c376 source code access - care for package different from my classes
Claus Gittinger <cg@exept.de>
parents: 4595
diff changeset
   637
    "/ if there is no SourceManager, look in local standard places first
828addb1c376 source code access - care for package different from my classes
Claus Gittinger <cg@exept.de>
parents: 4595
diff changeset
   638
    "/
828addb1c376 source code access - care for package different from my classes
Claus Gittinger <cg@exept.de>
parents: 4595
diff changeset
   639
    (mgr := Smalltalk at:#SourceCodeManager) isNil ifTrue:[
5322
411b6c0f7250 renamed sone structures;
Claus Gittinger <cg@exept.de>
parents: 5294
diff changeset
   640
	aStream := self localSourceStream.
411b6c0f7250 renamed sone structures;
Claus Gittinger <cg@exept.de>
parents: 5294
diff changeset
   641
	aStream notNil ifTrue:[
411b6c0f7250 renamed sone structures;
Claus Gittinger <cg@exept.de>
parents: 5294
diff changeset
   642
	    LastSourceFileName := source.
411b6c0f7250 renamed sone structures;
Claus Gittinger <cg@exept.de>
parents: 5294
diff changeset
   643
	    LastFileReference at:1 put:aStream.
411b6c0f7250 renamed sone structures;
Claus Gittinger <cg@exept.de>
parents: 5294
diff changeset
   644
	    ^ aStream
411b6c0f7250 renamed sone structures;
Claus Gittinger <cg@exept.de>
parents: 5294
diff changeset
   645
	].
4669
828addb1c376 source code access - care for package different from my classes
Claus Gittinger <cg@exept.de>
parents: 4595
diff changeset
   646
    ].
828addb1c376 source code access - care for package different from my classes
Claus Gittinger <cg@exept.de>
parents: 4595
diff changeset
   647
828addb1c376 source code access - care for package different from my classes
Claus Gittinger <cg@exept.de>
parents: 4595
diff changeset
   648
    "/
828addb1c376 source code access - care for package different from my classes
Claus Gittinger <cg@exept.de>
parents: 4595
diff changeset
   649
    "/ nope - ask my class for the source (this also invokes the SCMgr)
828addb1c376 source code access - care for package different from my classes
Claus Gittinger <cg@exept.de>
parents: 4595
diff changeset
   650
    "/
828addb1c376 source code access - care for package different from my classes
Claus Gittinger <cg@exept.de>
parents: 4595
diff changeset
   651
    who := self who.
828addb1c376 source code access - care for package different from my classes
Claus Gittinger <cg@exept.de>
parents: 4595
diff changeset
   652
    who notNil ifTrue:[
5322
411b6c0f7250 renamed sone structures;
Claus Gittinger <cg@exept.de>
parents: 5294
diff changeset
   653
	myClass := who methodClass.
411b6c0f7250 renamed sone structures;
Claus Gittinger <cg@exept.de>
parents: 5294
diff changeset
   654
411b6c0f7250 renamed sone structures;
Claus Gittinger <cg@exept.de>
parents: 5294
diff changeset
   655
	(package notNil and:[package ~= myClass package]) ifTrue:[
411b6c0f7250 renamed sone structures;
Claus Gittinger <cg@exept.de>
parents: 5294
diff changeset
   656
	    mgr notNil ifTrue:[
411b6c0f7250 renamed sone structures;
Claus Gittinger <cg@exept.de>
parents: 5294
diff changeset
   657
		"/ try to get the source using my package information ...
411b6c0f7250 renamed sone structures;
Claus Gittinger <cg@exept.de>
parents: 5294
diff changeset
   658
		sep := package indexOfAny:'/\:'.
411b6c0f7250 renamed sone structures;
Claus Gittinger <cg@exept.de>
parents: 5294
diff changeset
   659
		sep ~~ 0 ifTrue:[
411b6c0f7250 renamed sone structures;
Claus Gittinger <cg@exept.de>
parents: 5294
diff changeset
   660
		    mod := package copyTo:sep - 1.
411b6c0f7250 renamed sone structures;
Claus Gittinger <cg@exept.de>
parents: 5294
diff changeset
   661
		    dir := package copyFrom:sep + 1.
411b6c0f7250 renamed sone structures;
Claus Gittinger <cg@exept.de>
parents: 5294
diff changeset
   662
		    aStream := mgr streamForClass:nil fileName:source revision:nil directory:dir module:mod cache:true.
411b6c0f7250 renamed sone structures;
Claus Gittinger <cg@exept.de>
parents: 5294
diff changeset
   663
		    aStream notNil ifTrue:[
411b6c0f7250 renamed sone structures;
Claus Gittinger <cg@exept.de>
parents: 5294
diff changeset
   664
			LastSourceFileName := source.
411b6c0f7250 renamed sone structures;
Claus Gittinger <cg@exept.de>
parents: 5294
diff changeset
   665
			LastFileReference at:1 put:aStream.
411b6c0f7250 renamed sone structures;
Claus Gittinger <cg@exept.de>
parents: 5294
diff changeset
   666
			^ aStream
411b6c0f7250 renamed sone structures;
Claus Gittinger <cg@exept.de>
parents: 5294
diff changeset
   667
		    ].
411b6c0f7250 renamed sone structures;
Claus Gittinger <cg@exept.de>
parents: 5294
diff changeset
   668
		].
411b6c0f7250 renamed sone structures;
Claus Gittinger <cg@exept.de>
parents: 5294
diff changeset
   669
	    ].
411b6c0f7250 renamed sone structures;
Claus Gittinger <cg@exept.de>
parents: 5294
diff changeset
   670
	].
411b6c0f7250 renamed sone structures;
Claus Gittinger <cg@exept.de>
parents: 5294
diff changeset
   671
411b6c0f7250 renamed sone structures;
Claus Gittinger <cg@exept.de>
parents: 5294
diff changeset
   672
	aStream := myClass sourceStreamFor:source.
411b6c0f7250 renamed sone structures;
Claus Gittinger <cg@exept.de>
parents: 5294
diff changeset
   673
	aStream notNil ifTrue:[
411b6c0f7250 renamed sone structures;
Claus Gittinger <cg@exept.de>
parents: 5294
diff changeset
   674
	    LastSourceFileName := source.
411b6c0f7250 renamed sone structures;
Claus Gittinger <cg@exept.de>
parents: 5294
diff changeset
   675
	    LastFileReference at:1 put:aStream.
411b6c0f7250 renamed sone structures;
Claus Gittinger <cg@exept.de>
parents: 5294
diff changeset
   676
	    ^ aStream
411b6c0f7250 renamed sone structures;
Claus Gittinger <cg@exept.de>
parents: 5294
diff changeset
   677
	].
4669
828addb1c376 source code access - care for package different from my classes
Claus Gittinger <cg@exept.de>
parents: 4595
diff changeset
   678
    ].
828addb1c376 source code access - care for package different from my classes
Claus Gittinger <cg@exept.de>
parents: 4595
diff changeset
   679
828addb1c376 source code access - care for package different from my classes
Claus Gittinger <cg@exept.de>
parents: 4595
diff changeset
   680
    "/
828addb1c376 source code access - care for package different from my classes
Claus Gittinger <cg@exept.de>
parents: 4595
diff changeset
   681
    "/ nope - look in standard places 
828addb1c376 source code access - care for package different from my classes
Claus Gittinger <cg@exept.de>
parents: 4595
diff changeset
   682
    "/ (if there is a source-code manager - otherwise, we already did that)
828addb1c376 source code access - care for package different from my classes
Claus Gittinger <cg@exept.de>
parents: 4595
diff changeset
   683
    "/
828addb1c376 source code access - care for package different from my classes
Claus Gittinger <cg@exept.de>
parents: 4595
diff changeset
   684
    mgr notNil ifTrue:[
5322
411b6c0f7250 renamed sone structures;
Claus Gittinger <cg@exept.de>
parents: 5294
diff changeset
   685
	aStream := self localSourceStream.
411b6c0f7250 renamed sone structures;
Claus Gittinger <cg@exept.de>
parents: 5294
diff changeset
   686
	aStream notNil ifTrue:[
411b6c0f7250 renamed sone structures;
Claus Gittinger <cg@exept.de>
parents: 5294
diff changeset
   687
	    LastSourceFileName := source.
411b6c0f7250 renamed sone structures;
Claus Gittinger <cg@exept.de>
parents: 5294
diff changeset
   688
	    LastFileReference at:1 put:aStream.
411b6c0f7250 renamed sone structures;
Claus Gittinger <cg@exept.de>
parents: 5294
diff changeset
   689
	    ^ aStream
411b6c0f7250 renamed sone structures;
Claus Gittinger <cg@exept.de>
parents: 5294
diff changeset
   690
	].
4669
828addb1c376 source code access - care for package different from my classes
Claus Gittinger <cg@exept.de>
parents: 4595
diff changeset
   691
    ].
828addb1c376 source code access - care for package different from my classes
Claus Gittinger <cg@exept.de>
parents: 4595
diff changeset
   692
828addb1c376 source code access - care for package different from my classes
Claus Gittinger <cg@exept.de>
parents: 4595
diff changeset
   693
    "/
828addb1c376 source code access - care for package different from my classes
Claus Gittinger <cg@exept.de>
parents: 4595
diff changeset
   694
    "/ final chance: try current directory
828addb1c376 source code access - care for package different from my classes
Claus Gittinger <cg@exept.de>
parents: 4595
diff changeset
   695
    "/
828addb1c376 source code access - care for package different from my classes
Claus Gittinger <cg@exept.de>
parents: 4595
diff changeset
   696
    aStream isNil ifTrue:[
5322
411b6c0f7250 renamed sone structures;
Claus Gittinger <cg@exept.de>
parents: 5294
diff changeset
   697
	aStream := source asFilename readStream.
411b6c0f7250 renamed sone structures;
Claus Gittinger <cg@exept.de>
parents: 5294
diff changeset
   698
	aStream notNil ifTrue:[
411b6c0f7250 renamed sone structures;
Claus Gittinger <cg@exept.de>
parents: 5294
diff changeset
   699
	    LastSourceFileName := source.
411b6c0f7250 renamed sone structures;
Claus Gittinger <cg@exept.de>
parents: 5294
diff changeset
   700
	    LastFileReference at:1 put:aStream.
411b6c0f7250 renamed sone structures;
Claus Gittinger <cg@exept.de>
parents: 5294
diff changeset
   701
	    ^ aStream
411b6c0f7250 renamed sone structures;
Claus Gittinger <cg@exept.de>
parents: 5294
diff changeset
   702
	].
4669
828addb1c376 source code access - care for package different from my classes
Claus Gittinger <cg@exept.de>
parents: 4595
diff changeset
   703
    ].
828addb1c376 source code access - care for package different from my classes
Claus Gittinger <cg@exept.de>
parents: 4595
diff changeset
   704
828addb1c376 source code access - care for package different from my classes
Claus Gittinger <cg@exept.de>
parents: 4595
diff changeset
   705
    (who isNil and:[source notNil]) ifTrue:[
5322
411b6c0f7250 renamed sone structures;
Claus Gittinger <cg@exept.de>
parents: 5294
diff changeset
   706
	"/
411b6c0f7250 renamed sone structures;
Claus Gittinger <cg@exept.de>
parents: 5294
diff changeset
   707
	"/ mhmh - seems to be a method which used to be in some
411b6c0f7250 renamed sone structures;
Claus Gittinger <cg@exept.de>
parents: 5294
diff changeset
   708
	"/ class, but has been overwritten by another or removed.
411b6c0f7250 renamed sone structures;
Claus Gittinger <cg@exept.de>
parents: 5294
diff changeset
   709
	"/ (i.e. it has no containing class anyMore)
411b6c0f7250 renamed sone structures;
Claus Gittinger <cg@exept.de>
parents: 5294
diff changeset
   710
	"/ try to guess the class from the sourceFileName.
411b6c0f7250 renamed sone structures;
Claus Gittinger <cg@exept.de>
parents: 5294
diff changeset
   711
	"/ and retry.
411b6c0f7250 renamed sone structures;
Claus Gittinger <cg@exept.de>
parents: 5294
diff changeset
   712
	"/
411b6c0f7250 renamed sone structures;
Claus Gittinger <cg@exept.de>
parents: 5294
diff changeset
   713
	className := Smalltalk classNameForFile:source.
411b6c0f7250 renamed sone structures;
Claus Gittinger <cg@exept.de>
parents: 5294
diff changeset
   714
	className knownAsSymbol ifTrue:[
411b6c0f7250 renamed sone structures;
Claus Gittinger <cg@exept.de>
parents: 5294
diff changeset
   715
	    myClass := Smalltalk at:className asSymbol ifAbsent:nil.
411b6c0f7250 renamed sone structures;
Claus Gittinger <cg@exept.de>
parents: 5294
diff changeset
   716
	    myClass notNil ifTrue:[
411b6c0f7250 renamed sone structures;
Claus Gittinger <cg@exept.de>
parents: 5294
diff changeset
   717
		aStream := myClass sourceStreamFor:source.
411b6c0f7250 renamed sone structures;
Claus Gittinger <cg@exept.de>
parents: 5294
diff changeset
   718
		aStream notNil ifTrue:[
411b6c0f7250 renamed sone structures;
Claus Gittinger <cg@exept.de>
parents: 5294
diff changeset
   719
		    LastSourceFileName := source.
411b6c0f7250 renamed sone structures;
Claus Gittinger <cg@exept.de>
parents: 5294
diff changeset
   720
		    LastFileReference at:1 put:aStream.
411b6c0f7250 renamed sone structures;
Claus Gittinger <cg@exept.de>
parents: 5294
diff changeset
   721
		    ^ aStream
411b6c0f7250 renamed sone structures;
Claus Gittinger <cg@exept.de>
parents: 5294
diff changeset
   722
		].
411b6c0f7250 renamed sone structures;
Claus Gittinger <cg@exept.de>
parents: 5294
diff changeset
   723
	    ]
411b6c0f7250 renamed sone structures;
Claus Gittinger <cg@exept.de>
parents: 5294
diff changeset
   724
	]
4669
828addb1c376 source code access - care for package different from my classes
Claus Gittinger <cg@exept.de>
parents: 4595
diff changeset
   725
    ].                
828addb1c376 source code access - care for package different from my classes
Claus Gittinger <cg@exept.de>
parents: 4595
diff changeset
   726
828addb1c376 source code access - care for package different from my classes
Claus Gittinger <cg@exept.de>
parents: 4595
diff changeset
   727
    ^ nil
1093
1e742016eea0 category rename / added access to RESOURCE and CALLED flags
Claus Gittinger <cg@exept.de>
parents: 1087
diff changeset
   728
! !
1e742016eea0 category rename / added access to RESOURCE and CALLED flags
Claus Gittinger <cg@exept.de>
parents: 1087
diff changeset
   729
1e742016eea0 category rename / added access to RESOURCE and CALLED flags
Claus Gittinger <cg@exept.de>
parents: 1087
diff changeset
   730
!Method methodsFor:'accessing-visibility'!
1e742016eea0 category rename / added access to RESOURCE and CALLED flags
Claus Gittinger <cg@exept.de>
parents: 1087
diff changeset
   731
952
d600e08a5936 handle the case where a method has a sourceFileInfo, but the class has not
Claus Gittinger <cg@exept.de>
parents: 934
diff changeset
   732
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
   733
    "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
   734
     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
   735
     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
   736
     it in its message lookup.
747
ea3b6f7fd7ce added ignoredMethods
Claus Gittinger <cg@exept.de>
parents: 737
diff changeset
   737
     (i.e. setting a method to #ignored, and sending that selector,
ea3b6f7fd7ce added ignoredMethods
Claus Gittinger <cg@exept.de>
parents: 737
diff changeset
   738
      leads to either the superclasses implementation to be called, 
ea3b6f7fd7ce added ignoredMethods
Claus Gittinger <cg@exept.de>
parents: 737
diff changeset
   739
      or a doesNotUnderstand exception to be raised)
ea3b6f7fd7ce added ignoredMethods
Claus Gittinger <cg@exept.de>
parents: 737
diff changeset
   740
952
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
     Notice: this is a nonstandard feature, not supported
747
ea3b6f7fd7ce added ignoredMethods
Claus Gittinger <cg@exept.de>
parents: 737
diff changeset
   742
     by other smalltalk implementations and not specified in the ANSI spec.
ea3b6f7fd7ce added ignoredMethods
Claus Gittinger <cg@exept.de>
parents: 737
diff changeset
   743
ea3b6f7fd7ce added ignoredMethods
Claus Gittinger <cg@exept.de>
parents: 737
diff changeset
   744
     This is EXPERIMENTAL - and being evaluated for usability.
ea3b6f7fd7ce added ignoredMethods
Claus Gittinger <cg@exept.de>
parents: 737
diff changeset
   745
     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
   746
3216
e0f3f49118ed Simplify privacy stuff to make redirection from WrappedMethod easier.
Stefan Vogel <sv@exept.de>
parents: 3168
diff changeset
   747
    ^ self privacy == #ignored
e0f3f49118ed Simplify privacy stuff to make redirection from WrappedMethod easier.
Stefan Vogel <sv@exept.de>
parents: 3168
diff changeset
   748
e0f3f49118ed Simplify privacy stuff to make redirection from WrappedMethod easier.
Stefan Vogel <sv@exept.de>
parents: 3168
diff changeset
   749
    "Modified: / 23.1.1998 / 15:23:02 / stefan"
176
48061f8659aa more queries
claus
parents: 159
diff changeset
   750
!
48061f8659aa more queries
claus
parents: 159
diff changeset
   751
48061f8659aa more queries
claus
parents: 159
diff changeset
   752
isPrivate
48061f8659aa more queries
claus
parents: 159
diff changeset
   753
    "return true, if this is a private method.
48061f8659aa more queries
claus
parents: 159
diff changeset
   754
     Execution of private methods is only allowed via self/super sends
48061f8659aa more queries
claus
parents: 159
diff changeset
   755
     from superclasses, the class itself or subclasses.
48061f8659aa more queries
claus
parents: 159
diff changeset
   756
     If a private method is called by some other class, a runtime
48061f8659aa more queries
claus
parents: 159
diff changeset
   757
     error (PrivateMethodSignal) is raised.
48061f8659aa more queries
claus
parents: 159
diff changeset
   758
     Notice: method privacy is a nonstandard feature, not supported
48061f8659aa more queries
claus
parents: 159
diff changeset
   759
     by other smalltalk implementations and not specified in the ANSI spec.
747
ea3b6f7fd7ce added ignoredMethods
Claus Gittinger <cg@exept.de>
parents: 737
diff changeset
   760
176
48061f8659aa more queries
claus
parents: 159
diff changeset
   761
     This is EXPERIMENTAL - and being evaluated for usability.
48061f8659aa more queries
claus
parents: 159
diff changeset
   762
     It may change or even vanish (if it shows to be not useful)."
48061f8659aa more queries
claus
parents: 159
diff changeset
   763
3216
e0f3f49118ed Simplify privacy stuff to make redirection from WrappedMethod easier.
Stefan Vogel <sv@exept.de>
parents: 3168
diff changeset
   764
    ^ self privacy == #private
e0f3f49118ed Simplify privacy stuff to make redirection from WrappedMethod easier.
Stefan Vogel <sv@exept.de>
parents: 3168
diff changeset
   765
e0f3f49118ed Simplify privacy stuff to make redirection from WrappedMethod easier.
Stefan Vogel <sv@exept.de>
parents: 3168
diff changeset
   766
    "Modified: / 23.1.1998 / 15:23:13 / stefan"
68
59faa75185ba *** empty log message ***
claus
parents: 56
diff changeset
   767
!
59faa75185ba *** empty log message ***
claus
parents: 56
diff changeset
   768
176
48061f8659aa more queries
claus
parents: 159
diff changeset
   769
isProtected
48061f8659aa more queries
claus
parents: 159
diff changeset
   770
    "return true, if this is a protected method.
48061f8659aa more queries
claus
parents: 159
diff changeset
   771
     Execution of protected methods is only allowed via self sends
48061f8659aa more queries
claus
parents: 159
diff changeset
   772
     from superclasses or the class itself.
48061f8659aa more queries
claus
parents: 159
diff changeset
   773
     If a protected method is called by some other class, a runtime
48061f8659aa more queries
claus
parents: 159
diff changeset
   774
     error (PrivateMethodSignal) is raised.
747
ea3b6f7fd7ce added ignoredMethods
Claus Gittinger <cg@exept.de>
parents: 737
diff changeset
   775
176
48061f8659aa more queries
claus
parents: 159
diff changeset
   776
     Notice: method privacy is a nonstandard feature, not supported
48061f8659aa more queries
claus
parents: 159
diff changeset
   777
     by other smalltalk implementations and not specified in the ANSI spec.
747
ea3b6f7fd7ce added ignoredMethods
Claus Gittinger <cg@exept.de>
parents: 737
diff changeset
   778
176
48061f8659aa more queries
claus
parents: 159
diff changeset
   779
     This is EXPERIMENTAL - and being evaluated for usability.
48061f8659aa more queries
claus
parents: 159
diff changeset
   780
     It may change or even vanish (if it shows to be not useful)."
48061f8659aa more queries
claus
parents: 159
diff changeset
   781
3216
e0f3f49118ed Simplify privacy stuff to make redirection from WrappedMethod easier.
Stefan Vogel <sv@exept.de>
parents: 3168
diff changeset
   782
    ^ self privacy == #protected
e0f3f49118ed Simplify privacy stuff to make redirection from WrappedMethod easier.
Stefan Vogel <sv@exept.de>
parents: 3168
diff changeset
   783
e0f3f49118ed Simplify privacy stuff to make redirection from WrappedMethod easier.
Stefan Vogel <sv@exept.de>
parents: 3168
diff changeset
   784
    "Modified: / 23.1.1998 / 15:23:27 / stefan"
176
48061f8659aa more queries
claus
parents: 159
diff changeset
   785
!
48061f8659aa more queries
claus
parents: 159
diff changeset
   786
48061f8659aa more queries
claus
parents: 159
diff changeset
   787
isPublic
48061f8659aa more queries
claus
parents: 159
diff changeset
   788
    "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
   789
     This is the default and how other smalltalk implementations treat all methods.
ea3b6f7fd7ce added ignoredMethods
Claus Gittinger <cg@exept.de>
parents: 737
diff changeset
   790
360
claus
parents: 350
diff changeset
   791
     Notice: method privacy is a nonstandard feature, not supported
claus
parents: 350
diff changeset
   792
     by other smalltalk implementations and not specified in the ANSI spec.
747
ea3b6f7fd7ce added ignoredMethods
Claus Gittinger <cg@exept.de>
parents: 737
diff changeset
   793
360
claus
parents: 350
diff changeset
   794
     This is EXPERIMENTAL - and being evaluated for usability.
claus
parents: 350
diff changeset
   795
     It may change or even vanish (if it shows to be not useful)."
176
48061f8659aa more queries
claus
parents: 159
diff changeset
   796
3216
e0f3f49118ed Simplify privacy stuff to make redirection from WrappedMethod easier.
Stefan Vogel <sv@exept.de>
parents: 3168
diff changeset
   797
    ^ self privacy == #public
e0f3f49118ed Simplify privacy stuff to make redirection from WrappedMethod easier.
Stefan Vogel <sv@exept.de>
parents: 3168
diff changeset
   798
e0f3f49118ed Simplify privacy stuff to make redirection from WrappedMethod easier.
Stefan Vogel <sv@exept.de>
parents: 3168
diff changeset
   799
    "Modified: / 23.1.1998 / 15:23:40 / stefan"
176
48061f8659aa more queries
claus
parents: 159
diff changeset
   800
!
48061f8659aa more queries
claus
parents: 159
diff changeset
   801
747
ea3b6f7fd7ce added ignoredMethods
Claus Gittinger <cg@exept.de>
parents: 737
diff changeset
   802
isRestricted
ea3b6f7fd7ce added ignoredMethods
Claus Gittinger <cg@exept.de>
parents: 737
diff changeset
   803
    "return the flag bit stating that this method is restricted.
ea3b6f7fd7ce added ignoredMethods
Claus Gittinger <cg@exept.de>
parents: 737
diff changeset
   804
     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
   805
     'trap restricted mode' (-->ObjectMemory) otherise a runtime 
ea3b6f7fd7ce added ignoredMethods
Claus Gittinger <cg@exept.de>
parents: 737
diff changeset
   806
     error (PrivateMethodSignal) is raised.
ea3b6f7fd7ce added ignoredMethods
Claus Gittinger <cg@exept.de>
parents: 737
diff changeset
   807
ea3b6f7fd7ce added ignoredMethods
Claus Gittinger <cg@exept.de>
parents: 737
diff changeset
   808
     Notice: method restriction is a nonstandard feature, not supported
ea3b6f7fd7ce added ignoredMethods
Claus Gittinger <cg@exept.de>
parents: 737
diff changeset
   809
     by other smalltalk implementations and not specified in the ANSI spec.
ea3b6f7fd7ce added ignoredMethods
Claus Gittinger <cg@exept.de>
parents: 737
diff changeset
   810
ea3b6f7fd7ce added ignoredMethods
Claus Gittinger <cg@exept.de>
parents: 737
diff changeset
   811
     This is EXPERIMENTAL - and being evaluated for usability.
ea3b6f7fd7ce added ignoredMethods
Claus Gittinger <cg@exept.de>
parents: 737
diff changeset
   812
     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
   813
ea3b6f7fd7ce added ignoredMethods
Claus Gittinger <cg@exept.de>
parents: 737
diff changeset
   814
%{  /* NOCONTEXT */
ea3b6f7fd7ce added ignoredMethods
Claus Gittinger <cg@exept.de>
parents: 737
diff changeset
   815
#ifdef F_RESTRICTED
2868
772c890f907c alpha64
Claus Gittinger <cg@exept.de>
parents: 2826
diff changeset
   816
    INT f = __intVal(__INST(flags));
747
ea3b6f7fd7ce added ignoredMethods
Claus Gittinger <cg@exept.de>
parents: 737
diff changeset
   817
ea3b6f7fd7ce added ignoredMethods
Claus Gittinger <cg@exept.de>
parents: 737
diff changeset
   818
    if (f & F_RESTRICTED) {
ea3b6f7fd7ce added ignoredMethods
Claus Gittinger <cg@exept.de>
parents: 737
diff changeset
   819
	RETURN (true);
ea3b6f7fd7ce added ignoredMethods
Claus Gittinger <cg@exept.de>
parents: 737
diff changeset
   820
    }
ea3b6f7fd7ce added ignoredMethods
Claus Gittinger <cg@exept.de>
parents: 737
diff changeset
   821
#endif
ea3b6f7fd7ce added ignoredMethods
Claus Gittinger <cg@exept.de>
parents: 737
diff changeset
   822
%}.
ea3b6f7fd7ce added ignoredMethods
Claus Gittinger <cg@exept.de>
parents: 737
diff changeset
   823
    ^ false
952
d600e08a5936 handle the case where a method has a sourceFileInfo, but the class has not
Claus Gittinger <cg@exept.de>
parents: 934
diff changeset
   824
!
d600e08a5936 handle the case where a method has a sourceFileInfo, but the class has not
Claus Gittinger <cg@exept.de>
parents: 934
diff changeset
   825
d600e08a5936 handle the case where a method has a sourceFileInfo, but the class has not
Claus Gittinger <cg@exept.de>
parents: 934
diff changeset
   826
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
   827
    "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
   828
     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
   829
d600e08a5936 handle the case where a method has a sourceFileInfo, but the class has not
Claus Gittinger <cg@exept.de>
parents: 934
diff changeset
   830
     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
   831
     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
   832
     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
   833
     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
   834
     (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
   835
d600e08a5936 handle the case where a method has a sourceFileInfo, but the class has not
Claus Gittinger <cg@exept.de>
parents: 934
diff changeset
   836
     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
   837
     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
   838
3216
e0f3f49118ed Simplify privacy stuff to make redirection from WrappedMethod easier.
Stefan Vogel <sv@exept.de>
parents: 3168
diff changeset
   839
%{  /* NOCONTEXT */
e0f3f49118ed Simplify privacy stuff to make redirection from WrappedMethod easier.
Stefan Vogel <sv@exept.de>
parents: 3168
diff changeset
   840
    /* 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
   841
e0f3f49118ed Simplify privacy stuff to make redirection from WrappedMethod easier.
Stefan Vogel <sv@exept.de>
parents: 3168
diff changeset
   842
#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
   843
e0f3f49118ed Simplify privacy stuff to make redirection from WrappedMethod easier.
Stefan Vogel <sv@exept.de>
parents: 3168
diff changeset
   844
    INT f = __intVal(__INST(flags));
e0f3f49118ed Simplify privacy stuff to make redirection from WrappedMethod easier.
Stefan Vogel <sv@exept.de>
parents: 3168
diff changeset
   845
    switch (f & M_PRIVACY) {
e0f3f49118ed Simplify privacy stuff to make redirection from WrappedMethod easier.
Stefan Vogel <sv@exept.de>
parents: 3168
diff changeset
   846
e0f3f49118ed Simplify privacy stuff to make redirection from WrappedMethod easier.
Stefan Vogel <sv@exept.de>
parents: 3168
diff changeset
   847
# ifdef F_PRIVATE
e0f3f49118ed Simplify privacy stuff to make redirection from WrappedMethod easier.
Stefan Vogel <sv@exept.de>
parents: 3168
diff changeset
   848
    case F_PRIVATE:
5322
411b6c0f7250 renamed sone structures;
Claus Gittinger <cg@exept.de>
parents: 5294
diff changeset
   849
	RETURN (@symbol(private));
411b6c0f7250 renamed sone structures;
Claus Gittinger <cg@exept.de>
parents: 5294
diff changeset
   850
	break;
3216
e0f3f49118ed Simplify privacy stuff to make redirection from WrappedMethod easier.
Stefan Vogel <sv@exept.de>
parents: 3168
diff changeset
   851
# endif
e0f3f49118ed Simplify privacy stuff to make redirection from WrappedMethod easier.
Stefan Vogel <sv@exept.de>
parents: 3168
diff changeset
   852
# ifdef F_CLASSPRIVATE
e0f3f49118ed Simplify privacy stuff to make redirection from WrappedMethod easier.
Stefan Vogel <sv@exept.de>
parents: 3168
diff changeset
   853
    case F_CLASSPRIVATE:
5322
411b6c0f7250 renamed sone structures;
Claus Gittinger <cg@exept.de>
parents: 5294
diff changeset
   854
	RETURN (@symbol(protected));
411b6c0f7250 renamed sone structures;
Claus Gittinger <cg@exept.de>
parents: 5294
diff changeset
   855
	break;
3216
e0f3f49118ed Simplify privacy stuff to make redirection from WrappedMethod easier.
Stefan Vogel <sv@exept.de>
parents: 3168
diff changeset
   856
# endif
e0f3f49118ed Simplify privacy stuff to make redirection from WrappedMethod easier.
Stefan Vogel <sv@exept.de>
parents: 3168
diff changeset
   857
# ifdef F_IGNORED
e0f3f49118ed Simplify privacy stuff to make redirection from WrappedMethod easier.
Stefan Vogel <sv@exept.de>
parents: 3168
diff changeset
   858
    case F_IGNORED:
5322
411b6c0f7250 renamed sone structures;
Claus Gittinger <cg@exept.de>
parents: 5294
diff changeset
   859
	RETURN (@symbol(ignored));
411b6c0f7250 renamed sone structures;
Claus Gittinger <cg@exept.de>
parents: 5294
diff changeset
   860
	break;
3216
e0f3f49118ed Simplify privacy stuff to make redirection from WrappedMethod easier.
Stefan Vogel <sv@exept.de>
parents: 3168
diff changeset
   861
# endif
e0f3f49118ed Simplify privacy stuff to make redirection from WrappedMethod easier.
Stefan Vogel <sv@exept.de>
parents: 3168
diff changeset
   862
    }
e0f3f49118ed Simplify privacy stuff to make redirection from WrappedMethod easier.
Stefan Vogel <sv@exept.de>
parents: 3168
diff changeset
   863
#endif
e0f3f49118ed Simplify privacy stuff to make redirection from WrappedMethod easier.
Stefan Vogel <sv@exept.de>
parents: 3168
diff changeset
   864
%}.
e0f3f49118ed Simplify privacy stuff to make redirection from WrappedMethod easier.
Stefan Vogel <sv@exept.de>
parents: 3168
diff changeset
   865
952
d600e08a5936 handle the case where a method has a sourceFileInfo, but the class has not
Claus Gittinger <cg@exept.de>
parents: 934
diff changeset
   866
    ^ #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
   867
!
d600e08a5936 handle the case where a method has a sourceFileInfo, but the class has not
Claus Gittinger <cg@exept.de>
parents: 934
diff changeset
   868
d600e08a5936 handle the case where a method has a sourceFileInfo, but the class has not
Claus Gittinger <cg@exept.de>
parents: 934
diff changeset
   869
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
   870
    "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
   871
     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
   872
d600e08a5936 handle the case where a method has a sourceFileInfo, but the class has not
Claus Gittinger <cg@exept.de>
parents: 934
diff changeset
   873
     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
   874
     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
   875
     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
   876
     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
   877
     (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
   878
d600e08a5936 handle the case where a method has a sourceFileInfo, but the class has not
Claus Gittinger <cg@exept.de>
parents: 934
diff changeset
   879
     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
   880
     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
   881
3216
e0f3f49118ed Simplify privacy stuff to make redirection from WrappedMethod easier.
Stefan Vogel <sv@exept.de>
parents: 3168
diff changeset
   882
    |old|
e0f3f49118ed Simplify privacy stuff to make redirection from WrappedMethod easier.
Stefan Vogel <sv@exept.de>
parents: 3168
diff changeset
   883
e0f3f49118ed Simplify privacy stuff to make redirection from WrappedMethod easier.
Stefan Vogel <sv@exept.de>
parents: 3168
diff changeset
   884
    old := self privacy.
e0f3f49118ed Simplify privacy stuff to make redirection from WrappedMethod easier.
Stefan Vogel <sv@exept.de>
parents: 3168
diff changeset
   885
    self setPrivacy:aSymbol.
e0f3f49118ed Simplify privacy stuff to make redirection from WrappedMethod easier.
Stefan Vogel <sv@exept.de>
parents: 3168
diff changeset
   886
e0f3f49118ed Simplify privacy stuff to make redirection from WrappedMethod easier.
Stefan Vogel <sv@exept.de>
parents: 3168
diff changeset
   887
    "/
e0f3f49118ed Simplify privacy stuff to make redirection from WrappedMethod easier.
Stefan Vogel <sv@exept.de>
parents: 3168
diff changeset
   888
    "/ no need to flush, if changing from private to public
e0f3f49118ed Simplify privacy stuff to make redirection from WrappedMethod easier.
Stefan Vogel <sv@exept.de>
parents: 3168
diff changeset
   889
    "/
e0f3f49118ed Simplify privacy stuff to make redirection from WrappedMethod easier.
Stefan Vogel <sv@exept.de>
parents: 3168
diff changeset
   890
    (aSymbol == #public and:[old ~~ #ignored]) ifFalse:[
5322
411b6c0f7250 renamed sone structures;
Claus Gittinger <cg@exept.de>
parents: 5294
diff changeset
   891
	ObjectMemory flushCaches.
3216
e0f3f49118ed Simplify privacy stuff to make redirection from WrappedMethod easier.
Stefan Vogel <sv@exept.de>
parents: 3168
diff changeset
   892
    ]
e0f3f49118ed Simplify privacy stuff to make redirection from WrappedMethod easier.
Stefan Vogel <sv@exept.de>
parents: 3168
diff changeset
   893
e0f3f49118ed Simplify privacy stuff to make redirection from WrappedMethod easier.
Stefan Vogel <sv@exept.de>
parents: 3168
diff changeset
   894
    "Modified: / 27.8.1995 / 22:58:08 / claus"
e0f3f49118ed Simplify privacy stuff to make redirection from WrappedMethod easier.
Stefan Vogel <sv@exept.de>
parents: 3168
diff changeset
   895
    "Modified: / 23.1.1998 / 15:19:07 / stefan"
952
d600e08a5936 handle the case where a method has a sourceFileInfo, but the class has not
Claus Gittinger <cg@exept.de>
parents: 934
diff changeset
   896
!
747
ea3b6f7fd7ce added ignoredMethods
Claus Gittinger <cg@exept.de>
parents: 737
diff changeset
   897
532
2511c99de912 New code to trap restricted (RT) methods.
Stefan Vogel <sv@exept.de>
parents: 530
diff changeset
   898
restricted:aBoolean
2511c99de912 New code to trap restricted (RT) methods.
Stefan Vogel <sv@exept.de>
parents: 530
diff changeset
   899
    "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
   900
     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
   901
     'trap restricted mode' (-->ObjectMemory) otherise a runtime
2511c99de912 New code to trap restricted (RT) methods.
Stefan Vogel <sv@exept.de>
parents: 530
diff changeset
   902
     error (PrivateMethodSignal) is raised.
747
ea3b6f7fd7ce added ignoredMethods
Claus Gittinger <cg@exept.de>
parents: 737
diff changeset
   903
532
2511c99de912 New code to trap restricted (RT) methods.
Stefan Vogel <sv@exept.de>
parents: 530
diff changeset
   904
     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
   905
     by other smalltalk implementations and not specified in the ANSI spec.
747
ea3b6f7fd7ce added ignoredMethods
Claus Gittinger <cg@exept.de>
parents: 737
diff changeset
   906
532
2511c99de912 New code to trap restricted (RT) methods.
Stefan Vogel <sv@exept.de>
parents: 530
diff changeset
   907
     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
   908
     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
   909
2511c99de912 New code to trap restricted (RT) methods.
Stefan Vogel <sv@exept.de>
parents: 530
diff changeset
   910
%{  /* NOCONTEXT */
2511c99de912 New code to trap restricted (RT) methods.
Stefan Vogel <sv@exept.de>
parents: 530
diff changeset
   911
    /* 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
   912
2511c99de912 New code to trap restricted (RT) methods.
Stefan Vogel <sv@exept.de>
parents: 530
diff changeset
   913
#ifdef F_RESTRICTED
2868
772c890f907c alpha64
Claus Gittinger <cg@exept.de>
parents: 2826
diff changeset
   914
    INT f = __intVal(__INST(flags));
772c890f907c alpha64
Claus Gittinger <cg@exept.de>
parents: 2826
diff changeset
   915
    INT old;
532
2511c99de912 New code to trap restricted (RT) methods.
Stefan Vogel <sv@exept.de>
parents: 530
diff changeset
   916
747
ea3b6f7fd7ce added ignoredMethods
Claus Gittinger <cg@exept.de>
parents: 737
diff changeset
   917
    old = f;
532
2511c99de912 New code to trap restricted (RT) methods.
Stefan Vogel <sv@exept.de>
parents: 530
diff changeset
   918
    if (aBoolean == true) 
2511c99de912 New code to trap restricted (RT) methods.
Stefan Vogel <sv@exept.de>
parents: 530
diff changeset
   919
	f |= F_RESTRICTED;
2511c99de912 New code to trap restricted (RT) methods.
Stefan Vogel <sv@exept.de>
parents: 530
diff changeset
   920
    else
2511c99de912 New code to trap restricted (RT) methods.
Stefan Vogel <sv@exept.de>
parents: 530
diff changeset
   921
	f &= ~F_RESTRICTED;
1133
961f2b095c22 underline cleanup
Claus Gittinger <cg@exept.de>
parents: 1103
diff changeset
   922
    __INST(flags) = __MKSMALLINT(f);
532
2511c99de912 New code to trap restricted (RT) methods.
Stefan Vogel <sv@exept.de>
parents: 530
diff changeset
   923
    if (old & F_RESTRICTED)
2511c99de912 New code to trap restricted (RT) methods.
Stefan Vogel <sv@exept.de>
parents: 530
diff changeset
   924
	RETURN(true);
2511c99de912 New code to trap restricted (RT) methods.
Stefan Vogel <sv@exept.de>
parents: 530
diff changeset
   925
#endif
2511c99de912 New code to trap restricted (RT) methods.
Stefan Vogel <sv@exept.de>
parents: 530
diff changeset
   926
%}.
2511c99de912 New code to trap restricted (RT) methods.
Stefan Vogel <sv@exept.de>
parents: 530
diff changeset
   927
    ^ false
2511c99de912 New code to trap restricted (RT) methods.
Stefan Vogel <sv@exept.de>
parents: 530
diff changeset
   928
747
ea3b6f7fd7ce added ignoredMethods
Claus Gittinger <cg@exept.de>
parents: 737
diff changeset
   929
    "
ea3b6f7fd7ce added ignoredMethods
Claus Gittinger <cg@exept.de>
parents: 737
diff changeset
   930
     (ObjectMemory class compiledMethodAt:#compressingGarbageCollect) restricted:true
ea3b6f7fd7ce added ignoredMethods
Claus Gittinger <cg@exept.de>
parents: 737
diff changeset
   931
    "
532
2511c99de912 New code to trap restricted (RT) methods.
Stefan Vogel <sv@exept.de>
parents: 530
diff changeset
   932
2511c99de912 New code to trap restricted (RT) methods.
Stefan Vogel <sv@exept.de>
parents: 530
diff changeset
   933
    "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
   934
!
2511c99de912 New code to trap restricted (RT) methods.
Stefan Vogel <sv@exept.de>
parents: 530
diff changeset
   935
3216
e0f3f49118ed Simplify privacy stuff to make redirection from WrappedMethod easier.
Stefan Vogel <sv@exept.de>
parents: 3168
diff changeset
   936
setPrivacy:aSymbol
e0f3f49118ed Simplify privacy stuff to make redirection from WrappedMethod easier.
Stefan Vogel <sv@exept.de>
parents: 3168
diff changeset
   937
    "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
   938
     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
   939
     #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
   940
     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
   941
d600e08a5936 handle the case where a method has a sourceFileInfo, but the class has not
Claus Gittinger <cg@exept.de>
parents: 934
diff changeset
   942
     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
   943
     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
   944
     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
   945
     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
   946
     (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
   947
d600e08a5936 handle the case where a method has a sourceFileInfo, but the class has not
Claus Gittinger <cg@exept.de>
parents: 934
diff changeset
   948
     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
   949
     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
   950
d600e08a5936 handle the case where a method has a sourceFileInfo, but the class has not
Claus Gittinger <cg@exept.de>
parents: 934
diff changeset
   951
%{  /* NOCONTEXT */
3216
e0f3f49118ed Simplify privacy stuff to make redirection from WrappedMethod easier.
Stefan Vogel <sv@exept.de>
parents: 3168
diff changeset
   952
e0f3f49118ed Simplify privacy stuff to make redirection from WrappedMethod easier.
Stefan Vogel <sv@exept.de>
parents: 3168
diff changeset
   953
#if defined(M_PRIVACY)
2868
772c890f907c alpha64
Claus Gittinger <cg@exept.de>
parents: 2826
diff changeset
   954
    INT f = __intVal(__INST(flags));
3216
e0f3f49118ed Simplify privacy stuff to make redirection from WrappedMethod easier.
Stefan Vogel <sv@exept.de>
parents: 3168
diff changeset
   955
    INT p;
e0f3f49118ed Simplify privacy stuff to make redirection from WrappedMethod easier.
Stefan Vogel <sv@exept.de>
parents: 3168
diff changeset
   956
e0f3f49118ed Simplify privacy stuff to make redirection from WrappedMethod easier.
Stefan Vogel <sv@exept.de>
parents: 3168
diff changeset
   957
    if (aSymbol == @symbol(public))
5322
411b6c0f7250 renamed sone structures;
Claus Gittinger <cg@exept.de>
parents: 5294
diff changeset
   958
	p = 0;
3216
e0f3f49118ed Simplify privacy stuff to make redirection from WrappedMethod easier.
Stefan Vogel <sv@exept.de>
parents: 3168
diff changeset
   959
    else if (aSymbol == @symbol(private))
5322
411b6c0f7250 renamed sone structures;
Claus Gittinger <cg@exept.de>
parents: 5294
diff changeset
   960
	p = F_PRIVATE;
3216
e0f3f49118ed Simplify privacy stuff to make redirection from WrappedMethod easier.
Stefan Vogel <sv@exept.de>
parents: 3168
diff changeset
   961
    else if (aSymbol == @symbol(protected))
5322
411b6c0f7250 renamed sone structures;
Claus Gittinger <cg@exept.de>
parents: 5294
diff changeset
   962
	p = F_CLASSPRIVATE;
3216
e0f3f49118ed Simplify privacy stuff to make redirection from WrappedMethod easier.
Stefan Vogel <sv@exept.de>
parents: 3168
diff changeset
   963
    else if (aSymbol == @symbol(ignored))
5322
411b6c0f7250 renamed sone structures;
Claus Gittinger <cg@exept.de>
parents: 5294
diff changeset
   964
	p = F_IGNORED;
3216
e0f3f49118ed Simplify privacy stuff to make redirection from WrappedMethod easier.
Stefan Vogel <sv@exept.de>
parents: 3168
diff changeset
   965
    else
5322
411b6c0f7250 renamed sone structures;
Claus Gittinger <cg@exept.de>
parents: 5294
diff changeset
   966
	RETURN(false);  /* illegal symbol */
3216
e0f3f49118ed Simplify privacy stuff to make redirection from WrappedMethod easier.
Stefan Vogel <sv@exept.de>
parents: 3168
diff changeset
   967
        
e0f3f49118ed Simplify privacy stuff to make redirection from WrappedMethod easier.
Stefan Vogel <sv@exept.de>
parents: 3168
diff changeset
   968
e0f3f49118ed Simplify privacy stuff to make redirection from WrappedMethod easier.
Stefan Vogel <sv@exept.de>
parents: 3168
diff changeset
   969
    f = (f & ~M_PRIVACY) | p;
1133
961f2b095c22 underline cleanup
Claus Gittinger <cg@exept.de>
parents: 1103
diff changeset
   970
    __INST(flags) = __MKSMALLINT(f);
952
d600e08a5936 handle the case where a method has a sourceFileInfo, but the class has not
Claus Gittinger <cg@exept.de>
parents: 934
diff changeset
   971
#endif
3216
e0f3f49118ed Simplify privacy stuff to make redirection from WrappedMethod easier.
Stefan Vogel <sv@exept.de>
parents: 3168
diff changeset
   972
e0f3f49118ed Simplify privacy stuff to make redirection from WrappedMethod easier.
Stefan Vogel <sv@exept.de>
parents: 3168
diff changeset
   973
%}.
e0f3f49118ed Simplify privacy stuff to make redirection from WrappedMethod easier.
Stefan Vogel <sv@exept.de>
parents: 3168
diff changeset
   974
    ^ true
e0f3f49118ed Simplify privacy stuff to make redirection from WrappedMethod easier.
Stefan Vogel <sv@exept.de>
parents: 3168
diff changeset
   975
e0f3f49118ed Simplify privacy stuff to make redirection from WrappedMethod easier.
Stefan Vogel <sv@exept.de>
parents: 3168
diff changeset
   976
    "Modified: 27.8.1995 / 22:58:08 / claus"
1
a27a279701f8 Initial revision
claus
parents:
diff changeset
   977
! !
a27a279701f8 Initial revision
claus
parents:
diff changeset
   978
952
d600e08a5936 handle the case where a method has a sourceFileInfo, but the class has not
Claus Gittinger <cg@exept.de>
parents: 934
diff changeset
   979
!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
   980
d600e08a5936 handle the case where a method has a sourceFileInfo, but the class has not
Claus Gittinger <cg@exept.de>
parents: 934
diff changeset
   981
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
   982
    "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
   983
     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
   984
     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
   985
     the methodDictionary of any class - just returned.
2064
68b185fbddb6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 2063
diff changeset
   986
     If the method contains primitive code, this may return a method
68b185fbddb6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 2063
diff changeset
   987
     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
   988
     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
   989
     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
   990
     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
   991
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
    |doMachineCode mthd|
1
a27a279701f8 Initial revision
claus
parents:
diff changeset
   993
952
d600e08a5936 handle the case where a method has a sourceFileInfo, but the class has not
Claus Gittinger <cg@exept.de>
parents: 934
diff changeset
   994
    byteCode notNil ifTrue:[
3030
fc5d632d133f when compiling a lazy method, use the classes namespace
Claus Gittinger <cg@exept.de>
parents: 2979
diff changeset
   995
	"
fc5d632d133f when compiling a lazy method, use the classes namespace
Claus Gittinger <cg@exept.de>
parents: 2979
diff changeset
   996
	 is already a bytecoded method
fc5d632d133f when compiling a lazy method, use the classes namespace
Claus Gittinger <cg@exept.de>
parents: 2979
diff changeset
   997
	"
fc5d632d133f when compiling a lazy method, use the classes namespace
Claus Gittinger <cg@exept.de>
parents: 2979
diff changeset
   998
	^ 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
   999
    ].
d600e08a5936 handle the case where a method has a sourceFileInfo, but the class has not
Claus Gittinger <cg@exept.de>
parents: 934
diff changeset
  1000
    doMachineCode := Compiler stcCompilation:#never.
d600e08a5936 handle the case where a method has a sourceFileInfo, but the class has not
Claus Gittinger <cg@exept.de>
parents: 934
diff changeset
  1001
    [
3030
fc5d632d133f when compiling a lazy method, use the classes namespace
Claus Gittinger <cg@exept.de>
parents: 2979
diff changeset
  1002
	mthd := self asExecutableMethod.
952
d600e08a5936 handle the case where a method has a sourceFileInfo, but the class has not
Claus Gittinger <cg@exept.de>
parents: 934
diff changeset
  1003
    ] valueNowOrOnUnwindDo:[
3030
fc5d632d133f when compiling a lazy method, use the classes namespace
Claus Gittinger <cg@exept.de>
parents: 2979
diff changeset
  1004
	Compiler stcCompilation:doMachineCode.
952
d600e08a5936 handle the case where a method has a sourceFileInfo, but the class has not
Claus Gittinger <cg@exept.de>
parents: 934
diff changeset
  1005
    ].
d600e08a5936 handle the case where a method has a sourceFileInfo, but the class has not
Claus Gittinger <cg@exept.de>
parents: 934
diff changeset
  1006
    ^ mthd
68
59faa75185ba *** empty log message ***
claus
parents: 56
diff changeset
  1007
952
d600e08a5936 handle the case where a method has a sourceFileInfo, but the class has not
Claus Gittinger <cg@exept.de>
parents: 934
diff changeset
  1008
    "Created: 24.10.1995 / 14:02:32 / cg"
2064
68b185fbddb6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 2063
diff changeset
  1009
    "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
  1010
!
306
365e65400c93 *** empty log message ***
claus
parents: 302
diff changeset
  1011
5405
f07c8045ab4e *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5398
diff changeset
  1012
asByteCodeMethodWithSource:newSource
f07c8045ab4e *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5398
diff changeset
  1013
    |doMachineCode mthd|
f07c8045ab4e *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5398
diff changeset
  1014
f07c8045ab4e *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5398
diff changeset
  1015
    doMachineCode := Compiler stcCompilation:#never.
f07c8045ab4e *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5398
diff changeset
  1016
    [
5644
8d0d817060ec *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5636
diff changeset
  1017
	mthd := self asExecutableMethodWithSource:newSource.
5405
f07c8045ab4e *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5398
diff changeset
  1018
    ] valueNowOrOnUnwindDo:[
5644
8d0d817060ec *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5636
diff changeset
  1019
	Compiler stcCompilation:doMachineCode.
5405
f07c8045ab4e *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5398
diff changeset
  1020
    ].
f07c8045ab4e *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5398
diff changeset
  1021
    ^ mthd
f07c8045ab4e *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5398
diff changeset
  1022
f07c8045ab4e *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5398
diff changeset
  1023
    "Created: 24.10.1995 / 14:02:32 / cg"
f07c8045ab4e *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5398
diff changeset
  1024
    "Modified: 5.1.1997 / 01:01:53 / cg"
f07c8045ab4e *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5398
diff changeset
  1025
!
f07c8045ab4e *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5398
diff changeset
  1026
952
d600e08a5936 handle the case where a method has a sourceFileInfo, but the class has not
Claus Gittinger <cg@exept.de>
parents: 934
diff changeset
  1027
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
  1028
    "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
  1029
     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
  1030
     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
  1031
     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
  1032
     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
  1033
     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
  1034
     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
  1035
5700
ee59aff043c4 asExecutableMethod / asExecutableMethodWith: - code reuse
Claus Gittinger <cg@exept.de>
parents: 5696
diff changeset
  1036
    |temporaryMethod sourceString|
306
365e65400c93 *** empty log message ***
claus
parents: 302
diff changeset
  1037
952
d600e08a5936 handle the case where a method has a sourceFileInfo, but the class has not
Claus Gittinger <cg@exept.de>
parents: 934
diff changeset
  1038
    byteCode notNil ifTrue:[
5700
ee59aff043c4 asExecutableMethod / asExecutableMethodWith: - code reuse
Claus Gittinger <cg@exept.de>
parents: 5696
diff changeset
  1039
        "
ee59aff043c4 asExecutableMethod / asExecutableMethodWith: - code reuse
Claus Gittinger <cg@exept.de>
parents: 5696
diff changeset
  1040
         is already a bytecoded method
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
        ^ self
ee59aff043c4 asExecutableMethod / asExecutableMethodWith: - code reuse
Claus Gittinger <cg@exept.de>
parents: 5696
diff changeset
  1043
    ].
ee59aff043c4 asExecutableMethod / asExecutableMethodWith: - code reuse
Claus Gittinger <cg@exept.de>
parents: 5696
diff changeset
  1044
ee59aff043c4 asExecutableMethod / asExecutableMethodWith: - code reuse
Claus Gittinger <cg@exept.de>
parents: 5696
diff changeset
  1045
    sourceString := self source.
ee59aff043c4 asExecutableMethod / asExecutableMethodWith: - code reuse
Claus Gittinger <cg@exept.de>
parents: 5696
diff changeset
  1046
    sourceString isNil ifTrue:[
ee59aff043c4 asExecutableMethod / asExecutableMethodWith: - code reuse
Claus Gittinger <cg@exept.de>
parents: 5696
diff changeset
  1047
        'Method [warning]: cannot generate bytecode (no source for compilation)' errorPrintCR.
ee59aff043c4 asExecutableMethod / asExecutableMethodWith: - code reuse
Claus Gittinger <cg@exept.de>
parents: 5696
diff changeset
  1048
        ^ 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
  1049
    ].
d600e08a5936 handle the case where a method has a sourceFileInfo, but the class has not
Claus Gittinger <cg@exept.de>
parents: 934
diff changeset
  1050
5700
ee59aff043c4 asExecutableMethod / asExecutableMethodWith: - code reuse
Claus Gittinger <cg@exept.de>
parents: 5696
diff changeset
  1051
    temporaryMethod := self asExecutableMethodWithSource:sourceString.
ee59aff043c4 asExecutableMethod / asExecutableMethodWith: - code reuse
Claus Gittinger <cg@exept.de>
parents: 5696
diff changeset
  1052
ee59aff043c4 asExecutableMethod / asExecutableMethodWith: - code reuse
Claus Gittinger <cg@exept.de>
parents: 5696
diff changeset
  1053
    (temporaryMethod isNil or:[temporaryMethod == #Error]) ifTrue:[
ee59aff043c4 asExecutableMethod / asExecutableMethodWith: - code reuse
Claus Gittinger <cg@exept.de>
parents: 5696
diff changeset
  1054
        '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
  1055
        ^ nil.
ee59aff043c4 asExecutableMethod / asExecutableMethodWith: - code reuse
Claus Gittinger <cg@exept.de>
parents: 5696
diff changeset
  1056
    ].
ee59aff043c4 asExecutableMethod / asExecutableMethodWith: - code reuse
Claus Gittinger <cg@exept.de>
parents: 5696
diff changeset
  1057
    "/
ee59aff043c4 asExecutableMethod / asExecutableMethodWith: - code reuse
Claus Gittinger <cg@exept.de>
parents: 5696
diff changeset
  1058
    "/ 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
  1059
    "/
ee59aff043c4 asExecutableMethod / asExecutableMethodWith: - code reuse
Claus Gittinger <cg@exept.de>
parents: 5696
diff changeset
  1060
    temporaryMethod sourceFilename:source position:sourcePosition. 
ee59aff043c4 asExecutableMethod / asExecutableMethodWith: - code reuse
Claus Gittinger <cg@exept.de>
parents: 5696
diff changeset
  1061
    ^ temporaryMethod
ee59aff043c4 asExecutableMethod / asExecutableMethodWith: - code reuse
Claus Gittinger <cg@exept.de>
parents: 5696
diff changeset
  1062
!
ee59aff043c4 asExecutableMethod / asExecutableMethodWith: - code reuse
Claus Gittinger <cg@exept.de>
parents: 5696
diff changeset
  1063
ee59aff043c4 asExecutableMethod / asExecutableMethodWith: - code reuse
Claus Gittinger <cg@exept.de>
parents: 5696
diff changeset
  1064
asExecutableMethodWithSource:newSource
ee59aff043c4 asExecutableMethod / asExecutableMethodWith: - code reuse
Claus Gittinger <cg@exept.de>
parents: 5696
diff changeset
  1065
    |temporaryMethod cls|
ee59aff043c4 asExecutableMethod / asExecutableMethodWith: - code reuse
Claus Gittinger <cg@exept.de>
parents: 5696
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
    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
  1068
    cls isNil ifTrue:[
5700
ee59aff043c4 asExecutableMethod / asExecutableMethodWith: - code reuse
Claus Gittinger <cg@exept.de>
parents: 5696
diff changeset
  1069
        'Method [warning]: cannot generate bytecode (no class for compilation)' errorPrintCR.
ee59aff043c4 asExecutableMethod / asExecutableMethodWith: - code reuse
Claus Gittinger <cg@exept.de>
parents: 5696
diff changeset
  1070
        ^ nil
306
365e65400c93 *** empty log message ***
claus
parents: 302
diff changeset
  1071
    ].
1
a27a279701f8 Initial revision
claus
parents:
diff changeset
  1072
4290
5e43473d7a35 moved recompilation semaphore from LazyMethod to Method
Claus Gittinger <cg@exept.de>
parents: 4015
diff changeset
  1073
    "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
  1074
     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
  1075
     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
  1076
     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
  1077
     (happened when autoloading animation demos)
176
48061f8659aa more queries
claus
parents: 159
diff changeset
  1078
    "
4290
5e43473d7a35 moved recompilation semaphore from LazyMethod to Method
Claus Gittinger <cg@exept.de>
parents: 4015
diff changeset
  1079
    CompilationLock critical:[
5700
ee59aff043c4 asExecutableMethod / asExecutableMethodWith: - code reuse
Claus Gittinger <cg@exept.de>
parents: 5696
diff changeset
  1080
        "
ee59aff043c4 asExecutableMethod / asExecutableMethodWith: - code reuse
Claus Gittinger <cg@exept.de>
parents: 5696
diff changeset
  1081
         dont want this to go into the changes file,
ee59aff043c4 asExecutableMethod / asExecutableMethodWith: - code reuse
Claus Gittinger <cg@exept.de>
parents: 5696
diff changeset
  1082
         dont want output on Transcript and definitely 
ee59aff043c4 asExecutableMethod / asExecutableMethodWith: - code reuse
Claus Gittinger <cg@exept.de>
parents: 5696
diff changeset
  1083
         dont want a lazy method ...
ee59aff043c4 asExecutableMethod / asExecutableMethodWith: - code reuse
Claus Gittinger <cg@exept.de>
parents: 5696
diff changeset
  1084
        "
ee59aff043c4 asExecutableMethod / asExecutableMethodWith: - code reuse
Claus Gittinger <cg@exept.de>
parents: 5696
diff changeset
  1085
        Class withoutUpdatingChangesDo:[
ee59aff043c4 asExecutableMethod / asExecutableMethodWith: - code reuse
Claus Gittinger <cg@exept.de>
parents: 5696
diff changeset
  1086
            |silent lazy|
ee59aff043c4 asExecutableMethod / asExecutableMethodWith: - code reuse
Claus Gittinger <cg@exept.de>
parents: 5696
diff changeset
  1087
ee59aff043c4 asExecutableMethod / asExecutableMethodWith: - code reuse
Claus Gittinger <cg@exept.de>
parents: 5696
diff changeset
  1088
            silent := Smalltalk silentLoading:true.
ee59aff043c4 asExecutableMethod / asExecutableMethodWith: - code reuse
Claus Gittinger <cg@exept.de>
parents: 5696
diff changeset
  1089
            lazy := Compiler compileLazy:false.
ee59aff043c4 asExecutableMethod / asExecutableMethodWith: - code reuse
Claus Gittinger <cg@exept.de>
parents: 5696
diff changeset
  1090
ee59aff043c4 asExecutableMethod / asExecutableMethodWith: - code reuse
Claus Gittinger <cg@exept.de>
parents: 5696
diff changeset
  1091
            [
ee59aff043c4 asExecutableMethod / asExecutableMethodWith: - code reuse
Claus Gittinger <cg@exept.de>
parents: 5696
diff changeset
  1092
                |compiler|
ee59aff043c4 asExecutableMethod / asExecutableMethodWith: - code reuse
Claus Gittinger <cg@exept.de>
parents: 5696
diff changeset
  1093
ee59aff043c4 asExecutableMethod / asExecutableMethodWith: - code reuse
Claus Gittinger <cg@exept.de>
parents: 5696
diff changeset
  1094
                Class nameSpaceQuerySignal answer:(cls nameSpace)
ee59aff043c4 asExecutableMethod / asExecutableMethodWith: - code reuse
Claus Gittinger <cg@exept.de>
parents: 5696
diff changeset
  1095
                do:[
ee59aff043c4 asExecutableMethod / asExecutableMethodWith: - code reuse
Claus Gittinger <cg@exept.de>
parents: 5696
diff changeset
  1096
                    compiler := cls compilerClass.
ee59aff043c4 asExecutableMethod / asExecutableMethodWith: - code reuse
Claus Gittinger <cg@exept.de>
parents: 5696
diff changeset
  1097
ee59aff043c4 asExecutableMethod / asExecutableMethodWith: - code reuse
Claus Gittinger <cg@exept.de>
parents: 5696
diff changeset
  1098
                    "/
ee59aff043c4 asExecutableMethod / asExecutableMethodWith: - code reuse
Claus Gittinger <cg@exept.de>
parents: 5696
diff changeset
  1099
                    "/ kludge - have to make ST/X's compiler protocol
ee59aff043c4 asExecutableMethod / asExecutableMethodWith: - code reuse
Claus Gittinger <cg@exept.de>
parents: 5696
diff changeset
  1100
                    "/ be compatible to ST-80's
ee59aff043c4 asExecutableMethod / asExecutableMethodWith: - code reuse
Claus Gittinger <cg@exept.de>
parents: 5696
diff changeset
  1101
                    "/
ee59aff043c4 asExecutableMethod / asExecutableMethodWith: - code reuse
Claus Gittinger <cg@exept.de>
parents: 5696
diff changeset
  1102
                    (compiler respondsTo:#compile:forClass:inCategory:notifying:install:)
ee59aff043c4 asExecutableMethod / asExecutableMethodWith: - code reuse
Claus Gittinger <cg@exept.de>
parents: 5696
diff changeset
  1103
                    ifTrue:[
ee59aff043c4 asExecutableMethod / asExecutableMethodWith: - code reuse
Claus Gittinger <cg@exept.de>
parents: 5696
diff changeset
  1104
                        temporaryMethod := compiler
ee59aff043c4 asExecutableMethod / asExecutableMethodWith: - code reuse
Claus Gittinger <cg@exept.de>
parents: 5696
diff changeset
  1105
                                             compile:newSource
ee59aff043c4 asExecutableMethod / asExecutableMethodWith: - code reuse
Claus Gittinger <cg@exept.de>
parents: 5696
diff changeset
  1106
                                             forClass:cls
ee59aff043c4 asExecutableMethod / asExecutableMethodWith: - code reuse
Claus Gittinger <cg@exept.de>
parents: 5696
diff changeset
  1107
                                             inCategory:(self category)
ee59aff043c4 asExecutableMethod / asExecutableMethodWith: - code reuse
Claus Gittinger <cg@exept.de>
parents: 5696
diff changeset
  1108
                                             notifying:nil
ee59aff043c4 asExecutableMethod / asExecutableMethodWith: - code reuse
Claus Gittinger <cg@exept.de>
parents: 5696
diff changeset
  1109
                                             install:false.
ee59aff043c4 asExecutableMethod / asExecutableMethodWith: - code reuse
Claus Gittinger <cg@exept.de>
parents: 5696
diff changeset
  1110
                    ] ifFalse:[
ee59aff043c4 asExecutableMethod / asExecutableMethodWith: - code reuse
Claus Gittinger <cg@exept.de>
parents: 5696
diff changeset
  1111
                        temporaryMethod := compiler new
ee59aff043c4 asExecutableMethod / asExecutableMethodWith: - code reuse
Claus Gittinger <cg@exept.de>
parents: 5696
diff changeset
  1112
                                             compile:newSource 
ee59aff043c4 asExecutableMethod / asExecutableMethodWith: - code reuse
Claus Gittinger <cg@exept.de>
parents: 5696
diff changeset
  1113
                                             in:cls 
ee59aff043c4 asExecutableMethod / asExecutableMethodWith: - code reuse
Claus Gittinger <cg@exept.de>
parents: 5696
diff changeset
  1114
                                             notifying:nil 
ee59aff043c4 asExecutableMethod / asExecutableMethodWith: - code reuse
Claus Gittinger <cg@exept.de>
parents: 5696
diff changeset
  1115
                                             ifFail:nil
ee59aff043c4 asExecutableMethod / asExecutableMethodWith: - code reuse
Claus Gittinger <cg@exept.de>
parents: 5696
diff changeset
  1116
                    ].
ee59aff043c4 asExecutableMethod / asExecutableMethodWith: - code reuse
Claus Gittinger <cg@exept.de>
parents: 5696
diff changeset
  1117
                ].
ee59aff043c4 asExecutableMethod / asExecutableMethodWith: - code reuse
Claus Gittinger <cg@exept.de>
parents: 5696
diff changeset
  1118
            ] valueNowOrOnUnwindDo:[
ee59aff043c4 asExecutableMethod / asExecutableMethodWith: - code reuse
Claus Gittinger <cg@exept.de>
parents: 5696
diff changeset
  1119
                Compiler compileLazy:lazy.
ee59aff043c4 asExecutableMethod / asExecutableMethodWith: - code reuse
Claus Gittinger <cg@exept.de>
parents: 5696
diff changeset
  1120
                Smalltalk silentLoading:silent.
ee59aff043c4 asExecutableMethod / asExecutableMethodWith: - code reuse
Claus Gittinger <cg@exept.de>
parents: 5696
diff changeset
  1121
            ]
ee59aff043c4 asExecutableMethod / asExecutableMethodWith: - code reuse
Claus Gittinger <cg@exept.de>
parents: 5696
diff changeset
  1122
        ].
463
447ead9f870c be silent on transcript when parsing for args, vars and primitiveCode
Claus Gittinger <cg@exept.de>
parents: 444
diff changeset
  1123
    ].
952
d600e08a5936 handle the case where a method has a sourceFileInfo, but the class has not
Claus Gittinger <cg@exept.de>
parents: 934
diff changeset
  1124
    (temporaryMethod isNil or:[temporaryMethod == #Error]) ifTrue:[
5700
ee59aff043c4 asExecutableMethod / asExecutableMethodWith: - code reuse
Claus Gittinger <cg@exept.de>
parents: 5696
diff changeset
  1125
        '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
  1126
        ^ nil.
5405
f07c8045ab4e *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5398
diff changeset
  1127
    ].
f07c8045ab4e *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5398
diff changeset
  1128
    "/
f07c8045ab4e *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5398
diff changeset
  1129
    "/ 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
  1130
    "/
f07c8045ab4e *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5398
diff changeset
  1131
    temporaryMethod source:newSource. 
f07c8045ab4e *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5398
diff changeset
  1132
    "/
f07c8045ab4e *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5398
diff changeset
  1133
    "/ dont forget the methods class & package ...
f07c8045ab4e *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5398
diff changeset
  1134
    "/
f07c8045ab4e *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5398
diff changeset
  1135
    temporaryMethod setPackage:package.
f07c8045ab4e *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5398
diff changeset
  1136
    temporaryMethod mclass:mclass.
f07c8045ab4e *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5398
diff changeset
  1137
    ^ temporaryMethod
f07c8045ab4e *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5398
diff changeset
  1138
!
f07c8045ab4e *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5398
diff changeset
  1139
952
d600e08a5936 handle the case where a method has a sourceFileInfo, but the class has not
Claus Gittinger <cg@exept.de>
parents: 934
diff changeset
  1140
readBinaryContentsFrom: stream manager: manager
3934
a8c6075f9988 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 3845
diff changeset
  1141
    self hasCode ifTrue:[
5322
411b6c0f7250 renamed sone structures;
Claus Gittinger <cg@exept.de>
parents: 5294
diff changeset
  1142
	"built-in method - already complete"
411b6c0f7250 renamed sone structures;
Claus Gittinger <cg@exept.de>
parents: 5294
diff changeset
  1143
	^ self
1
a27a279701f8 Initial revision
claus
parents:
diff changeset
  1144
    ].
a27a279701f8 Initial revision
claus
parents:
diff changeset
  1145
952
d600e08a5936 handle the case where a method has a sourceFileInfo, but the class has not
Claus Gittinger <cg@exept.de>
parents: 934
diff changeset
  1146
    ^ super readBinaryContentsFrom: stream manager: manager
2064
68b185fbddb6 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 2063
diff changeset
  1147
3934
a8c6075f9988 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 3845
diff changeset
  1148
    "Modified: / 13.11.1998 / 23:21:26 / cg"
1
a27a279701f8 Initial revision
claus
parents:
diff changeset
  1149
!
a27a279701f8 Initial revision
claus
parents:
diff changeset
  1150
952
d600e08a5936 handle the case where a method has a sourceFileInfo, but the class has not
Claus Gittinger <cg@exept.de>
parents: 934
diff changeset
  1151
storeBinaryDefinitionOn:stream manager:manager
1260
2a8ba44e8957 commentary
Claus Gittinger <cg@exept.de>
parents: 1258
diff changeset
  1152
    "store the receiver in a binary format on stream.
2a8ba44e8957 commentary
Claus Gittinger <cg@exept.de>
parents: 1258
diff changeset
  1153
     This is an internal interface for binary storage mechanism.
2a8ba44e8957 commentary
Claus Gittinger <cg@exept.de>
parents: 1258
diff changeset
  1154
     only store bytecode-methods - machinecode methods are stored
952
d600e08a5936 handle the case where a method has a sourceFileInfo, but the class has not
Claus Gittinger <cg@exept.de>
parents: 934
diff changeset
  1155
     as class/selector pair and a lookup is done when restored.
1
a27a279701f8 Initial revision
claus
parents:
diff changeset
  1156
952
d600e08a5936 handle the case where a method has a sourceFileInfo, but the class has not
Claus Gittinger <cg@exept.de>
parents: 934
diff changeset
  1157
     If the receiver method is a built-in (i.e. machine coded)
d600e08a5936 handle the case where a method has a sourceFileInfo, but the class has not
Claus Gittinger <cg@exept.de>
parents: 934
diff changeset
  1158
     method, a temporary interpreted byte code method is created,
d600e08a5936 handle the case where a method has a sourceFileInfo, but the class has not
Claus Gittinger <cg@exept.de>
parents: 934
diff changeset
  1159
     and its bytecode stored. 
d600e08a5936 handle the case where a method has a sourceFileInfo, but the class has not
Claus Gittinger <cg@exept.de>
parents: 934
diff changeset
  1160
     This works only, if the source of the method is available and the
d600e08a5936 handle the case where a method has a sourceFileInfo, but the class has not
Claus Gittinger <cg@exept.de>
parents: 934
diff changeset
  1161
     method does not contain primitive code."
77
6c38ca59927f *** empty log message ***
claus
parents: 68
diff changeset
  1162
952
d600e08a5936 handle the case where a method has a sourceFileInfo, but the class has not
Claus Gittinger <cg@exept.de>
parents: 934
diff changeset
  1163
    |storedMethod who|
93
e31220cb391f *** empty log message ***
claus
parents: 88
diff changeset
  1164
952
d600e08a5936 handle the case where a method has a sourceFileInfo, but the class has not
Claus Gittinger <cg@exept.de>
parents: 934
diff changeset
  1165
    byteCode isNil ifTrue:[
5322
411b6c0f7250 renamed sone structures;
Claus Gittinger <cg@exept.de>
parents: 5294
diff changeset
  1166
	self hasCode ifTrue:[
411b6c0f7250 renamed sone structures;
Claus Gittinger <cg@exept.de>
parents: 5294
diff changeset
  1167
	    (who := self who) notNil ifTrue:[
411b6c0f7250 renamed sone structures;
Claus Gittinger <cg@exept.de>
parents: 5294
diff changeset
  1168
		"
411b6c0f7250 renamed sone structures;
Claus Gittinger <cg@exept.de>
parents: 5294
diff changeset
  1169
		 machine code only - assume its a built-in method,
411b6c0f7250 renamed sone structures;
Claus Gittinger <cg@exept.de>
parents: 5294
diff changeset
  1170
		 and store the class/selector information.
411b6c0f7250 renamed sone structures;
Claus Gittinger <cg@exept.de>
parents: 5294
diff changeset
  1171
		 The restored method may not be exactly the same ...
411b6c0f7250 renamed sone structures;
Claus Gittinger <cg@exept.de>
parents: 5294
diff changeset
  1172
		"
411b6c0f7250 renamed sone structures;
Claus Gittinger <cg@exept.de>
parents: 5294
diff changeset
  1173
		manager putIdOfClass:(self class) on:stream.
411b6c0f7250 renamed sone structures;
Claus Gittinger <cg@exept.de>
parents: 5294
diff changeset
  1174
		stream nextPutByte:0.   "means: built-in method" 
411b6c0f7250 renamed sone structures;
Claus Gittinger <cg@exept.de>
parents: 5294
diff changeset
  1175
		manager putIdOf:(who methodClass) on:stream.
411b6c0f7250 renamed sone structures;
Claus Gittinger <cg@exept.de>
parents: 5294
diff changeset
  1176
		manager putIdOf:(who methodSelector) on:stream.
411b6c0f7250 renamed sone structures;
Claus Gittinger <cg@exept.de>
parents: 5294
diff changeset
  1177
		^ self
411b6c0f7250 renamed sone structures;
Claus Gittinger <cg@exept.de>
parents: 5294
diff changeset
  1178
	    ]
411b6c0f7250 renamed sone structures;
Claus Gittinger <cg@exept.de>
parents: 5294
diff changeset
  1179
	].
411b6c0f7250 renamed sone structures;
Claus Gittinger <cg@exept.de>
parents: 5294
diff changeset
  1180
411b6c0f7250 renamed sone structures;
Claus Gittinger <cg@exept.de>
parents: 5294
diff changeset
  1181
	storedMethod := self asByteCodeMethod.
411b6c0f7250 renamed sone structures;
Claus Gittinger <cg@exept.de>
parents: 5294
diff changeset
  1182
	storedMethod isNil ifTrue:[
411b6c0f7250 renamed sone structures;
Claus Gittinger <cg@exept.de>
parents: 5294
diff changeset
  1183
	    self error:'store of built-in method failed'.
411b6c0f7250 renamed sone structures;
Claus Gittinger <cg@exept.de>
parents: 5294
diff changeset
  1184
	].
411b6c0f7250 renamed sone structures;
Claus Gittinger <cg@exept.de>
parents: 5294
diff changeset
  1185
	^ storedMethod storeBinaryDefinitionOn:stream manager:manager
952
d600e08a5936 handle the case where a method has a sourceFileInfo, but the class has not
Claus Gittinger <cg@exept.de>
parents: 934
diff changeset
  1186
    ].
93
e31220cb391f *** empty log message ***
claus
parents: 88
diff changeset
  1187
952
d600e08a5936 handle the case where a method has a sourceFileInfo, but the class has not
Claus Gittinger <cg@exept.de>
parents: 934
diff changeset
  1188
    manager putIdOfClass:(self class) on:stream.
d600e08a5936 handle the case where a method has a sourceFileInfo, but the class has not
Claus Gittinger <cg@exept.de>
parents: 934
diff changeset
  1189
    stream nextPutByte:1.       "means: byte-coded 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
  1190
    self storeBinaryDefinitionBodyOn:stream manager:manager
1260
2a8ba44e8957 commentary
Claus Gittinger <cg@exept.de>
parents: 1258
diff changeset
  1191
3934
a8c6075f9988 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 3845
diff changeset
  1192
    "Modified: / 13.11.1998 / 23:21:42 / cg"
227
23b1c4de3402 package & cleanup
claus
parents: 216
diff changeset
  1193
!
23b1c4de3402 package & cleanup
claus
parents: 216
diff changeset
  1194
952
d600e08a5936 handle the case where a method has a sourceFileInfo, but the class has not
Claus Gittinger <cg@exept.de>
parents: 934
diff changeset
  1195
storeFullBinaryDefinitionOn:stream manager:manager
d600e08a5936 handle the case where a method has a sourceFileInfo, but the class has not
Claus Gittinger <cg@exept.de>
parents: 934
diff changeset
  1196
    "store full bytecoded-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
  1197
d600e08a5936 handle the case where a method has a sourceFileInfo, but the class has not
Claus Gittinger <cg@exept.de>
parents: 934
diff changeset
  1198
    |m code srcPos|
93
e31220cb391f *** empty log message ***
claus
parents: 88
diff changeset
  1199
2063
1b5c3afb5122 fixed storeBinaryFullDescription
Claus Gittinger <cg@exept.de>
parents: 2023
diff changeset
  1200
    "/ need a byteCode version of myself ...
1b5c3afb5122 fixed storeBinaryFullDescription
Claus Gittinger <cg@exept.de>
parents: 2023
diff changeset
  1201
    m := self.
1b5c3afb5122 fixed storeBinaryFullDescription
Claus Gittinger <cg@exept.de>
parents: 2023
diff changeset
  1202
    code := byteCode.
1b5c3afb5122 fixed storeBinaryFullDescription
Claus Gittinger <cg@exept.de>
parents: 2023
diff changeset
  1203
    code isNil ifTrue:[
3030
fc5d632d133f when compiling a lazy method, use the classes namespace
Claus Gittinger <cg@exept.de>
parents: 2979
diff changeset
  1204
	m := self asByteCodeMethod.
fc5d632d133f when compiling a lazy method, use the classes namespace
Claus Gittinger <cg@exept.de>
parents: 2979
diff changeset
  1205
	code := m byteCode.
fc5d632d133f when compiling a lazy method, use the classes namespace
Claus Gittinger <cg@exept.de>
parents: 2979
diff changeset
  1206
	code isNil ifTrue:[
fc5d632d133f when compiling a lazy method, use the classes namespace
Claus Gittinger <cg@exept.de>
parents: 2979
diff changeset
  1207
	    m := self
fc5d632d133f when compiling a lazy method, use the classes namespace
Claus Gittinger <cg@exept.de>
parents: 2979
diff changeset
  1208
	]
2063
1b5c3afb5122 fixed storeBinaryFullDescription
Claus Gittinger <cg@exept.de>
parents: 2023
diff changeset
  1209
    ].
1b5c3afb5122 fixed storeBinaryFullDescription
Claus Gittinger <cg@exept.de>
parents: 2023
diff changeset
  1210
952
d600e08a5936 handle the case where a method has a sourceFileInfo, but the class has not
Claus Gittinger <cg@exept.de>
parents: 934
diff changeset
  1211
    ObjectMemory snapshotID storeBinaryOn:stream manager:manager.
d600e08a5936 handle the case where a method has a sourceFileInfo, but the class has not
Claus Gittinger <cg@exept.de>
parents: 934
diff changeset
  1212
    category storeBinaryOn:stream manager:manager.
362
claus
parents: 360
diff changeset
  1213
952
d600e08a5936 handle the case where a method has a sourceFileInfo, but the class has not
Claus Gittinger <cg@exept.de>
parents: 934
diff changeset
  1214
    m flags storeBinaryOn:stream manager:manager.
d600e08a5936 handle the case where a method has a sourceFileInfo, but the class has not
Claus Gittinger <cg@exept.de>
parents: 934
diff changeset
  1215
    m literals storeBinaryOn:stream manager:manager.
d600e08a5936 handle the case where a method has a sourceFileInfo, but the class has not
Claus Gittinger <cg@exept.de>
parents: 934
diff changeset
  1216
    manager sourceMode == #discard ifTrue:[
3030
fc5d632d133f when compiling a lazy method, use the classes namespace
Claus Gittinger <cg@exept.de>
parents: 2979
diff changeset
  1217
	"/ add nil, nil, nil
fc5d632d133f when compiling a lazy method, use the classes namespace
Claus Gittinger <cg@exept.de>
parents: 2979
diff changeset
  1218
	nil storeBinaryOn:stream manager:manager. "/ sourceFileName
fc5d632d133f when compiling a lazy method, use the classes namespace
Claus Gittinger <cg@exept.de>
parents: 2979
diff changeset
  1219
	nil storeBinaryOn:stream manager:manager. "/ sourcePosition
fc5d632d133f when compiling a lazy method, use the classes namespace
Claus Gittinger <cg@exept.de>
parents: 2979
diff changeset
  1220
	nil storeBinaryOn:stream manager:manager. "/ 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
  1221
    ] ifFalse:[
3030
fc5d632d133f when compiling a lazy method, use the classes namespace
Claus Gittinger <cg@exept.de>
parents: 2979
diff changeset
  1222
	"/ add sourceFilename, srcPos
fc5d632d133f when compiling a lazy method, use the classes namespace
Claus Gittinger <cg@exept.de>
parents: 2979
diff changeset
  1223
	"/ or  nil, nil, source
fc5d632d133f when compiling a lazy method, use the classes namespace
Claus Gittinger <cg@exept.de>
parents: 2979
diff changeset
  1224
	m sourceFilename storeBinaryOn:stream manager:manager.
fc5d632d133f when compiling a lazy method, use the classes namespace
Claus Gittinger <cg@exept.de>
parents: 2979
diff changeset
  1225
	manager sourceMode == #reference ifTrue:[
fc5d632d133f when compiling a lazy method, use the classes namespace
Claus Gittinger <cg@exept.de>
parents: 2979
diff changeset
  1226
	    srcPos := m sourcePosition.
fc5d632d133f when compiling a lazy method, use the classes namespace
Claus Gittinger <cg@exept.de>
parents: 2979
diff changeset
  1227
	] ifFalse:[
fc5d632d133f when compiling a lazy method, use the classes namespace
Claus Gittinger <cg@exept.de>
parents: 2979
diff changeset
  1228
	    srcPos := nil
fc5d632d133f when compiling a lazy method, use the classes namespace
Claus Gittinger <cg@exept.de>
parents: 2979
diff changeset
  1229
	].
fc5d632d133f when compiling a lazy method, use the classes namespace
Claus Gittinger <cg@exept.de>
parents: 2979
diff changeset
  1230
	srcPos storeBinaryOn:stream manager:manager.
fc5d632d133f when compiling a lazy method, use the classes namespace
Claus Gittinger <cg@exept.de>
parents: 2979
diff changeset
  1231
	srcPos isNil ifTrue:[
fc5d632d133f when compiling a lazy method, use the classes namespace
Claus Gittinger <cg@exept.de>
parents: 2979
diff changeset
  1232
	    m source storeBinaryOn:stream manager:manager.
fc5d632d133f when compiling a lazy method, use the classes namespace
Claus Gittinger <cg@exept.de>
parents: 2979
diff changeset
  1233
	].
391
claus
parents: 384
diff changeset
  1234
    ].
2063
1b5c3afb5122 fixed storeBinaryFullDescription
Claus Gittinger <cg@exept.de>
parents: 2023
diff changeset
  1235
952
d600e08a5936 handle the case where a method has a sourceFileInfo, but the class has not
Claus Gittinger <cg@exept.de>
parents: 934
diff changeset
  1236
    code storeBinaryOn:stream manager:manager.
d600e08a5936 handle the case where a method has a sourceFileInfo, but the class has not
Claus Gittinger <cg@exept.de>
parents: 934
diff changeset
  1237
d600e08a5936 handle the case where a method has a sourceFileInfo, but the class has not
Claus Gittinger <cg@exept.de>
parents: 934
diff changeset
  1238
    "Created: 16.1.1996 / 14:41:45 / cg"
2063
1b5c3afb5122 fixed storeBinaryFullDescription
Claus Gittinger <cg@exept.de>
parents: 2023
diff changeset
  1239
    "Modified: 5.1.1997 / 00:39:29 / cg"
1
a27a279701f8 Initial revision
claus
parents:
diff changeset
  1240
! !
a27a279701f8 Initial revision
claus
parents:
diff changeset
  1241
952
d600e08a5936 handle the case where a method has a sourceFileInfo, but the class has not
Claus Gittinger <cg@exept.de>
parents: 934
diff changeset
  1242
!Method methodsFor:'copying'!
438
claus
parents: 423
diff changeset
  1243
952
d600e08a5936 handle the case where a method has a sourceFileInfo, but the class has not
Claus Gittinger <cg@exept.de>
parents: 934
diff changeset
  1244
copy
2176
1a24b0cef25a when compressing sources, make certain to avoid later
Claus Gittinger <cg@exept.de>
parents: 2171
diff changeset
  1245
    "redefined to change a source ref into a real string"
438
claus
parents: 423
diff changeset
  1246
952
d600e08a5936 handle the case where a method has a sourceFileInfo, but the class has not
Claus Gittinger <cg@exept.de>
parents: 934
diff changeset
  1247
    |aCopy|
438
claus
parents: 423
diff changeset
  1248
952
d600e08a5936 handle the case where a method has a sourceFileInfo, but the class has not
Claus Gittinger <cg@exept.de>
parents: 934
diff changeset
  1249
    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
  1250
    sourcePosition notNil ifTrue:[
5676
db728e9fe276 must flush cached mclass, when copying methods around
src
parents: 5665
diff changeset
  1251
        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
  1252
    ].
5676
db728e9fe276 must flush cached mclass, when copying methods around
src
parents: 5665
diff changeset
  1253
    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
  1254
    ^ aCopy
2176
1a24b0cef25a when compressing sources, make certain to avoid later
Claus Gittinger <cg@exept.de>
parents: 2171
diff changeset
  1255
5696
958a0643496d compatibility
Claus Gittinger <cg@exept.de>
parents: 5676
diff changeset
  1256
    "Modified: 16.1.1997 / 01:27:25 / cg"
958a0643496d compatibility
Claus Gittinger <cg@exept.de>
parents: 5676
diff changeset
  1257
! !
438
claus
parents: 423
diff changeset
  1258
1
a27a279701f8 Initial revision
claus
parents:
diff changeset
  1259
!Method methodsFor:'error handling'!
a27a279701f8 Initial revision
claus
parents:
diff changeset
  1260
328
claus
parents: 326
diff changeset
  1261
invalidCodeObject
1873
3544a4a94a2a checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1870
diff changeset
  1262
    "{ Pragma: +optSpace }"
3544a4a94a2a checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1870
diff changeset
  1263
93
e31220cb391f *** empty log message ***
claus
parents: 88
diff changeset
  1264
    "this method is triggered by the interpreter when a nil or non method
e31220cb391f *** empty log message ***
claus
parents: 88
diff changeset
  1265
     is about to be executed.
e31220cb391f *** empty log message ***
claus
parents: 88
diff changeset
  1266
     In this case, the VM sends this to the bad method (the receiver).
e31220cb391f *** empty log message ***
claus
parents: 88
diff changeset
  1267
e31220cb391f *** empty log message ***
claus
parents: 88
diff changeset
  1268
     Also, the Compiler creates methods with their code/bytecode set to
e31220cb391f *** empty log message ***
claus
parents: 88
diff changeset
  1269
     this method if - after a class change - a method cannot be compiled
e31220cb391f *** empty log message ***
claus
parents: 88
diff changeset
  1270
     and is therefore no longer executable (for example, after an instvar
68
59faa75185ba *** empty log message ***
claus
parents: 56
diff changeset
  1271
     has been removed, and a method still tries to access this instvar)
44
b262907c93ea *** empty log message ***
claus
parents: 42
diff changeset
  1272
93
e31220cb391f *** empty log message ***
claus
parents: 88
diff changeset
  1273
     Thus, we arrive here, when playing around in a classes methodArray,
e31220cb391f *** empty log message ***
claus
parents: 88
diff changeset
  1274
     or compiler/runtime system is broken :-(, 
e31220cb391f *** empty log message ***
claus
parents: 88
diff changeset
  1275
     or you ignore the error messages during some recompile."
1
a27a279701f8 Initial revision
claus
parents:
diff changeset
  1276
1873
3544a4a94a2a checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1870
diff changeset
  1277
%{
3544a4a94a2a checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1870
diff changeset
  1278
    /*
3544a4a94a2a checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1870
diff changeset
  1279
     * for reasons too far from being explained here,
3544a4a94a2a checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1870
diff changeset
  1280
     * this MUST be a compiled method
3544a4a94a2a checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1870
diff changeset
  1281
     */
3544a4a94a2a checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1870
diff changeset
  1282
%}.
142
c7844287bddf *** empty log message ***
claus
parents: 109
diff changeset
  1283
    ^ InvalidCodeSignal
3030
fc5d632d133f when compiling a lazy method, use the classes namespace
Claus Gittinger <cg@exept.de>
parents: 2979
diff changeset
  1284
	raiseErrorString:'invalid method - not executable'.
1873
3544a4a94a2a checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1870
diff changeset
  1285
3544a4a94a2a checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1870
diff changeset
  1286
    "Modified: 4.11.1996 / 22:45:06 / cg"
1
a27a279701f8 Initial revision
claus
parents:
diff changeset
  1287
!
a27a279701f8 Initial revision
claus
parents:
diff changeset
  1288
1870
2623b60c27e1 lifted numVars; added access for invalidCodeObject-trappers
Claus Gittinger <cg@exept.de>
parents: 1855
diff changeset
  1289
invalidCodeObjectWith:arg
1873
3544a4a94a2a checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1870
diff changeset
  1290
    "{ Pragma: +optSpace }"
3544a4a94a2a checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1870
diff changeset
  1291
1870
2623b60c27e1 lifted numVars; added access for invalidCodeObject-trappers
Claus Gittinger <cg@exept.de>
parents: 1855
diff changeset
  1292
    "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
  1293
     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
  1294
     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
  1295
1873
3544a4a94a2a checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1870
diff changeset
  1296
%{
3544a4a94a2a checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1870
diff changeset
  1297
    /*
3544a4a94a2a checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1870
diff changeset
  1298
     * for reasons too far from being explained here,
3544a4a94a2a checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1870
diff changeset
  1299
     * this MUST be a compiled method
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
%}.
1870
2623b60c27e1 lifted numVars; added access for invalidCodeObject-trappers
Claus Gittinger <cg@exept.de>
parents: 1855
diff changeset
  1302
    ^ InvalidCodeSignal
3030
fc5d632d133f when compiling a lazy method, use the classes namespace
Claus Gittinger <cg@exept.de>
parents: 2979
diff changeset
  1303
	raiseErrorString:'invalid method - not executable'.
1870
2623b60c27e1 lifted numVars; added access for invalidCodeObject-trappers
Claus Gittinger <cg@exept.de>
parents: 1855
diff changeset
  1304
2623b60c27e1 lifted numVars; added access for invalidCodeObject-trappers
Claus Gittinger <cg@exept.de>
parents: 1855
diff changeset
  1305
    "Created: 4.11.1996 / 21:16:16 / cg"
1873
3544a4a94a2a checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1870
diff changeset
  1306
    "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
  1307
!
2623b60c27e1 lifted numVars; added access for invalidCodeObject-trappers
Claus Gittinger <cg@exept.de>
parents: 1855
diff changeset
  1308
2623b60c27e1 lifted numVars; added access for invalidCodeObject-trappers
Claus Gittinger <cg@exept.de>
parents: 1855
diff changeset
  1309
invalidCodeObjectWith:arg with:arg2
1873
3544a4a94a2a checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1870
diff changeset
  1310
    "{ Pragma: +optSpace }"
3544a4a94a2a checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1870
diff changeset
  1311
1870
2623b60c27e1 lifted numVars; added access for invalidCodeObject-trappers
Claus Gittinger <cg@exept.de>
parents: 1855
diff changeset
  1312
    "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
  1313
     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
  1314
     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
  1315
1873
3544a4a94a2a checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1870
diff changeset
  1316
%{
3544a4a94a2a checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1870
diff changeset
  1317
    /*
3544a4a94a2a checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1870
diff changeset
  1318
     * for reasons too far from being explained here,
3544a4a94a2a checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1870
diff changeset
  1319
     * this MUST be a compiled method
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
%}.
1870
2623b60c27e1 lifted numVars; added access for invalidCodeObject-trappers
Claus Gittinger <cg@exept.de>
parents: 1855
diff changeset
  1322
    ^ InvalidCodeSignal
3030
fc5d632d133f when compiling a lazy method, use the classes namespace
Claus Gittinger <cg@exept.de>
parents: 2979
diff changeset
  1323
	raiseErrorString:'invalid method - not executable'.
1870
2623b60c27e1 lifted numVars; added access for invalidCodeObject-trappers
Claus Gittinger <cg@exept.de>
parents: 1855
diff changeset
  1324
2623b60c27e1 lifted numVars; added access for invalidCodeObject-trappers
Claus Gittinger <cg@exept.de>
parents: 1855
diff changeset
  1325
    "Created: 4.11.1996 / 21:16:41 / cg"
1873
3544a4a94a2a checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1870
diff changeset
  1326
    "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
  1327
!
2623b60c27e1 lifted numVars; added access for invalidCodeObject-trappers
Claus Gittinger <cg@exept.de>
parents: 1855
diff changeset
  1328
2623b60c27e1 lifted numVars; added access for invalidCodeObject-trappers
Claus Gittinger <cg@exept.de>
parents: 1855
diff changeset
  1329
invalidCodeObjectWith:arg with:arg2 with:arg3
1873
3544a4a94a2a checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1870
diff changeset
  1330
    "{ Pragma: +optSpace }"
3544a4a94a2a checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1870
diff changeset
  1331
1870
2623b60c27e1 lifted numVars; added access for invalidCodeObject-trappers
Claus Gittinger <cg@exept.de>
parents: 1855
diff changeset
  1332
    "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
  1333
     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
  1334
     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
  1335
1873
3544a4a94a2a checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1870
diff changeset
  1336
%{
3544a4a94a2a checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1870
diff changeset
  1337
    /*
3544a4a94a2a checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1870
diff changeset
  1338
     * for reasons too far from being explained here,
3544a4a94a2a checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1870
diff changeset
  1339
     * this MUST be a compiled method
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
%}.
1870
2623b60c27e1 lifted numVars; added access for invalidCodeObject-trappers
Claus Gittinger <cg@exept.de>
parents: 1855
diff changeset
  1342
    ^ InvalidCodeSignal
3030
fc5d632d133f when compiling a lazy method, use the classes namespace
Claus Gittinger <cg@exept.de>
parents: 2979
diff changeset
  1343
	raiseErrorString:'invalid method - not executable'.
1870
2623b60c27e1 lifted numVars; added access for invalidCodeObject-trappers
Claus Gittinger <cg@exept.de>
parents: 1855
diff changeset
  1344
2623b60c27e1 lifted numVars; added access for invalidCodeObject-trappers
Claus Gittinger <cg@exept.de>
parents: 1855
diff changeset
  1345
    "Created: 4.11.1996 / 21:16:51 / cg"
1873
3544a4a94a2a checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1870
diff changeset
  1346
    "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
  1347
!
2623b60c27e1 lifted numVars; added access for invalidCodeObject-trappers
Claus Gittinger <cg@exept.de>
parents: 1855
diff changeset
  1348
2623b60c27e1 lifted numVars; added access for invalidCodeObject-trappers
Claus Gittinger <cg@exept.de>
parents: 1855
diff changeset
  1349
invalidCodeObjectWith:arg with:arg2 with:arg3 with:arg4
1873
3544a4a94a2a checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1870
diff changeset
  1350
    "{ Pragma: +optSpace }"
3544a4a94a2a checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1870
diff changeset
  1351
1870
2623b60c27e1 lifted numVars; added access for invalidCodeObject-trappers
Claus Gittinger <cg@exept.de>
parents: 1855
diff changeset
  1352
    "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
  1353
     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
  1354
     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
  1355
1873
3544a4a94a2a checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1870
diff changeset
  1356
%{
3544a4a94a2a checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1870
diff changeset
  1357
    /*
3544a4a94a2a checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1870
diff changeset
  1358
     * for reasons too far from being explained here,
3544a4a94a2a checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1870
diff changeset
  1359
     * this MUST be a compiled method
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
%}.
1870
2623b60c27e1 lifted numVars; added access for invalidCodeObject-trappers
Claus Gittinger <cg@exept.de>
parents: 1855
diff changeset
  1362
    ^ InvalidCodeSignal
3030
fc5d632d133f when compiling a lazy method, use the classes namespace
Claus Gittinger <cg@exept.de>
parents: 2979
diff changeset
  1363
	raiseErrorString:'invalid method - not executable'.
1870
2623b60c27e1 lifted numVars; added access for invalidCodeObject-trappers
Claus Gittinger <cg@exept.de>
parents: 1855
diff changeset
  1364
2623b60c27e1 lifted numVars; added access for invalidCodeObject-trappers
Claus Gittinger <cg@exept.de>
parents: 1855
diff changeset
  1365
    "Created: 4.11.1996 / 21:17:00 / cg"
1873
3544a4a94a2a checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1870
diff changeset
  1366
    "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
  1367
!
2623b60c27e1 lifted numVars; added access for invalidCodeObject-trappers
Claus Gittinger <cg@exept.de>
parents: 1855
diff changeset
  1368
2623b60c27e1 lifted numVars; added access for invalidCodeObject-trappers
Claus Gittinger <cg@exept.de>
parents: 1855
diff changeset
  1369
invalidCodeObjectWith:arg with:arg2 with:arg3 with:arg4 with:arg5
1873
3544a4a94a2a checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1870
diff changeset
  1370
    "{ Pragma: +optSpace }"
3544a4a94a2a checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1870
diff changeset
  1371
1870
2623b60c27e1 lifted numVars; added access for invalidCodeObject-trappers
Claus Gittinger <cg@exept.de>
parents: 1855
diff changeset
  1372
    "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
  1373
     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
  1374
     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
  1375
1873
3544a4a94a2a checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1870
diff changeset
  1376
%{
3544a4a94a2a checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1870
diff changeset
  1377
    /*
3544a4a94a2a checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1870
diff changeset
  1378
     * for reasons too far from being explained here,
3544a4a94a2a checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1870
diff changeset
  1379
     * this MUST be a compiled method
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
%}.
1870
2623b60c27e1 lifted numVars; added access for invalidCodeObject-trappers
Claus Gittinger <cg@exept.de>
parents: 1855
diff changeset
  1382
    ^ InvalidCodeSignal
3030
fc5d632d133f when compiling a lazy method, use the classes namespace
Claus Gittinger <cg@exept.de>
parents: 2979
diff changeset
  1383
	raiseErrorString:'invalid method - not executable'.
1870
2623b60c27e1 lifted numVars; added access for invalidCodeObject-trappers
Claus Gittinger <cg@exept.de>
parents: 1855
diff changeset
  1384
2623b60c27e1 lifted numVars; added access for invalidCodeObject-trappers
Claus Gittinger <cg@exept.de>
parents: 1855
diff changeset
  1385
    "Created: 4.11.1996 / 21:17:09 / cg"
1873
3544a4a94a2a checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1870
diff changeset
  1386
    "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
  1387
!
2623b60c27e1 lifted numVars; added access for invalidCodeObject-trappers
Claus Gittinger <cg@exept.de>
parents: 1855
diff changeset
  1388
2623b60c27e1 lifted numVars; added access for invalidCodeObject-trappers
Claus Gittinger <cg@exept.de>
parents: 1855
diff changeset
  1389
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
  1390
    "{ Pragma: +optSpace }"
3544a4a94a2a checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1870
diff changeset
  1391
1870
2623b60c27e1 lifted numVars; added access for invalidCodeObject-trappers
Claus Gittinger <cg@exept.de>
parents: 1855
diff changeset
  1392
    "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
  1393
     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
  1394
     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
  1395
1873
3544a4a94a2a checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1870
diff changeset
  1396
%{
3544a4a94a2a checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1870
diff changeset
  1397
    /*
3544a4a94a2a checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1870
diff changeset
  1398
     * for reasons too far from being explained here,
3544a4a94a2a checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1870
diff changeset
  1399
     * this MUST be a compiled method
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
%}.
1870
2623b60c27e1 lifted numVars; added access for invalidCodeObject-trappers
Claus Gittinger <cg@exept.de>
parents: 1855
diff changeset
  1402
    ^ InvalidCodeSignal
3030
fc5d632d133f when compiling a lazy method, use the classes namespace
Claus Gittinger <cg@exept.de>
parents: 2979
diff changeset
  1403
	raiseErrorString:'invalid method - not executable'.
1870
2623b60c27e1 lifted numVars; added access for invalidCodeObject-trappers
Claus Gittinger <cg@exept.de>
parents: 1855
diff changeset
  1404
2623b60c27e1 lifted numVars; added access for invalidCodeObject-trappers
Claus Gittinger <cg@exept.de>
parents: 1855
diff changeset
  1405
    "Created: 4.11.1996 / 21:17:17 / cg"
1873
3544a4a94a2a checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1870
diff changeset
  1406
    "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
  1407
!
2623b60c27e1 lifted numVars; added access for invalidCodeObject-trappers
Claus Gittinger <cg@exept.de>
parents: 1855
diff changeset
  1408
2623b60c27e1 lifted numVars; added access for invalidCodeObject-trappers
Claus Gittinger <cg@exept.de>
parents: 1855
diff changeset
  1409
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
  1410
    "{ Pragma: +optSpace }"
3544a4a94a2a checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1870
diff changeset
  1411
1870
2623b60c27e1 lifted numVars; added access for invalidCodeObject-trappers
Claus Gittinger <cg@exept.de>
parents: 1855
diff changeset
  1412
    "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
  1413
     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
  1414
     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
  1415
1873
3544a4a94a2a checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1870
diff changeset
  1416
%{
3544a4a94a2a checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1870
diff changeset
  1417
    /*
3544a4a94a2a checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1870
diff changeset
  1418
     * for reasons too far from being explained here,
3544a4a94a2a checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1870
diff changeset
  1419
     * this MUST be a compiled method
3544a4a94a2a checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1870
diff changeset
  1420
     */
3544a4a94a2a checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1870
diff changeset
  1421
%}.
1870
2623b60c27e1 lifted numVars; added access for invalidCodeObject-trappers
Claus Gittinger <cg@exept.de>
parents: 1855
diff changeset
  1422
    ^ InvalidCodeSignal
3030
fc5d632d133f when compiling a lazy method, use the classes namespace
Claus Gittinger <cg@exept.de>
parents: 2979
diff changeset
  1423
	raiseErrorString:'invalid method - not executable'.
1870
2623b60c27e1 lifted numVars; added access for invalidCodeObject-trappers
Claus Gittinger <cg@exept.de>
parents: 1855
diff changeset
  1424
2623b60c27e1 lifted numVars; added access for invalidCodeObject-trappers
Claus Gittinger <cg@exept.de>
parents: 1855
diff changeset
  1425
    "Created: 4.11.1996 / 21:17:25 / cg"
1873
3544a4a94a2a checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1870
diff changeset
  1426
    "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
  1427
!
2623b60c27e1 lifted numVars; added access for invalidCodeObject-trappers
Claus Gittinger <cg@exept.de>
parents: 1855
diff changeset
  1428
2623b60c27e1 lifted numVars; added access for invalidCodeObject-trappers
Claus Gittinger <cg@exept.de>
parents: 1855
diff changeset
  1429
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
  1430
    "{ Pragma: +optSpace }"
3544a4a94a2a checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1870
diff changeset
  1431
1870
2623b60c27e1 lifted numVars; added access for invalidCodeObject-trappers
Claus Gittinger <cg@exept.de>
parents: 1855
diff changeset
  1432
    "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
  1433
     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
  1434
     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
  1435
1873
3544a4a94a2a checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1870
diff changeset
  1436
%{
3544a4a94a2a checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1870
diff changeset
  1437
    /*
3544a4a94a2a checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1870
diff changeset
  1438
     * for reasons too far from being explained here,
3544a4a94a2a checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1870
diff changeset
  1439
     * this MUST be a compiled method
3544a4a94a2a checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1870
diff changeset
  1440
     */
3544a4a94a2a checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1870
diff changeset
  1441
%}.
1870
2623b60c27e1 lifted numVars; added access for invalidCodeObject-trappers
Claus Gittinger <cg@exept.de>
parents: 1855
diff changeset
  1442
    ^ InvalidCodeSignal
3030
fc5d632d133f when compiling a lazy method, use the classes namespace
Claus Gittinger <cg@exept.de>
parents: 2979
diff changeset
  1443
	raiseErrorString:'invalid method - not executable'.
1870
2623b60c27e1 lifted numVars; added access for invalidCodeObject-trappers
Claus Gittinger <cg@exept.de>
parents: 1855
diff changeset
  1444
2623b60c27e1 lifted numVars; added access for invalidCodeObject-trappers
Claus Gittinger <cg@exept.de>
parents: 1855
diff changeset
  1445
    "Created: 4.11.1996 / 21:17:32 / cg"
1873
3544a4a94a2a checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1870
diff changeset
  1446
    "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
  1447
!
2623b60c27e1 lifted numVars; added access for invalidCodeObject-trappers
Claus Gittinger <cg@exept.de>
parents: 1855
diff changeset
  1448
2623b60c27e1 lifted numVars; added access for invalidCodeObject-trappers
Claus Gittinger <cg@exept.de>
parents: 1855
diff changeset
  1449
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
  1450
    "{ Pragma: +optSpace }"
3544a4a94a2a checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1870
diff changeset
  1451
1870
2623b60c27e1 lifted numVars; added access for invalidCodeObject-trappers
Claus Gittinger <cg@exept.de>
parents: 1855
diff changeset
  1452
    "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
  1453
     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
  1454
     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
  1455
1873
3544a4a94a2a checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1870
diff changeset
  1456
%{
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
     * for reasons too far from being explained here,
3544a4a94a2a checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1870
diff changeset
  1459
     * this MUST be a compiled method
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
%}.
1870
2623b60c27e1 lifted numVars; added access for invalidCodeObject-trappers
Claus Gittinger <cg@exept.de>
parents: 1855
diff changeset
  1462
    ^ InvalidCodeSignal
3030
fc5d632d133f when compiling a lazy method, use the classes namespace
Claus Gittinger <cg@exept.de>
parents: 2979
diff changeset
  1463
	raiseErrorString:'invalid method - not executable'.
1870
2623b60c27e1 lifted numVars; added access for invalidCodeObject-trappers
Claus Gittinger <cg@exept.de>
parents: 1855
diff changeset
  1464
2623b60c27e1 lifted numVars; added access for invalidCodeObject-trappers
Claus Gittinger <cg@exept.de>
parents: 1855
diff changeset
  1465
    "Created: 4.11.1996 / 21:17:37 / cg"
1873
3544a4a94a2a checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1870
diff changeset
  1466
    "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
  1467
!
2623b60c27e1 lifted numVars; added access for invalidCodeObject-trappers
Claus Gittinger <cg@exept.de>
parents: 1855
diff changeset
  1468
2623b60c27e1 lifted numVars; added access for invalidCodeObject-trappers
Claus Gittinger <cg@exept.de>
parents: 1855
diff changeset
  1469
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
  1470
    "{ Pragma: +optSpace }"
3544a4a94a2a checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1870
diff changeset
  1471
1870
2623b60c27e1 lifted numVars; added access for invalidCodeObject-trappers
Claus Gittinger <cg@exept.de>
parents: 1855
diff changeset
  1472
    "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
  1473
     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
  1474
     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
  1475
1873
3544a4a94a2a checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1870
diff changeset
  1476
%{
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
     * for reasons too far from being explained here,
3544a4a94a2a checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1870
diff changeset
  1479
     * this MUST be a compiled method
3544a4a94a2a checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1870
diff changeset
  1480
     */
3544a4a94a2a checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1870
diff changeset
  1481
%}.
1870
2623b60c27e1 lifted numVars; added access for invalidCodeObject-trappers
Claus Gittinger <cg@exept.de>
parents: 1855
diff changeset
  1482
    ^ InvalidCodeSignal
3030
fc5d632d133f when compiling a lazy method, use the classes namespace
Claus Gittinger <cg@exept.de>
parents: 2979
diff changeset
  1483
	raiseErrorString:'invalid method - not executable'.
1870
2623b60c27e1 lifted numVars; added access for invalidCodeObject-trappers
Claus Gittinger <cg@exept.de>
parents: 1855
diff changeset
  1484
2623b60c27e1 lifted numVars; added access for invalidCodeObject-trappers
Claus Gittinger <cg@exept.de>
parents: 1855
diff changeset
  1485
    "Created: 4.11.1996 / 21:17:45 / cg"
1873
3544a4a94a2a checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1870
diff changeset
  1486
    "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
  1487
!
2623b60c27e1 lifted numVars; added access for invalidCodeObject-trappers
Claus Gittinger <cg@exept.de>
parents: 1855
diff changeset
  1488
2623b60c27e1 lifted numVars; added access for invalidCodeObject-trappers
Claus Gittinger <cg@exept.de>
parents: 1855
diff changeset
  1489
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
  1490
    "{ Pragma: +optSpace }"
3544a4a94a2a checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1870
diff changeset
  1491
1870
2623b60c27e1 lifted numVars; added access for invalidCodeObject-trappers
Claus Gittinger <cg@exept.de>
parents: 1855
diff changeset
  1492
    "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
  1493
     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
  1494
     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
  1495
1873
3544a4a94a2a checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1870
diff changeset
  1496
%{
3544a4a94a2a checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1870
diff changeset
  1497
    /*
3544a4a94a2a checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1870
diff changeset
  1498
     * for reasons too far from being explained here,
3544a4a94a2a checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1870
diff changeset
  1499
     * this MUST be a compiled method
3544a4a94a2a checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1870
diff changeset
  1500
     */
3544a4a94a2a checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1870
diff changeset
  1501
%}.
1870
2623b60c27e1 lifted numVars; added access for invalidCodeObject-trappers
Claus Gittinger <cg@exept.de>
parents: 1855
diff changeset
  1502
    ^ InvalidCodeSignal
3030
fc5d632d133f when compiling a lazy method, use the classes namespace
Claus Gittinger <cg@exept.de>
parents: 2979
diff changeset
  1503
	raiseErrorString:'invalid method - not executable'.
1870
2623b60c27e1 lifted numVars; added access for invalidCodeObject-trappers
Claus Gittinger <cg@exept.de>
parents: 1855
diff changeset
  1504
2623b60c27e1 lifted numVars; added access for invalidCodeObject-trappers
Claus Gittinger <cg@exept.de>
parents: 1855
diff changeset
  1505
    "Created: 4.11.1996 / 21:17:52 / cg"
1873
3544a4a94a2a checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1870
diff changeset
  1506
    "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
  1507
!
2623b60c27e1 lifted numVars; added access for invalidCodeObject-trappers
Claus Gittinger <cg@exept.de>
parents: 1855
diff changeset
  1508
2623b60c27e1 lifted numVars; added access for invalidCodeObject-trappers
Claus Gittinger <cg@exept.de>
parents: 1855
diff changeset
  1509
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
  1510
    "{ Pragma: +optSpace }"
3544a4a94a2a checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1870
diff changeset
  1511
1870
2623b60c27e1 lifted numVars; added access for invalidCodeObject-trappers
Claus Gittinger <cg@exept.de>
parents: 1855
diff changeset
  1512
    "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
  1513
     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
  1514
     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
  1515
1873
3544a4a94a2a checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1870
diff changeset
  1516
%{
3544a4a94a2a checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1870
diff changeset
  1517
    /*
3544a4a94a2a checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1870
diff changeset
  1518
     * for reasons too far from being explained here,
3544a4a94a2a checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1870
diff changeset
  1519
     * this MUST be a compiled method
3544a4a94a2a checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1870
diff changeset
  1520
     */
3544a4a94a2a checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1870
diff changeset
  1521
%}.
1870
2623b60c27e1 lifted numVars; added access for invalidCodeObject-trappers
Claus Gittinger <cg@exept.de>
parents: 1855
diff changeset
  1522
    ^ InvalidCodeSignal
3030
fc5d632d133f when compiling a lazy method, use the classes namespace
Claus Gittinger <cg@exept.de>
parents: 2979
diff changeset
  1523
	raiseErrorString:'invalid method - not executable'.
1870
2623b60c27e1 lifted numVars; added access for invalidCodeObject-trappers
Claus Gittinger <cg@exept.de>
parents: 1855
diff changeset
  1524
2623b60c27e1 lifted numVars; added access for invalidCodeObject-trappers
Claus Gittinger <cg@exept.de>
parents: 1855
diff changeset
  1525
    "Created: 4.11.1996 / 20:51:28 / cg"
1873
3544a4a94a2a checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1870
diff changeset
  1526
    "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
  1527
!
2623b60c27e1 lifted numVars; added access for invalidCodeObject-trappers
Claus Gittinger <cg@exept.de>
parents: 1855
diff changeset
  1528
2623b60c27e1 lifted numVars; added access for invalidCodeObject-trappers
Claus Gittinger <cg@exept.de>
parents: 1855
diff changeset
  1529
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
  1530
    "{ Pragma: +optSpace }"
3544a4a94a2a checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1870
diff changeset
  1531
1870
2623b60c27e1 lifted numVars; added access for invalidCodeObject-trappers
Claus Gittinger <cg@exept.de>
parents: 1855
diff changeset
  1532
    "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
  1533
     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
  1534
     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
  1535
1873
3544a4a94a2a checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1870
diff changeset
  1536
%{
3544a4a94a2a checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1870
diff changeset
  1537
    /*
3544a4a94a2a checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1870
diff changeset
  1538
     * for reasons too far from being explained here,
3544a4a94a2a checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1870
diff changeset
  1539
     * this MUST be a compiled method
3544a4a94a2a checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1870
diff changeset
  1540
     */
3544a4a94a2a checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1870
diff changeset
  1541
%}.
1870
2623b60c27e1 lifted numVars; added access for invalidCodeObject-trappers
Claus Gittinger <cg@exept.de>
parents: 1855
diff changeset
  1542
    ^ InvalidCodeSignal
3030
fc5d632d133f when compiling a lazy method, use the classes namespace
Claus Gittinger <cg@exept.de>
parents: 2979
diff changeset
  1543
	raiseErrorString:'invalid method - not executable'.
1870
2623b60c27e1 lifted numVars; added access for invalidCodeObject-trappers
Claus Gittinger <cg@exept.de>
parents: 1855
diff changeset
  1544
2623b60c27e1 lifted numVars; added access for invalidCodeObject-trappers
Claus Gittinger <cg@exept.de>
parents: 1855
diff changeset
  1545
    "Created: 4.11.1996 / 21:18:09 / cg"
1873
3544a4a94a2a checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1870
diff changeset
  1546
    "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
  1547
!
2623b60c27e1 lifted numVars; added access for invalidCodeObject-trappers
Claus Gittinger <cg@exept.de>
parents: 1855
diff changeset
  1548
2623b60c27e1 lifted numVars; added access for invalidCodeObject-trappers
Claus Gittinger <cg@exept.de>
parents: 1855
diff changeset
  1549
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
  1550
    "{ Pragma: +optSpace }"
3544a4a94a2a checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1870
diff changeset
  1551
1870
2623b60c27e1 lifted numVars; added access for invalidCodeObject-trappers
Claus Gittinger <cg@exept.de>
parents: 1855
diff changeset
  1552
    "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
  1553
     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
  1554
     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
  1555
1873
3544a4a94a2a checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1870
diff changeset
  1556
%{
3544a4a94a2a checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1870
diff changeset
  1557
    /*
3544a4a94a2a checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1870
diff changeset
  1558
     * for reasons too far from being explained here,
3544a4a94a2a checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1870
diff changeset
  1559
     * this MUST be a compiled method
3544a4a94a2a checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1870
diff changeset
  1560
     */
3544a4a94a2a checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1870
diff changeset
  1561
%}.
1870
2623b60c27e1 lifted numVars; added access for invalidCodeObject-trappers
Claus Gittinger <cg@exept.de>
parents: 1855
diff changeset
  1562
    ^ InvalidCodeSignal
3030
fc5d632d133f when compiling a lazy method, use the classes namespace
Claus Gittinger <cg@exept.de>
parents: 2979
diff changeset
  1563
	raiseErrorString:'invalid method - not executable'.
1870
2623b60c27e1 lifted numVars; added access for invalidCodeObject-trappers
Claus Gittinger <cg@exept.de>
parents: 1855
diff changeset
  1564
2623b60c27e1 lifted numVars; added access for invalidCodeObject-trappers
Claus Gittinger <cg@exept.de>
parents: 1855
diff changeset
  1565
    "Created: 4.11.1996 / 21:18:17 / cg"
1873
3544a4a94a2a checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1870
diff changeset
  1566
    "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
  1567
!
2623b60c27e1 lifted numVars; added access for invalidCodeObject-trappers
Claus Gittinger <cg@exept.de>
parents: 1855
diff changeset
  1568
2623b60c27e1 lifted numVars; added access for invalidCodeObject-trappers
Claus Gittinger <cg@exept.de>
parents: 1855
diff changeset
  1569
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
  1570
    "{ Pragma: +optSpace }"
3544a4a94a2a checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1870
diff changeset
  1571
1870
2623b60c27e1 lifted numVars; added access for invalidCodeObject-trappers
Claus Gittinger <cg@exept.de>
parents: 1855
diff changeset
  1572
    "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
  1573
     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
  1574
     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
  1575
1873
3544a4a94a2a checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1870
diff changeset
  1576
%{
3544a4a94a2a checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1870
diff changeset
  1577
    /*
3544a4a94a2a checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1870
diff changeset
  1578
     * for reasons too far from being explained here,
3544a4a94a2a checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1870
diff changeset
  1579
     * this MUST be a compiled method
3544a4a94a2a checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1870
diff changeset
  1580
     */
3544a4a94a2a checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1870
diff changeset
  1581
%}.
1870
2623b60c27e1 lifted numVars; added access for invalidCodeObject-trappers
Claus Gittinger <cg@exept.de>
parents: 1855
diff changeset
  1582
    ^ InvalidCodeSignal
3030
fc5d632d133f when compiling a lazy method, use the classes namespace
Claus Gittinger <cg@exept.de>
parents: 2979
diff changeset
  1583
	raiseErrorString:'invalid method - not executable'.
1870
2623b60c27e1 lifted numVars; added access for invalidCodeObject-trappers
Claus Gittinger <cg@exept.de>
parents: 1855
diff changeset
  1584
2623b60c27e1 lifted numVars; added access for invalidCodeObject-trappers
Claus Gittinger <cg@exept.de>
parents: 1855
diff changeset
  1585
    "Created: 4.11.1996 / 21:18:22 / cg"
1873
3544a4a94a2a checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1870
diff changeset
  1586
    "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
  1587
!
2623b60c27e1 lifted numVars; added access for invalidCodeObject-trappers
Claus Gittinger <cg@exept.de>
parents: 1855
diff changeset
  1588
109
1fae65190b17 errors raise signals; check arg-count in valueWith...
claus
parents: 93
diff changeset
  1589
privateMethodCalled
1873
3544a4a94a2a checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1870
diff changeset
  1590
    "{ Pragma: +optSpace }"
3544a4a94a2a checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1870
diff changeset
  1591
980
0ab2f56ecfc7 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 957
diff changeset
  1592
    "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
  1593
360
claus
parents: 350
diff changeset
  1594
     If you continue in the debugger, the method will be called,
415
claus
parents: 414
diff changeset
  1595
     and further privacy exceptions will NOT be reported at this call location, 
360
claus
parents: 350
diff changeset
  1596
     until any new method is compiled, or the privacy of any method changes,
claus
parents: 350
diff changeset
  1597
     or the caches are flushed.
claus
parents: 350
diff changeset
  1598
     (the reason is that after the continue, the method is enterred into the
claus
parents: 350
diff changeset
  1599
      calling cache, for which method privacy is not checked.
claus
parents: 350
diff changeset
  1600
      Any of the above actions flushes this cache and a privacy check
claus
parents: 350
diff changeset
  1601
      is performed again.)
claus
parents: 350
diff changeset
  1602
     Future versions may not enter private methods into the cache, to fix this
claus
parents: 350
diff changeset
  1603
     (unobvious) behavior. However, then you will get an exception for EVERY
claus
parents: 350
diff changeset
  1604
     call to a private method ...
claus
parents: 350
diff changeset
  1605
claus
parents: 350
diff changeset
  1606
     Notice: method privacy is a nonstandard feature, not supported
claus
parents: 350
diff changeset
  1607
     by other smalltalk implementations and not specified in the ANSI spec.
claus
parents: 350
diff changeset
  1608
     This is EXPERIMENTAL - and being evaluated for usability.
claus
parents: 350
diff changeset
  1609
     It may change or even vanish (if it shows to be not useful)."
68
59faa75185ba *** empty log message ***
claus
parents: 56
diff changeset
  1610
142
c7844287bddf *** empty log message ***
claus
parents: 109
diff changeset
  1611
    ^ PrivateMethodSignal raise
1873
3544a4a94a2a checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1870
diff changeset
  1612
3544a4a94a2a checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1870
diff changeset
  1613
    "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
  1614
!
d600e08a5936 handle the case where a method has a sourceFileInfo, but the class has not
Claus Gittinger <cg@exept.de>
parents: 934
diff changeset
  1615
d600e08a5936 handle the case where a method has a sourceFileInfo, but the class has not
Claus Gittinger <cg@exept.de>
parents: 934
diff changeset
  1616
uncompiledCodeObject
1873
3544a4a94a2a checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1870
diff changeset
  1617
    "{ Pragma: +optSpace }"
3544a4a94a2a checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1870
diff changeset
  1618
952
d600e08a5936 handle the case where a method has a sourceFileInfo, but the class has not
Claus Gittinger <cg@exept.de>
parents: 934
diff changeset
  1619
    "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
  1620
     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
  1621
     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
  1622
     For those methods, the compiler generated a method object consisting
1873
3544a4a94a2a checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1870
diff changeset
  1623
     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
  1624
3544a4a94a2a checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1870
diff changeset
  1625
%{
3544a4a94a2a checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1870
diff changeset
  1626
    /*
3544a4a94a2a checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1870
diff changeset
  1627
     * for reasons too far from being explained here,
3544a4a94a2a checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1870
diff changeset
  1628
     * this MUST be a compiled method
3544a4a94a2a checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1870
diff changeset
  1629
     */
3544a4a94a2a checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1870
diff changeset
  1630
%}.
952
d600e08a5936 handle the case where a method has a sourceFileInfo, but the class has not
Claus Gittinger <cg@exept.de>
parents: 934
diff changeset
  1631
    ^ InvalidCodeSignal
3030
fc5d632d133f when compiling a lazy method, use the classes namespace
Claus Gittinger <cg@exept.de>
parents: 2979
diff changeset
  1632
	raiseRequestWith:self
fc5d632d133f when compiling a lazy method, use the classes namespace
Claus Gittinger <cg@exept.de>
parents: 2979
diff changeset
  1633
	errorString:'invalid method - not compiled'.
1873
3544a4a94a2a checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1870
diff changeset
  1634
3544a4a94a2a checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1870
diff changeset
  1635
    "Modified: 4.11.1996 / 22:58:02 / cg"
3544a4a94a2a checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1870
diff changeset
  1636
!
3544a4a94a2a checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1870
diff changeset
  1637
3544a4a94a2a checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1870
diff changeset
  1638
unloadedCodeObject
3544a4a94a2a checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1870
diff changeset
  1639
    "{ Pragma: +optSpace }"
3544a4a94a2a checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1870
diff changeset
  1640
3544a4a94a2a checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1870
diff changeset
  1641
    "this method is invoked by methods which have been binary-unloaded
3544a4a94a2a checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1870
diff changeset
  1642
     For those the source info consists
3544a4a94a2a checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1870
diff changeset
  1643
     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
  1644
3544a4a94a2a checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1870
diff changeset
  1645
%{
3544a4a94a2a checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1870
diff changeset
  1646
    /*
3544a4a94a2a checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1870
diff changeset
  1647
     * for reasons too far from being explained here,
3544a4a94a2a checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1870
diff changeset
  1648
     * this MUST be a compiled method
3544a4a94a2a checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1870
diff changeset
  1649
     */
3544a4a94a2a checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1870
diff changeset
  1650
%}.
3544a4a94a2a checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1870
diff changeset
  1651
    ^ InvalidCodeSignal
3030
fc5d632d133f when compiling a lazy method, use the classes namespace
Claus Gittinger <cg@exept.de>
parents: 2979
diff changeset
  1652
	raiseRequestWith:self
fc5d632d133f when compiling a lazy method, use the classes namespace
Claus Gittinger <cg@exept.de>
parents: 2979
diff changeset
  1653
	errorString:'invalid method - unloaded'.
1873
3544a4a94a2a checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1870
diff changeset
  1654
3544a4a94a2a checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1870
diff changeset
  1655
    "Created: 4.11.1996 / 22:57:54 / cg"
3544a4a94a2a checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1870
diff changeset
  1656
    "Modified: 4.11.1996 / 22:58:28 / cg"
1
a27a279701f8 Initial revision
claus
parents:
diff changeset
  1657
! !
a27a279701f8 Initial revision
claus
parents:
diff changeset
  1658
93
e31220cb391f *** empty log message ***
claus
parents: 88
diff changeset
  1659
!Method methodsFor:'printing & storing'!
1
a27a279701f8 Initial revision
claus
parents:
diff changeset
  1660
a27a279701f8 Initial revision
claus
parents:
diff changeset
  1661
printOn:aStream
56
be0ed17e6f85 *** empty log message ***
claus
parents: 49
diff changeset
  1662
    "put a printed representation of the receiver onto aStream.
be0ed17e6f85 *** empty log message ***
claus
parents: 49
diff changeset
  1663
     Since methods do not store their class/selector, we have to search
be0ed17e6f85 *** empty log message ***
claus
parents: 49
diff changeset
  1664
     for it here."
1
a27a279701f8 Initial revision
claus
parents:
diff changeset
  1665
227
23b1c4de3402 package & cleanup
claus
parents: 216
diff changeset
  1666
    |classAndSelector m wrapped|
1
a27a279701f8 Initial revision
claus
parents:
diff changeset
  1667
253
30daee717a53 *** empty log message ***
claus
parents: 227
diff changeset
  1668
    wrapped := false.
30daee717a53 *** empty log message ***
claus
parents: 227
diff changeset
  1669
159
514c749165c3 *** empty log message ***
claus
parents: 142
diff changeset
  1670
    aStream nextPutAll:(self classNameWithArticle).
514c749165c3 *** empty log message ***
claus
parents: 142
diff changeset
  1671
    aStream nextPut:$(.
227
23b1c4de3402 package & cleanup
claus
parents: 216
diff changeset
  1672
176
48061f8659aa more queries
claus
parents: 159
diff changeset
  1673
    classAndSelector := self who.
227
23b1c4de3402 package & cleanup
claus
parents: 216
diff changeset
  1674
    classAndSelector isNil ifTrue:[
3030
fc5d632d133f when compiling a lazy method, use the classes namespace
Claus Gittinger <cg@exept.de>
parents: 2979
diff changeset
  1675
	"
fc5d632d133f when compiling a lazy method, use the classes namespace
Claus Gittinger <cg@exept.de>
parents: 2979
diff changeset
  1676
	 not anchored in any class.
fc5d632d133f when compiling a lazy method, use the classes namespace
Claus Gittinger <cg@exept.de>
parents: 2979
diff changeset
  1677
	 check if wrapped (to be more informative in inspectors)
fc5d632d133f when compiling a lazy method, use the classes namespace
Claus Gittinger <cg@exept.de>
parents: 2979
diff changeset
  1678
	"
fc5d632d133f when compiling a lazy method, use the classes namespace
Claus Gittinger <cg@exept.de>
parents: 2979
diff changeset
  1679
	m := self wrapper.
fc5d632d133f when compiling a lazy method, use the classes namespace
Claus Gittinger <cg@exept.de>
parents: 2979
diff changeset
  1680
	m notNil ifTrue:[
fc5d632d133f when compiling a lazy method, use the classes namespace
Claus Gittinger <cg@exept.de>
parents: 2979
diff changeset
  1681
	    classAndSelector := m who.
fc5d632d133f when compiling a lazy method, use the classes namespace
Claus Gittinger <cg@exept.de>
parents: 2979
diff changeset
  1682
	    wrapped := true.
fc5d632d133f when compiling a lazy method, use the classes namespace
Claus Gittinger <cg@exept.de>
parents: 2979
diff changeset
  1683
	]
227
23b1c4de3402 package & cleanup
claus
parents: 216
diff changeset
  1684
    ].
176
48061f8659aa more queries
claus
parents: 159
diff changeset
  1685
    classAndSelector notNil ifTrue:[
3030
fc5d632d133f when compiling a lazy method, use the classes namespace
Claus Gittinger <cg@exept.de>
parents: 2979
diff changeset
  1686
	(classAndSelector methodClass) name printOn:aStream.
fc5d632d133f when compiling a lazy method, use the classes namespace
Claus Gittinger <cg@exept.de>
parents: 2979
diff changeset
  1687
	aStream nextPutAll:' '.
fc5d632d133f when compiling a lazy method, use the classes namespace
Claus Gittinger <cg@exept.de>
parents: 2979
diff changeset
  1688
	(classAndSelector methodSelector) printOn:aStream.
fc5d632d133f when compiling a lazy method, use the classes namespace
Claus Gittinger <cg@exept.de>
parents: 2979
diff changeset
  1689
	wrapped ifTrue:[
fc5d632d133f when compiling a lazy method, use the classes namespace
Claus Gittinger <cg@exept.de>
parents: 2979
diff changeset
  1690
	    aStream nextPutAll:'; wrapped'
fc5d632d133f when compiling a lazy method, use the classes namespace
Claus Gittinger <cg@exept.de>
parents: 2979
diff changeset
  1691
	].
1
a27a279701f8 Initial revision
claus
parents:
diff changeset
  1692
    ] ifFalse:[
3030
fc5d632d133f when compiling a lazy method, use the classes namespace
Claus Gittinger <cg@exept.de>
parents: 2979
diff changeset
  1693
	"
fc5d632d133f when compiling a lazy method, use the classes namespace
Claus Gittinger <cg@exept.de>
parents: 2979
diff changeset
  1694
	 sorry, a method which is nowhere anchored
fc5d632d133f when compiling a lazy method, use the classes namespace
Claus Gittinger <cg@exept.de>
parents: 2979
diff changeset
  1695
	"
fc5d632d133f when compiling a lazy method, use the classes namespace
Claus Gittinger <cg@exept.de>
parents: 2979
diff changeset
  1696
	aStream nextPutAll:'unbound'
56
be0ed17e6f85 *** empty log message ***
claus
parents: 49
diff changeset
  1697
    ].
be0ed17e6f85 *** empty log message ***
claus
parents: 49
diff changeset
  1698
    aStream nextPut:$)
176
48061f8659aa more queries
claus
parents: 159
diff changeset
  1699
48061f8659aa more queries
claus
parents: 159
diff changeset
  1700
    "
253
30daee717a53 *** empty log message ***
claus
parents: 227
diff changeset
  1701
     (Object compiledMethodAt:#at:) printOn:Transcript. Transcript cr.
30daee717a53 *** empty log message ***
claus
parents: 227
diff changeset
  1702
     (Object compiledMethodAt:#at:) copy printOn:Transcript. Transcript cr.
176
48061f8659aa more queries
claus
parents: 159
diff changeset
  1703
    "
1851
4accc9fafd19 change #who to return a proper object
Claus Gittinger <cg@exept.de>
parents: 1813
diff changeset
  1704
4accc9fafd19 change #who to return a proper object
Claus Gittinger <cg@exept.de>
parents: 1813
diff changeset
  1705
    "Modified: 1.11.1996 / 16:25:34 / 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
  1706
!
d600e08a5936 handle the case where a method has a sourceFileInfo, but the class has not
Claus Gittinger <cg@exept.de>
parents: 934
diff changeset
  1707
5241
51adc83b9d0e *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5152
diff changeset
  1708
printStringForBrowserWithSelector:selector inClass:aClass
51adc83b9d0e *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5152
diff changeset
  1709
    "return a printString to represent myself to the user in a browser.
51adc83b9d0e *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5152
diff changeset
  1710
     Defined here to allow for browsers to deal with nonStandard pseudoMethods"
51adc83b9d0e *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5152
diff changeset
  1711
51adc83b9d0e *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5152
diff changeset
  1712
    |s privInfo moreInfo p i n cls|
1194
628abcb5fbb6 moved some protocol from to upper levels
Claus Gittinger <cg@exept.de>
parents: 1190
diff changeset
  1713
628abcb5fbb6 moved some protocol from to upper levels
Claus Gittinger <cg@exept.de>
parents: 1190
diff changeset
  1714
    moreInfo := ''.
1800
1aa32eede53a checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1780
diff changeset
  1715
    privInfo := ''.
1194
628abcb5fbb6 moved some protocol from to upper levels
Claus Gittinger <cg@exept.de>
parents: 1190
diff changeset
  1716
628abcb5fbb6 moved some protocol from to upper levels
Claus Gittinger <cg@exept.de>
parents: 1190
diff changeset
  1717
    self isWrapped ifTrue:[
5644
8d0d817060ec *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5636
diff changeset
  1718
	(MessageTracer isCounting:self) ifTrue:[
8d0d817060ec *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5636
diff changeset
  1719
	    (MessageTracer isCountingMemoryUsage:self) ifTrue:[
8d0d817060ec *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5636
diff changeset
  1720
		moreInfo := moreInfo , 
8d0d817060ec *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5636
diff changeset
  1721
		     ' (mem usage avg: ' , (MessageTracer memoryUsageOfMethod:self) printString asText allBold , ' bytes)'.
8d0d817060ec *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5636
diff changeset
  1722
	    ] ifFalse:[
8d0d817060ec *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5636
diff changeset
  1723
		moreInfo := moreInfo , 
8d0d817060ec *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5636
diff changeset
  1724
		     ' (called ' , (MessageTracer executionCountOfMethod:self) printString asText allBold , ' times)'.
8d0d817060ec *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5636
diff changeset
  1725
	    ]
8d0d817060ec *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5636
diff changeset
  1726
	] ifFalse:[
8d0d817060ec *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5636
diff changeset
  1727
	    (MessageTracer isTiming:self) ifTrue:[
8d0d817060ec *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5636
diff changeset
  1728
		i := MessageTracer executionTimesOfMethod:self.
8d0d817060ec *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5636
diff changeset
  1729
		(i isNil or:[(n := i at:#count) == 0]) ifTrue:[
8d0d817060ec *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5636
diff changeset
  1730
		    moreInfo := moreInfo , 
8d0d817060ec *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5636
diff changeset
  1731
				' (cnt: ' , (i at:#count) printString , ')'
8d0d817060ec *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5636
diff changeset
  1732
		] ifFalse:[
8d0d817060ec *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5636
diff changeset
  1733
		    n == 1 ifTrue:[
8d0d817060ec *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5636
diff changeset
  1734
			moreInfo := moreInfo , 
8d0d817060ec *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5636
diff changeset
  1735
				    ' (t: ' , (i at:#avgTime) printString asText allBold,
8d0d817060ec *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5636
diff changeset
  1736
				    'ms cnt: ' , (i at:#count) printString , ')'
8d0d817060ec *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5636
diff changeset
  1737
		    ] ifFalse:[
8d0d817060ec *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5636
diff changeset
  1738
			moreInfo := moreInfo , 
8d0d817060ec *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5636
diff changeset
  1739
				    ' (avg: ' , (i at:#avgTime) printString asText allBold,
8d0d817060ec *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5636
diff changeset
  1740
				    'ms min: ' , (i at:#minTime) printString , 
8d0d817060ec *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5636
diff changeset
  1741
				    ' max: ' , (i at:#maxTime) printString ,
8d0d817060ec *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5636
diff changeset
  1742
				    ' cnt: ' , (i at:#count) printString , ')'
8d0d817060ec *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5636
diff changeset
  1743
		    ].
8d0d817060ec *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5636
diff changeset
  1744
		].
8d0d817060ec *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5636
diff changeset
  1745
	    ] ifFalse:[
8d0d817060ec *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5636
diff changeset
  1746
		moreInfo := ' !!'
8d0d817060ec *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5636
diff changeset
  1747
	    ]
8d0d817060ec *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5636
diff changeset
  1748
	].
3216
e0f3f49118ed Simplify privacy stuff to make redirection from WrappedMethod easier.
Stefan Vogel <sv@exept.de>
parents: 3168
diff changeset
  1749
    ]. 
e0f3f49118ed Simplify privacy stuff to make redirection from WrappedMethod easier.
Stefan Vogel <sv@exept.de>
parents: 3168
diff changeset
  1750
    p := self privacy.
1805
5d0aa9e488c5 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1800
diff changeset
  1751
5d0aa9e488c5 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1800
diff changeset
  1752
    p ~~ #public ifTrue:[
5644
8d0d817060ec *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5636
diff changeset
  1753
	privInfo := (' (* ' , p , ' *)') asText emphasizeAllWith:#italic.
1194
628abcb5fbb6 moved some protocol from to upper levels
Claus Gittinger <cg@exept.de>
parents: 1190
diff changeset
  1754
    ].
628abcb5fbb6 moved some protocol from to upper levels
Claus Gittinger <cg@exept.de>
parents: 1190
diff changeset
  1755
5551
fa4886352aef disable #isInvalid
Claus Gittinger <cg@exept.de>
parents: 5544
diff changeset
  1756
"/    self isInvalid ifTrue:[
fa4886352aef disable #isInvalid
Claus Gittinger <cg@exept.de>
parents: 5544
diff changeset
  1757
"/        moreInfo := ' (** not executable **)'.
fa4886352aef disable #isInvalid
Claus Gittinger <cg@exept.de>
parents: 5544
diff changeset
  1758
"/    ].
1194
628abcb5fbb6 moved some protocol from to upper levels
Claus Gittinger <cg@exept.de>
parents: 1190
diff changeset
  1759
1806
071c1c9e6bbb checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1805
diff changeset
  1760
    (self isLazyMethod not and:[self isUnloaded]) ifTrue:[
5644
8d0d817060ec *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5636
diff changeset
  1761
	moreInfo := ' (** unloaded **)'
1194
628abcb5fbb6 moved some protocol from to upper levels
Claus Gittinger <cg@exept.de>
parents: 1190
diff changeset
  1762
    ].
628abcb5fbb6 moved some protocol from to upper levels
Claus Gittinger <cg@exept.de>
parents: 1190
diff changeset
  1763
1800
1aa32eede53a checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1780
diff changeset
  1764
    privInfo size ~~ 0 ifTrue:[
5644
8d0d817060ec *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5636
diff changeset
  1765
	moreInfo := privInfo , ' ' , moreInfo
1800
1aa32eede53a checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1780
diff changeset
  1766
    ].
1aa32eede53a checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1780
diff changeset
  1767
4581
9b807b6f7265 show a methods package, if it differs from the classes package
Claus Gittinger <cg@exept.de>
parents: 4522
diff changeset
  1768
    s := selector.
5241
51adc83b9d0e *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5152
diff changeset
  1769
    (cls := aClass) isNil ifTrue:[
5644
8d0d817060ec *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5636
diff changeset
  1770
	cls := self containingClass
5241
51adc83b9d0e *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5152
diff changeset
  1771
    ].
5530
a06e9a29869e care for orphant methods in printStringInBrowser.
Claus Gittinger <cg@exept.de>
parents: 5523
diff changeset
  1772
    (cls isNil or:[self package ~= cls package]) ifTrue:[
5644
8d0d817060ec *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5636
diff changeset
  1773
	s := s , ' [' , (self package asText emphasizeAllWith:(Array with:#italic with:(#color->Color red darkened))), ']'
4581
9b807b6f7265 show a methods package, if it differs from the classes package
Claus Gittinger <cg@exept.de>
parents: 4522
diff changeset
  1774
    ].
9b807b6f7265 show a methods package, if it differs from the classes package
Claus Gittinger <cg@exept.de>
parents: 4522
diff changeset
  1775
9b807b6f7265 show a methods package, if it differs from the classes package
Claus Gittinger <cg@exept.de>
parents: 4522
diff changeset
  1776
    moreInfo size == 0 ifTrue:[^ s].
1805
5d0aa9e488c5 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1800
diff changeset
  1777
1436
4eae8fd83654 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1293
diff changeset
  1778
    s := selector , moreInfo.
4581
9b807b6f7265 show a methods package, if it differs from the classes package
Claus Gittinger <cg@exept.de>
parents: 4522
diff changeset
  1779
1813
c22f39201fe7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1806
diff changeset
  1780
    self isInvalid ifTrue:[
5644
8d0d817060ec *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5636
diff changeset
  1781
	s := s asText emphasizeAllWith:#color->Color red.
1813
c22f39201fe7 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1806
diff changeset
  1782
    ].
1436
4eae8fd83654 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1293
diff changeset
  1783
    ^ s
1194
628abcb5fbb6 moved some protocol from to upper levels
Claus Gittinger <cg@exept.de>
parents: 1190
diff changeset
  1784
3216
e0f3f49118ed Simplify privacy stuff to make redirection from WrappedMethod easier.
Stefan Vogel <sv@exept.de>
parents: 3168
diff changeset
  1785
    "Modified: / 23.1.1998 / 13:15:15 / stefan"
3697
e02091768624 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 3693
diff changeset
  1786
    "Modified: / 31.7.1998 / 00:37:47 / cg"
5241
51adc83b9d0e *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5152
diff changeset
  1787
    "Created: / 5.2.2000 / 22:55:56 / cg"
1194
628abcb5fbb6 moved some protocol from to upper levels
Claus Gittinger <cg@exept.de>
parents: 1190
diff changeset
  1788
!
628abcb5fbb6 moved some protocol from to upper levels
Claus Gittinger <cg@exept.de>
parents: 1190
diff changeset
  1789
952
d600e08a5936 handle the case where a method has a sourceFileInfo, but the class has not
Claus Gittinger <cg@exept.de>
parents: 934
diff changeset
  1790
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
  1791
    "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
  1792
     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
  1793
1851
4accc9fafd19 change #who to return a proper object
Claus Gittinger <cg@exept.de>
parents: 1813
diff changeset
  1794
    |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
  1795
1851
4accc9fafd19 change #who to return a proper object
Claus Gittinger <cg@exept.de>
parents: 1813
diff changeset
  1796
    who := self who.
4accc9fafd19 change #who to return a proper object
Claus Gittinger <cg@exept.de>
parents: 1813
diff changeset
  1797
    who notNil ifTrue:[
3030
fc5d632d133f when compiling a lazy method, use the classes namespace
Claus Gittinger <cg@exept.de>
parents: 2979
diff changeset
  1798
	^ (who methodClass) name , '>>' , (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
  1799
    ].
d600e08a5936 handle the case where a method has a sourceFileInfo, but the class has not
Claus Gittinger <cg@exept.de>
parents: 934
diff changeset
  1800
    ^ '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
  1801
d600e08a5936 handle the case where a method has a sourceFileInfo, but the class has not
Claus Gittinger <cg@exept.de>
parents: 934
diff changeset
  1802
    "
d600e08a5936 handle the case where a method has a sourceFileInfo, but the class has not
Claus Gittinger <cg@exept.de>
parents: 934
diff changeset
  1803
     Method new 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
  1804
     (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
  1805
    "
1851
4accc9fafd19 change #who to return a proper object
Claus Gittinger <cg@exept.de>
parents: 1813
diff changeset
  1806
4accc9fafd19 change #who to return a proper object
Claus Gittinger <cg@exept.de>
parents: 1813
diff changeset
  1807
    "Modified: 1.11.1996 / 16:27:04 / cg"
1
a27a279701f8 Initial revision
claus
parents:
diff changeset
  1808
! !
a27a279701f8 Initial revision
claus
parents:
diff changeset
  1809
1093
1e742016eea0 category rename / added access to RESOURCE and CALLED flags
Claus Gittinger <cg@exept.de>
parents: 1087
diff changeset
  1810
!Method methodsFor:'private-compiler interface'!
1e742016eea0 category rename / added access to RESOURCE and CALLED flags
Claus Gittinger <cg@exept.de>
parents: 1087
diff changeset
  1811
5405
f07c8045ab4e *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5398
diff changeset
  1812
primitiveNumber
f07c8045ab4e *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5398
diff changeset
  1813
    "for stx rel >= 5.x only:
f07c8045ab4e *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5398
diff changeset
  1814
     return the primitive number."
f07c8045ab4e *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5398
diff changeset
  1815
f07c8045ab4e *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5398
diff changeset
  1816
%{  /* NOCONTEXT */
f07c8045ab4e *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5398
diff changeset
  1817
f07c8045ab4e *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5398
diff changeset
  1818
#ifdef F_PRIMITIVE
f07c8045ab4e *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5398
diff changeset
  1819
    INT f = __intVal(__INST(flags));
5644
8d0d817060ec *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5636
diff changeset
  1820
    INT nr = 0;
5405
f07c8045ab4e *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5398
diff changeset
  1821
f07c8045ab4e *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5398
diff changeset
  1822
    if (f & F_PRIMITIVE) {
5644
8d0d817060ec *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5636
diff changeset
  1823
	nr = __INST(code_);
5405
f07c8045ab4e *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5398
diff changeset
  1824
    }
f07c8045ab4e *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5398
diff changeset
  1825
    RETURN (nr);
f07c8045ab4e *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5398
diff changeset
  1826
#endif
f07c8045ab4e *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5398
diff changeset
  1827
%}.
f07c8045ab4e *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5398
diff changeset
  1828
    self primitiveFailed
f07c8045ab4e *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5398
diff changeset
  1829
f07c8045ab4e *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5398
diff changeset
  1830
f07c8045ab4e *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5398
diff changeset
  1831
f07c8045ab4e *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5398
diff changeset
  1832
!
f07c8045ab4e *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5398
diff changeset
  1833
f07c8045ab4e *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5398
diff changeset
  1834
setPrimitiveNumber:aNumber
f07c8045ab4e *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5398
diff changeset
  1835
    "for stx rel >= 5.x only:
f07c8045ab4e *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5398
diff changeset
  1836
     mark the method as having primitive code."
f07c8045ab4e *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5398
diff changeset
  1837
f07c8045ab4e *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5398
diff changeset
  1838
%{  /* NOCONTEXT */
f07c8045ab4e *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5398
diff changeset
  1839
f07c8045ab4e *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5398
diff changeset
  1840
#ifdef F_PRIMITIVE
f07c8045ab4e *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5398
diff changeset
  1841
    INT f = __intVal(__INST(flags));
f07c8045ab4e *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5398
diff changeset
  1842
f07c8045ab4e *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5398
diff changeset
  1843
    f |= F_PRIMITIVE;
f07c8045ab4e *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5398
diff changeset
  1844
    __INST(flags) = __MKSMALLINT(f);
f07c8045ab4e *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5398
diff changeset
  1845
    __INST(code_) = aNumber;
f07c8045ab4e *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5398
diff changeset
  1846
    RETURN (self);
f07c8045ab4e *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5398
diff changeset
  1847
#endif
f07c8045ab4e *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5398
diff changeset
  1848
%}.
f07c8045ab4e *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5398
diff changeset
  1849
    self primitiveFailed
f07c8045ab4e *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5398
diff changeset
  1850
f07c8045ab4e *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5398
diff changeset
  1851
f07c8045ab4e *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5398
diff changeset
  1852
f07c8045ab4e *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5398
diff changeset
  1853
!
f07c8045ab4e *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5398
diff changeset
  1854
1093
1e742016eea0 category rename / added access to RESOURCE and CALLED flags
Claus Gittinger <cg@exept.de>
parents: 1087
diff changeset
  1855
setResourceFlag
1e742016eea0 category rename / added access to RESOURCE and CALLED flags
Claus Gittinger <cg@exept.de>
parents: 1087
diff changeset
  1856
    "mark the method as having a <resource> definition in its
1e742016eea0 category rename / added access to RESOURCE and CALLED flags
Claus Gittinger <cg@exept.de>
parents: 1087
diff changeset
  1857
     source. 
1e742016eea0 category rename / added access to RESOURCE and CALLED flags
Claus Gittinger <cg@exept.de>
parents: 1087
diff changeset
  1858
     These resource definitions were found in ST-80 methods, and are
1e742016eea0 category rename / added access to RESOURCE and CALLED flags
Claus Gittinger <cg@exept.de>
parents: 1087
diff changeset
  1859
     currently not supported by ST/X (except for remembering this flag).
1e742016eea0 category rename / added access to RESOURCE and CALLED flags
Claus Gittinger <cg@exept.de>
parents: 1087
diff changeset
  1860
     It can be used to find resource-flagged methods quicker."
1e742016eea0 category rename / added access to RESOURCE and CALLED flags
Claus Gittinger <cg@exept.de>
parents: 1087
diff changeset
  1861
1e742016eea0 category rename / added access to RESOURCE and CALLED flags
Claus Gittinger <cg@exept.de>
parents: 1087
diff changeset
  1862
%{  /* NOCONTEXT */
1e742016eea0 category rename / added access to RESOURCE and CALLED flags
Claus Gittinger <cg@exept.de>
parents: 1087
diff changeset
  1863
1e742016eea0 category rename / added access to RESOURCE and CALLED flags
Claus Gittinger <cg@exept.de>
parents: 1087
diff changeset
  1864
#ifdef F_RESOURCE
2868
772c890f907c alpha64
Claus Gittinger <cg@exept.de>
parents: 2826
diff changeset
  1865
    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
  1866
1e742016eea0 category rename / added access to RESOURCE and CALLED flags
Claus Gittinger <cg@exept.de>
parents: 1087
diff changeset
  1867
    f |= F_RESOURCE;
1133
961f2b095c22 underline cleanup
Claus Gittinger <cg@exept.de>
parents: 1103
diff changeset
  1868
    __INST(flags) = __MKSMALLINT(f);
1093
1e742016eea0 category rename / added access to RESOURCE and CALLED flags
Claus Gittinger <cg@exept.de>
parents: 1087
diff changeset
  1869
#endif
1e742016eea0 category rename / added access to RESOURCE and CALLED flags
Claus Gittinger <cg@exept.de>
parents: 1087
diff changeset
  1870
%}
1e742016eea0 category rename / added access to RESOURCE and CALLED flags
Claus Gittinger <cg@exept.de>
parents: 1087
diff changeset
  1871
! !
1e742016eea0 category rename / added access to RESOURCE and CALLED flags
Claus Gittinger <cg@exept.de>
parents: 1087
diff changeset
  1872
952
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
!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
  1874
2702
5d6f23d8ee18 more ST80 queries
Claus Gittinger <cg@exept.de>
parents: 2695
diff changeset
  1875
accessedInstVars
5d6f23d8ee18 more ST80 queries
Claus Gittinger <cg@exept.de>
parents: 2695
diff changeset
  1876
    "return a collection of instVarNames, which are accessed by
5d6f23d8ee18 more ST80 queries
Claus Gittinger <cg@exept.de>
parents: 2695
diff changeset
  1877
     the receiver method"
5d6f23d8ee18 more ST80 queries
Claus Gittinger <cg@exept.de>
parents: 2695
diff changeset
  1878
5d6f23d8ee18 more ST80 queries
Claus Gittinger <cg@exept.de>
parents: 2695
diff changeset
  1879
    |src parser|
5d6f23d8ee18 more ST80 queries
Claus Gittinger <cg@exept.de>
parents: 2695
diff changeset
  1880
5d6f23d8ee18 more ST80 queries
Claus Gittinger <cg@exept.de>
parents: 2695
diff changeset
  1881
    src := self source.
5d6f23d8ee18 more ST80 queries
Claus Gittinger <cg@exept.de>
parents: 2695
diff changeset
  1882
    src notNil ifTrue:[
3030
fc5d632d133f when compiling a lazy method, use the classes namespace
Claus Gittinger <cg@exept.de>
parents: 2979
diff changeset
  1883
	parser := Parser
fc5d632d133f when compiling a lazy method, use the classes namespace
Claus Gittinger <cg@exept.de>
parents: 2979
diff changeset
  1884
			parseMethod:src 
fc5d632d133f when compiling a lazy method, use the classes namespace
Claus Gittinger <cg@exept.de>
parents: 2979
diff changeset
  1885
			in:self containingClass 
fc5d632d133f when compiling a lazy method, use the classes namespace
Claus Gittinger <cg@exept.de>
parents: 2979
diff changeset
  1886
			ignoreErrors:true 
fc5d632d133f when compiling a lazy method, use the classes namespace
Claus Gittinger <cg@exept.de>
parents: 2979
diff changeset
  1887
			ignoreWarnings:true.
fc5d632d133f when compiling a lazy method, use the classes namespace
Claus Gittinger <cg@exept.de>
parents: 2979
diff changeset
  1888
fc5d632d133f when compiling a lazy method, use the classes namespace
Claus Gittinger <cg@exept.de>
parents: 2979
diff changeset
  1889
	(parser notNil and:[parser ~~ #Error]) ifTrue:[
fc5d632d133f when compiling a lazy method, use the classes namespace
Claus Gittinger <cg@exept.de>
parents: 2979
diff changeset
  1890
	    ^ parser usedInstVars
fc5d632d133f when compiling a lazy method, use the classes namespace
Claus Gittinger <cg@exept.de>
parents: 2979
diff changeset
  1891
	].
2702
5d6f23d8ee18 more ST80 queries
Claus Gittinger <cg@exept.de>
parents: 2695
diff changeset
  1892
    ].
5d6f23d8ee18 more ST80 queries
Claus Gittinger <cg@exept.de>
parents: 2695
diff changeset
  1893
    ^ #() "/ actually: unknown
5d6f23d8ee18 more ST80 queries
Claus Gittinger <cg@exept.de>
parents: 2695
diff changeset
  1894
5d6f23d8ee18 more ST80 queries
Claus Gittinger <cg@exept.de>
parents: 2695
diff changeset
  1895
    "Modified: 19.6.1997 / 17:54:09 / cg"
5d6f23d8ee18 more ST80 queries
Claus Gittinger <cg@exept.de>
parents: 2695
diff changeset
  1896
!
5d6f23d8ee18 more ST80 queries
Claus Gittinger <cg@exept.de>
parents: 2695
diff changeset
  1897
952
d600e08a5936 handle the case where a method has a sourceFileInfo, but the class has not
Claus Gittinger <cg@exept.de>
parents: 934
diff changeset
  1898
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
  1899
    "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
  1900
     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
  1901
d600e08a5936 handle the case where a method has a sourceFileInfo, but the class has not
Claus Gittinger <cg@exept.de>
parents: 934
diff changeset
  1902
    "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
  1903
1851
4accc9fafd19 change #who to return a proper object
Claus Gittinger <cg@exept.de>
parents: 1813
diff changeset
  1904
    |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
  1905
5704
aeeece3a93ef flush mclass, if no longer valid
Claus Gittinger <cg@exept.de>
parents: 5700
diff changeset
  1906
    mclass notNil ifTrue:[
aeeece3a93ef flush mclass, if no longer valid
Claus Gittinger <cg@exept.de>
parents: 5700
diff changeset
  1907
        "/ check if this (cached) info is still valid ...
aeeece3a93ef flush mclass, if no longer valid
Claus Gittinger <cg@exept.de>
parents: 5700
diff changeset
  1908
        (mclass methodDictionary includesIdentical:self) ifFalse:[
aeeece3a93ef flush mclass, if no longer valid
Claus Gittinger <cg@exept.de>
parents: 5700
diff changeset
  1909
            mclass := nil
aeeece3a93ef flush mclass, if no longer valid
Claus Gittinger <cg@exept.de>
parents: 5700
diff changeset
  1910
        ].
aeeece3a93ef flush mclass, if no longer valid
Claus Gittinger <cg@exept.de>
parents: 5700
diff changeset
  1911
        mclass notNil ifTrue:[
aeeece3a93ef flush mclass, if no longer valid
Claus Gittinger <cg@exept.de>
parents: 5700
diff changeset
  1912
            ^ mclass
aeeece3a93ef flush mclass, if no longer valid
Claus Gittinger <cg@exept.de>
parents: 5700
diff changeset
  1913
        ]
aeeece3a93ef flush mclass, if no longer valid
Claus Gittinger <cg@exept.de>
parents: 5700
diff changeset
  1914
    ].
5324
5c9959ce98af make use of mclass
Claus Gittinger <cg@exept.de>
parents: 5322
diff changeset
  1915
1851
4accc9fafd19 change #who to return a proper object
Claus Gittinger <cg@exept.de>
parents: 1813
diff changeset
  1916
    who := self who.
4accc9fafd19 change #who to return a proper object
Claus Gittinger <cg@exept.de>
parents: 1813
diff changeset
  1917
    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
  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
     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
  1920
    "
d600e08a5936 handle the case where a method has a sourceFileInfo, but the class has not
Claus Gittinger <cg@exept.de>
parents: 934
diff changeset
  1921
    ^ 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
  1922
d600e08a5936 handle the case where a method has a sourceFileInfo, but the class has not
Claus Gittinger <cg@exept.de>
parents: 934
diff changeset
  1923
    "
d600e08a5936 handle the case where a method has a sourceFileInfo, but the class has not
Claus Gittinger <cg@exept.de>
parents: 934
diff changeset
  1924
     |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
  1925
     m := Object compiledMethodAt:#at:.
1855
6a61275c5adf checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1851
diff changeset
  1926
     m containingClass   
6a61275c5adf checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1851
diff changeset
  1927
6a61275c5adf checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1851
diff changeset
  1928
     |m|
6a61275c5adf checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1851
diff changeset
  1929
     m := Object class compiledMethodAt:#version.
6a61275c5adf checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1851
diff changeset
  1930
     m 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
  1931
    "
1851
4accc9fafd19 change #who to return a proper object
Claus Gittinger <cg@exept.de>
parents: 1813
diff changeset
  1932
1855
6a61275c5adf checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1851
diff changeset
  1933
    "Modified: 1.11.1996 / 17:47:06 / 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
  1934
!
d600e08a5936 handle the case where a method has a sourceFileInfo, but the class has not
Claus Gittinger <cg@exept.de>
parents: 934
diff changeset
  1935
d600e08a5936 handle the case where a method has a sourceFileInfo, but the class has not
Claus Gittinger <cg@exept.de>
parents: 934
diff changeset
  1936
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
  1937
    "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
  1938
     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
  1939
d600e08a5936 handle the case where a method has a sourceFileInfo, but the class has not
Claus Gittinger <cg@exept.de>
parents: 934
diff changeset
  1940
    |src|
159
514c749165c3 *** empty log message ***
claus
parents: 142
diff changeset
  1941
2218
93c4cb83372a comment
Claus Gittinger <cg@exept.de>
parents: 2201
diff changeset
  1942
    "/ first a trivial reject, if the source does not
5534
bf00d9a2dfd5 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5530
diff changeset
  1943
    "/ contain a '% {' sequence
2218
93c4cb83372a comment
Claus Gittinger <cg@exept.de>
parents: 2201
diff changeset
  1944
952
d600e08a5936 handle the case where a method has a sourceFileInfo, but the class has not
Claus Gittinger <cg@exept.de>
parents: 934
diff changeset
  1945
    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
  1946
    src notNil ifTrue:[
5644
8d0d817060ec *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5636
diff changeset
  1947
	(src includesString:(String with:$% with:${) "<- no constant here - to avoid trouble with stupid scanners" ) ifFalse:[
8d0d817060ec *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5636
diff changeset
  1948
	    "/ cannot contain primitive code.
8d0d817060ec *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5636
diff changeset
  1949
	    ^ false
8d0d817060ec *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5636
diff changeset
  1950
	]
952
d600e08a5936 handle the case where a method has a sourceFileInfo, but the class has not
Claus Gittinger <cg@exept.de>
parents: 934
diff changeset
  1951
    ].
2218
93c4cb83372a comment
Claus Gittinger <cg@exept.de>
parents: 2201
diff changeset
  1952
93c4cb83372a comment
Claus Gittinger <cg@exept.de>
parents: 2201
diff changeset
  1953
    "/ ok; it may or may not ...
93c4cb83372a comment
Claus Gittinger <cg@exept.de>
parents: 2201
diff changeset
  1954
952
d600e08a5936 handle the case where a method has a sourceFileInfo, but the class has not
Claus Gittinger <cg@exept.de>
parents: 934
diff changeset
  1955
    ^ 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
  1956
d600e08a5936 handle the case where a method has a sourceFileInfo, but the class has not
Claus Gittinger <cg@exept.de>
parents: 934
diff changeset
  1957
    "
d600e08a5936 handle the case where a method has a sourceFileInfo, but the class has not
Claus Gittinger <cg@exept.de>
parents: 934
diff changeset
  1958
     (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
  1959
     (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
  1960
     (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
  1961
    "
159
514c749165c3 *** empty log message ***
claus
parents: 142
diff changeset
  1962
2218
93c4cb83372a comment
Claus Gittinger <cg@exept.de>
parents: 2201
diff changeset
  1963
    "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
  1964
!
d600e08a5936 handle the case where a method has a sourceFileInfo, but the class has not
Claus Gittinger <cg@exept.de>
parents: 934
diff changeset
  1965
1093
1e742016eea0 category rename / added access to RESOURCE and CALLED flags
Claus Gittinger <cg@exept.de>
parents: 1087
diff changeset
  1966
hasResource
1e742016eea0 category rename / added access to RESOURCE and CALLED flags
Claus Gittinger <cg@exept.de>
parents: 1087
diff changeset
  1967
    "return true if the method had a <resource> definition in its
1e742016eea0 category rename / added access to RESOURCE and CALLED flags
Claus Gittinger <cg@exept.de>
parents: 1087
diff changeset
  1968
     source. This was found in ST-80 methods, and currently not supported
1e742016eea0 category rename / added access to RESOURCE and CALLED flags
Claus Gittinger <cg@exept.de>
parents: 1087
diff changeset
  1969
     by ST/X (except for remembering this flag).
1e742016eea0 category rename / added access to RESOURCE and CALLED flags
Claus Gittinger <cg@exept.de>
parents: 1087
diff changeset
  1970
     It can be used to find resource-flagged methods quicker."
1e742016eea0 category rename / added access to RESOURCE and CALLED flags
Claus Gittinger <cg@exept.de>
parents: 1087
diff changeset
  1971
1e742016eea0 category rename / added access to RESOURCE and CALLED flags
Claus Gittinger <cg@exept.de>
parents: 1087
diff changeset
  1972
%{  /* NOCONTEXT */
1e742016eea0 category rename / added access to RESOURCE and CALLED flags
Claus Gittinger <cg@exept.de>
parents: 1087
diff changeset
  1973
1e742016eea0 category rename / added access to RESOURCE and CALLED flags
Claus Gittinger <cg@exept.de>
parents: 1087
diff changeset
  1974
#ifdef F_RESOURCE
1133
961f2b095c22 underline cleanup
Claus Gittinger <cg@exept.de>
parents: 1103
diff changeset
  1975
    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
  1976
#endif
1e742016eea0 category rename / added access to RESOURCE and CALLED flags
Claus Gittinger <cg@exept.de>
parents: 1087
diff changeset
  1977
%}.
1e742016eea0 category rename / added access to RESOURCE and CALLED flags
Claus Gittinger <cg@exept.de>
parents: 1087
diff changeset
  1978
    ^ false
1e742016eea0 category rename / added access to RESOURCE and CALLED flags
Claus Gittinger <cg@exept.de>
parents: 1087
diff changeset
  1979
1e742016eea0 category rename / added access to RESOURCE and CALLED flags
Claus Gittinger <cg@exept.de>
parents: 1087
diff changeset
  1980
1e742016eea0 category rename / added access to RESOURCE and CALLED flags
Claus Gittinger <cg@exept.de>
parents: 1087
diff changeset
  1981
!
1e742016eea0 category rename / added access to RESOURCE and CALLED flags
Claus Gittinger <cg@exept.de>
parents: 1087
diff changeset
  1982
2694
46ba8cbdc013 added #homeMethod for ST80 compatibility
Claus Gittinger <cg@exept.de>
parents: 2558
diff changeset
  1983
homeMethod
46ba8cbdc013 added #homeMethod for ST80 compatibility
Claus Gittinger <cg@exept.de>
parents: 2558
diff changeset
  1984
    "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
  1985
     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
  1986
     method."
46ba8cbdc013 added #homeMethod for ST80 compatibility
Claus Gittinger <cg@exept.de>
parents: 2558
diff changeset
  1987
46ba8cbdc013 added #homeMethod for ST80 compatibility
Claus Gittinger <cg@exept.de>
parents: 2558
diff changeset
  1988
    ^ self
46ba8cbdc013 added #homeMethod for ST80 compatibility
Claus Gittinger <cg@exept.de>
parents: 2558
diff changeset
  1989
46ba8cbdc013 added #homeMethod for ST80 compatibility
Claus Gittinger <cg@exept.de>
parents: 2558
diff changeset
  1990
    "Created: 19.6.1997 / 16:13:12 / cg"
46ba8cbdc013 added #homeMethod for ST80 compatibility
Claus Gittinger <cg@exept.de>
parents: 2558
diff changeset
  1991
!
46ba8cbdc013 added #homeMethod for ST80 compatibility
Claus Gittinger <cg@exept.de>
parents: 2558
diff changeset
  1992
952
d600e08a5936 handle the case where a method has a sourceFileInfo, but the class has not
Claus Gittinger <cg@exept.de>
parents: 934
diff changeset
  1993
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
  1994
    "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
  1995
     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
  1996
     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
  1997
     (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
  1998
2558
07e7d6fef46d removed unused var
Claus Gittinger <cg@exept.de>
parents: 2541
diff changeset
  1999
    |m myCode|
1873
3544a4a94a2a checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1870
diff changeset
  2000
3544a4a94a2a checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1870
diff changeset
  2001
    myCode := self code.
3544a4a94a2a checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1870
diff changeset
  2002
3544a4a94a2a checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1870
diff changeset
  2003
    m := self trapMethodForNumArgs:(self numArgs).
3544a4a94a2a checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1870
diff changeset
  2004
    (m notNil and:[self ~~ m]) ifTrue:[
3030
fc5d632d133f when compiling a lazy method, use the classes namespace
Claus Gittinger <cg@exept.de>
parents: 2979
diff changeset
  2005
	(myCode notNil and:[myCode = m code]) ifTrue:[^ true].
fc5d632d133f when compiling a lazy method, use the classes namespace
Claus Gittinger <cg@exept.de>
parents: 2979
diff changeset
  2006
	(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
  2007
    ].
159
514c749165c3 *** empty log message ***
claus
parents: 142
diff changeset
  2008
952
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
    m := Method compiledMethodAt:#uncompiledCodeObject.
1873
3544a4a94a2a checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1870
diff changeset
  2010
    (m notNil and:[self ~~ m]) ifTrue:[
3030
fc5d632d133f when compiling a lazy method, use the classes namespace
Claus Gittinger <cg@exept.de>
parents: 2979
diff changeset
  2011
	(myCode notNil and:[myCode = m code]) ifTrue:[^ true].
fc5d632d133f when compiling a lazy method, use the classes namespace
Claus Gittinger <cg@exept.de>
parents: 2979
diff changeset
  2012
	(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
  2013
    ].
1873
3544a4a94a2a checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1870
diff changeset
  2014
3544a4a94a2a checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1870
diff changeset
  2015
    m := Method compiledMethodAt:#unloadedCodeObject.
3544a4a94a2a checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1870
diff changeset
  2016
    (m notNil and:[self ~~ m]) ifTrue:[
3030
fc5d632d133f when compiling a lazy method, use the classes namespace
Claus Gittinger <cg@exept.de>
parents: 2979
diff changeset
  2017
	(myCode notNil and:[myCode = m code]) ifTrue:[^ true].
fc5d632d133f when compiling a lazy method, use the classes namespace
Claus Gittinger <cg@exept.de>
parents: 2979
diff changeset
  2018
	(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
  2019
    ].
1873
3544a4a94a2a checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1870
diff changeset
  2020
952
d600e08a5936 handle the case where a method has a sourceFileInfo, but the class has not
Claus Gittinger <cg@exept.de>
parents: 934
diff changeset
  2021
    ^ false
1194
628abcb5fbb6 moved some protocol from to upper levels
Claus Gittinger <cg@exept.de>
parents: 1190
diff changeset
  2022
1873
3544a4a94a2a checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1870
diff changeset
  2023
    "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
  2024
!
d600e08a5936 handle the case where a method has a sourceFileInfo, but the class has not
Claus Gittinger <cg@exept.de>
parents: 934
diff changeset
  2025
d600e08a5936 handle the case where a method has a sourceFileInfo, but the class has not
Claus Gittinger <cg@exept.de>
parents: 934
diff changeset
  2026
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
  2027
    "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
  2028
     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
  2029
d600e08a5936 handle the case where a method has a sourceFileInfo, but the class has not
Claus Gittinger <cg@exept.de>
parents: 934
diff changeset
  2030
    ^ 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
  2031
!
d600e08a5936 handle the case where a method has a sourceFileInfo, but the class has not
Claus Gittinger <cg@exept.de>
parents: 934
diff changeset
  2032
2695
79229a9ab2da added #mclass for ST80 compatibility
Claus Gittinger <cg@exept.de>
parents: 2694
diff changeset
  2033
mclass
79229a9ab2da added #mclass for ST80 compatibility
Claus Gittinger <cg@exept.de>
parents: 2694
diff changeset
  2034
    "return the class in which the receiver was compiled.
79229a9ab2da added #mclass for ST80 compatibility
Claus Gittinger <cg@exept.de>
parents: 2694
diff changeset
  2035
     Same as #containingClass, for ST80 compatibility."
79229a9ab2da added #mclass for ST80 compatibility
Claus Gittinger <cg@exept.de>
parents: 2694
diff changeset
  2036
79229a9ab2da added #mclass for ST80 compatibility
Claus Gittinger <cg@exept.de>
parents: 2694
diff changeset
  2037
    ^ self containingClass
79229a9ab2da added #mclass for ST80 compatibility
Claus Gittinger <cg@exept.de>
parents: 2694
diff changeset
  2038
79229a9ab2da added #mclass for ST80 compatibility
Claus Gittinger <cg@exept.de>
parents: 2694
diff changeset
  2039
    "Created: 19.6.1997 / 16:26:13 / cg"
79229a9ab2da added #mclass for ST80 compatibility
Claus Gittinger <cg@exept.de>
parents: 2694
diff changeset
  2040
!
79229a9ab2da added #mclass for ST80 compatibility
Claus Gittinger <cg@exept.de>
parents: 2694
diff changeset
  2041
5696
958a0643496d compatibility
Claus Gittinger <cg@exept.de>
parents: 5676
diff changeset
  2042
messages
958a0643496d compatibility
Claus Gittinger <cg@exept.de>
parents: 5676
diff changeset
  2043
    "return a collection of message-selectors, sent by this method."
958a0643496d compatibility
Claus Gittinger <cg@exept.de>
parents: 5676
diff changeset
  2044
958a0643496d compatibility
Claus Gittinger <cg@exept.de>
parents: 5676
diff changeset
  2045
    ^ self messagesSent
958a0643496d compatibility
Claus Gittinger <cg@exept.de>
parents: 5676
diff changeset
  2046
!
958a0643496d compatibility
Claus Gittinger <cg@exept.de>
parents: 5676
diff changeset
  2047
5584
b175797a8c4d #messagesDo: (VW compatibility)
Claus Gittinger <cg@exept.de>
parents: 5582
diff changeset
  2048
messagesDo:aBlock
b175797a8c4d #messagesDo: (VW compatibility)
Claus Gittinger <cg@exept.de>
parents: 5582
diff changeset
  2049
    "evaluate aBlock for each message-selector sent by this method.
b175797a8c4d #messagesDo: (VW compatibility)
Claus Gittinger <cg@exept.de>
parents: 5582
diff changeset
  2050
     Uses Parser to parse methods source and extract the names."
b175797a8c4d #messagesDo: (VW compatibility)
Claus Gittinger <cg@exept.de>
parents: 5582
diff changeset
  2051
b175797a8c4d #messagesDo: (VW compatibility)
Claus Gittinger <cg@exept.de>
parents: 5582
diff changeset
  2052
    ^ self messagesSent do:aBlock
b175797a8c4d #messagesDo: (VW compatibility)
Claus Gittinger <cg@exept.de>
parents: 5582
diff changeset
  2053
!
b175797a8c4d #messagesDo: (VW compatibility)
Claus Gittinger <cg@exept.de>
parents: 5582
diff changeset
  2054
5582
737d121ae7de *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5564
diff changeset
  2055
messagesSent
737d121ae7de *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5564
diff changeset
  2056
    "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
  2057
     Uses Parser to parse methods source and extract the names.
737d121ae7de *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5564
diff changeset
  2058
     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
  2059
5633
15b028ad5e03 #usedGlobals check was wrong sometimes
Claus Gittinger <cg@exept.de>
parents: 5584
diff changeset
  2060
    ^ self parse:#'parseMethodSilent:in:' with:self mclass return:#messagesSent or:#() 
5582
737d121ae7de *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5564
diff changeset
  2061
737d121ae7de *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5564
diff changeset
  2062
    "
737d121ae7de *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5564
diff changeset
  2063
     (Method compiledMethodAt:#printOn:) messagesSent
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
d600e08a5936 handle the case where a method has a sourceFileInfo, but the class has not
Claus Gittinger <cg@exept.de>
parents: 934
diff changeset
  2090
    |parser sourceString argNames varNames|
d600e08a5936 handle the case where a method has a sourceFileInfo, but the class has not
Claus Gittinger <cg@exept.de>
parents: 934
diff changeset
  2091
d600e08a5936 handle the case where a method has a sourceFileInfo, but the class has not
Claus Gittinger <cg@exept.de>
parents: 934
diff changeset
  2092
    sourceString := 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
  2093
    sourceString notNil ifTrue:[
d600e08a5936 handle the case where a method has a sourceFileInfo, but the class has not
Claus Gittinger <cg@exept.de>
parents: 934
diff changeset
  2094
	parser := Parser parseMethodArgAndVarSpecificationSilent:sourceString.
d600e08a5936 handle the case where a method has a sourceFileInfo, but the class has not
Claus Gittinger <cg@exept.de>
parents: 934
diff changeset
  2095
	(parser isNil or:[parser == #Error]) 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
  2096
	argNames := parser methodArgs.
d600e08a5936 handle the case where a method has a sourceFileInfo, but the class has not
Claus Gittinger <cg@exept.de>
parents: 934
diff changeset
  2097
	varNames := parser methodVars.
d600e08a5936 handle the case where a method has a sourceFileInfo, but the class has not
Claus Gittinger <cg@exept.de>
parents: 934
diff changeset
  2098
	argNames isNil ifTrue:[^ varNames].
d600e08a5936 handle the case where a method has a sourceFileInfo, but the class has not
Claus Gittinger <cg@exept.de>
parents: 934
diff changeset
  2099
	varNames isNil ifTrue:[^ argNames].
d600e08a5936 handle the case where a method has a sourceFileInfo, but the class has not
Claus Gittinger <cg@exept.de>
parents: 934
diff changeset
  2100
	^ (argNames , varNames)
159
514c749165c3 *** empty log message ***
claus
parents: 142
diff changeset
  2101
    ].
952
d600e08a5936 handle the case where a method has a sourceFileInfo, but the class has not
Claus Gittinger <cg@exept.de>
parents: 934
diff changeset
  2102
    ^ 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
  2103
159
514c749165c3 *** empty log message ***
claus
parents: 142
diff changeset
  2104
    "
952
d600e08a5936 handle the case where a method has a sourceFileInfo, but the class has not
Claus Gittinger <cg@exept.de>
parents: 934
diff changeset
  2105
     (Method compiledMethodAt:#printOn:) methodArgAndVarNames
159
514c749165c3 *** empty log message ***
claus
parents: 142
diff changeset
  2106
    "
952
d600e08a5936 handle the case where a method has a sourceFileInfo, but the class has not
Claus Gittinger <cg@exept.de>
parents: 934
diff changeset
  2107
!
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
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
  2110
    "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
  2111
     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
  2112
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
    ^ 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
  2114
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
     (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
  2117
    "
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
    "Modified: 31.10.1995 / 14:36:46 / cg"
872
af04035b443d binary class storage support
Claus Gittinger <cg@exept.de>
parents: 829
diff changeset
  2120
!
af04035b443d binary class storage support
Claus Gittinger <cg@exept.de>
parents: 829
diff changeset
  2121
952
d600e08a5936 handle the case where a method has a sourceFileInfo, but the class has not
Claus Gittinger <cg@exept.de>
parents: 934
diff changeset
  2122
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
  2123
    "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
  2124
     This is a somewhat stupid implementation."
872
af04035b443d binary class storage support
Claus Gittinger <cg@exept.de>
parents: 829
diff changeset
  2125
952
d600e08a5936 handle the case where a method has a sourceFileInfo, but the class has not
Claus Gittinger <cg@exept.de>
parents: 934
diff changeset
  2126
    |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
  2127
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
    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
  2129
    (text size < 2) ifTrue:[^nil].
872
af04035b443d binary class storage support
Claus Gittinger <cg@exept.de>
parents: 829
diff changeset
  2130
952
d600e08a5936 handle the case where a method has a sourceFileInfo, but the class has not
Claus Gittinger <cg@exept.de>
parents: 934
diff changeset
  2131
    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
  2132
    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
  2133
    (nQuote == 2) ifTrue:[
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
	qIndex := line indexOf:(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
  2135
	qIndex2 := line indexOf:(Character doubleQuote) startingAt:(qIndex + 1).
d600e08a5936 handle the case where a method has a sourceFileInfo, but the class has not
Claus Gittinger <cg@exept.de>
parents: 934
diff changeset
  2136
	^ line copyFrom:(qIndex + 1) to:(qIndex2 - 1)
872
af04035b443d binary class storage support
Claus Gittinger <cg@exept.de>
parents: 829
diff changeset
  2137
    ].
952
d600e08a5936 handle the case where a method has a sourceFileInfo, but the class has not
Claus Gittinger <cg@exept.de>
parents: 934
diff changeset
  2138
    (nQuote == 1) ifTrue:[
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
	qIndex := line indexOf:(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
  2140
	comment := line copyFrom:(qIndex + 1).
d600e08a5936 handle the case where a method has a sourceFileInfo, but the class has not
Claus Gittinger <cg@exept.de>
parents: 934
diff changeset
  2141
d600e08a5936 handle the case where a method has a sourceFileInfo, but the class has not
Claus Gittinger <cg@exept.de>
parents: 934
diff changeset
  2142
	index := 3.
d600e08a5936 handle the case where a method has a sourceFileInfo, but the class has not
Claus Gittinger <cg@exept.de>
parents: 934
diff changeset
  2143
	line := text at:index.
d600e08a5936 handle the case where a method has a sourceFileInfo, but the class has not
Claus Gittinger <cg@exept.de>
parents: 934
diff changeset
  2144
	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
  2145
	[nQuote ~~ 1] whileTrue:[
d600e08a5936 handle the case where a method has a sourceFileInfo, but the class has not
Claus Gittinger <cg@exept.de>
parents: 934
diff changeset
  2146
	    comment := comment , Character cr asString , line withoutSpaces.
d600e08a5936 handle the case where a method has a sourceFileInfo, but the class has not
Claus Gittinger <cg@exept.de>
parents: 934
diff changeset
  2147
	    index := index + 1.
d600e08a5936 handle the case where a method has a sourceFileInfo, but the class has not
Claus Gittinger <cg@exept.de>
parents: 934
diff changeset
  2148
	    line := text at:index.
d600e08a5936 handle the case where a method has a sourceFileInfo, but the class has not
Claus Gittinger <cg@exept.de>
parents: 934
diff changeset
  2149
	    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
  2150
	].
d600e08a5936 handle the case where a method has a sourceFileInfo, but the class has not
Claus Gittinger <cg@exept.de>
parents: 934
diff changeset
  2151
	qIndex := line indexOf:(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
  2152
	^ comment , Character cr asString , (line copyTo:(qIndex - 1)) withoutSpaces
d600e08a5936 handle the case where a method has a sourceFileInfo, but the class has not
Claus Gittinger <cg@exept.de>
parents: 934
diff changeset
  2153
    ].
d600e08a5936 handle the case where a method has a sourceFileInfo, but the class has not
Claus Gittinger <cg@exept.de>
parents: 934
diff changeset
  2154
    ^ 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
  2155
d600e08a5936 handle the case where a method has a sourceFileInfo, but the class has not
Claus Gittinger <cg@exept.de>
parents: 934
diff changeset
  2156
    "
d600e08a5936 handle the case where a method has a sourceFileInfo, but the class has not
Claus Gittinger <cg@exept.de>
parents: 934
diff changeset
  2157
     (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
  2158
    "
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
!
872
af04035b443d binary class storage support
Claus Gittinger <cg@exept.de>
parents: 829
diff changeset
  2160
952
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
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
  2162
    "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
  2163
     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
  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
    ^ 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
  2166
d600e08a5936 handle the case where a method has a sourceFileInfo, but the class has not
Claus Gittinger <cg@exept.de>
parents: 934
diff changeset
  2167
    "
d600e08a5936 handle the case where a method has a sourceFileInfo, but the class has not
Claus Gittinger <cg@exept.de>
parents: 934
diff changeset
  2168
     (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
  2169
    "
d600e08a5936 handle the case where a method has a sourceFileInfo, but the class has not
Claus Gittinger <cg@exept.de>
parents: 934
diff changeset
  2170
d600e08a5936 handle the case where a method has a sourceFileInfo, but the class has not
Claus Gittinger <cg@exept.de>
parents: 934
diff changeset
  2171
    "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
  2172
!
d600e08a5936 handle the case where a method has a sourceFileInfo, but the class has not
Claus Gittinger <cg@exept.de>
parents: 934
diff changeset
  2173
d600e08a5936 handle the case where a method has a sourceFileInfo, but the class has not
Claus Gittinger <cg@exept.de>
parents: 934
diff changeset
  2174
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
  2175
    "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
  2176
     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
  2177
     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
  2178
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
    |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
  2180
952
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
    HistoryManager isNil ifTrue:[^ nil].
1873
3544a4a94a2a checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1870
diff changeset
  2182
952
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
    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
  2184
    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
  2185
    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
  2186
    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
  2187
    histLine := list last.
1873
3544a4a94a2a checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1870
diff changeset
  2188
    ^ AbsoluteTime 
3030
fc5d632d133f when compiling a lazy method, use the classes namespace
Claus Gittinger <cg@exept.de>
parents: 2979
diff changeset
  2189
	fromDate:histLine date 
fc5d632d133f when compiling a lazy method, use the classes namespace
Claus Gittinger <cg@exept.de>
parents: 2979
diff changeset
  2190
	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
  2191
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
    "
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
     (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
  2194
     (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
  2195
    "
d600e08a5936 handle the case where a method has a sourceFileInfo, but the class has not
Claus Gittinger <cg@exept.de>
parents: 934
diff changeset
  2196
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
    "Modified: 8.9.1995 / 15:08:22 / claus"
1873
3544a4a94a2a checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1870
diff changeset
  2198
    "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
  2199
!
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
3845
729fda604d59 added #name (for javaMethod compatibility)
Claus Gittinger <cg@exept.de>
parents: 3697
diff changeset
  2201
name
729fda604d59 added #name (for javaMethod compatibility)
Claus Gittinger <cg@exept.de>
parents: 3697
diff changeset
  2202
    "for compatibility with javaMethods"
729fda604d59 added #name (for javaMethod compatibility)
Claus Gittinger <cg@exept.de>
parents: 3697
diff changeset
  2203
729fda604d59 added #name (for javaMethod compatibility)
Claus Gittinger <cg@exept.de>
parents: 3697
diff changeset
  2204
    ^ self selector
729fda604d59 added #name (for javaMethod compatibility)
Claus Gittinger <cg@exept.de>
parents: 3697
diff changeset
  2205
729fda604d59 added #name (for javaMethod compatibility)
Claus Gittinger <cg@exept.de>
parents: 3697
diff changeset
  2206
    "Created: / 9.11.1998 / 06:15:08 / cg"
729fda604d59 added #name (for javaMethod compatibility)
Claus Gittinger <cg@exept.de>
parents: 3697
diff changeset
  2207
!
729fda604d59 added #name (for javaMethod compatibility)
Claus Gittinger <cg@exept.de>
parents: 3697
diff changeset
  2208
952
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
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
  2210
    "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
  2211
     Get the source, let parser parse it using parseSelector,
1873
3544a4a94a2a checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1870
diff changeset
  2212
     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
  2213
5633
15b028ad5e03 #usedGlobals check was wrong sometimes
Claus Gittinger <cg@exept.de>
parents: 5584
diff changeset
  2214
    ^ self parse:parseSelector with:nil return:accessSelector or:valueIfNoSource
15b028ad5e03 #usedGlobals check was wrong sometimes
Claus Gittinger <cg@exept.de>
parents: 5584
diff changeset
  2215
15b028ad5e03 #usedGlobals check was wrong sometimes
Claus Gittinger <cg@exept.de>
parents: 5584
diff changeset
  2216
    "
15b028ad5e03 #usedGlobals check was wrong sometimes
Claus Gittinger <cg@exept.de>
parents: 5584
diff changeset
  2217
     (Method compiledMethodAt:#parse:return:or:)
5644
8d0d817060ec *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5636
diff changeset
  2218
	parse:#'parseMethodSilent:' return:#sentMessages or:#() 
5633
15b028ad5e03 #usedGlobals check was wrong sometimes
Claus Gittinger <cg@exept.de>
parents: 5584
diff changeset
  2219
    "
15b028ad5e03 #usedGlobals check was wrong sometimes
Claus Gittinger <cg@exept.de>
parents: 5584
diff changeset
  2220
!
15b028ad5e03 #usedGlobals check was wrong sometimes
Claus Gittinger <cg@exept.de>
parents: 5584
diff changeset
  2221
15b028ad5e03 #usedGlobals check was wrong sometimes
Claus Gittinger <cg@exept.de>
parents: 5584
diff changeset
  2222
parse:parseSelector with:arg2 return:accessSelector or:valueIfNoSource 
15b028ad5e03 #usedGlobals check was wrong sometimes
Claus Gittinger <cg@exept.de>
parents: 5584
diff changeset
  2223
    "helper for methodArgNames, methodVarNames etc.
15b028ad5e03 #usedGlobals check was wrong sometimes
Claus Gittinger <cg@exept.de>
parents: 5584
diff changeset
  2224
     Get the source, let parser parse it using parseSelector,
15b028ad5e03 #usedGlobals check was wrong sometimes
Claus Gittinger <cg@exept.de>
parents: 5584
diff changeset
  2225
     return parser-info using accessSelector"
15b028ad5e03 #usedGlobals check was wrong sometimes
Claus Gittinger <cg@exept.de>
parents: 5584
diff changeset
  2226
952
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
    |parser sourceString|
872
af04035b443d binary class storage support
Claus Gittinger <cg@exept.de>
parents: 829
diff changeset
  2228
952
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
    sourceString := 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
  2230
    sourceString notNil ifTrue:[
5644
8d0d817060ec *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5636
diff changeset
  2231
	parseSelector numArgs == 2 ifTrue:[
8d0d817060ec *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5636
diff changeset
  2232
	    parser := Parser perform:parseSelector with:sourceString with:arg2.
8d0d817060ec *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5636
diff changeset
  2233
	] ifFalse:[
8d0d817060ec *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5636
diff changeset
  2234
	    parser := Parser perform:parseSelector with:sourceString.
8d0d817060ec *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5636
diff changeset
  2235
	].
8d0d817060ec *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5636
diff changeset
  2236
	(parser isNil or:[parser == #Error]) ifTrue:[^ valueIfNoSource].
8d0d817060ec *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5636
diff changeset
  2237
	^ 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
  2238
    ].
1873
3544a4a94a2a checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1870
diff changeset
  2239
    ^ valueIfNoSource
3544a4a94a2a checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1870
diff changeset
  2240
5500
8bc3b30296ae more queries (sentMessages ...)
Claus Gittinger <cg@exept.de>
parents: 5406
diff changeset
  2241
    "
8bc3b30296ae more queries (sentMessages ...)
Claus Gittinger <cg@exept.de>
parents: 5406
diff changeset
  2242
     (Method compiledMethodAt:#parse:return:or:)
5644
8d0d817060ec *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5636
diff changeset
  2243
	parse:#'parseMethodSilent:' return:#sentMessages or:#() 
5500
8bc3b30296ae more queries (sentMessages ...)
Claus Gittinger <cg@exept.de>
parents: 5406
diff changeset
  2244
    "
952
d600e08a5936 handle the case where a method has a sourceFileInfo, but the class has not
Claus Gittinger <cg@exept.de>
parents: 934
diff changeset
  2245
!
159
514c749165c3 *** empty log message ***
claus
parents: 142
diff changeset
  2246
5721
5f97733ff519 methods now send change-notifications when the category changes
Claus Gittinger <cg@exept.de>
parents: 5704
diff changeset
  2247
parseResources
5f97733ff519 methods now send change-notifications when the category changes
Claus Gittinger <cg@exept.de>
parents: 5704
diff changeset
  2248
    "return the methods resource spec; either nil, a single symbol
5f97733ff519 methods now send change-notifications when the category changes
Claus Gittinger <cg@exept.de>
parents: 5704
diff changeset
  2249
     or a collection of symbols."
5f97733ff519 methods now send change-notifications when the category changes
Claus Gittinger <cg@exept.de>
parents: 5704
diff changeset
  2250
5f97733ff519 methods now send change-notifications when the category changes
Claus Gittinger <cg@exept.de>
parents: 5704
diff changeset
  2251
    |src parser|
5f97733ff519 methods now send change-notifications when the category changes
Claus Gittinger <cg@exept.de>
parents: 5704
diff changeset
  2252
5f97733ff519 methods now send change-notifications when the category changes
Claus Gittinger <cg@exept.de>
parents: 5704
diff changeset
  2253
    src := self source.
5f97733ff519 methods now send change-notifications when the category changes
Claus Gittinger <cg@exept.de>
parents: 5704
diff changeset
  2254
    src isNil ifTrue:[
5f97733ff519 methods now send change-notifications when the category changes
Claus Gittinger <cg@exept.de>
parents: 5704
diff changeset
  2255
        ^ nil "/ actually: dont know
5f97733ff519 methods now send change-notifications when the category changes
Claus Gittinger <cg@exept.de>
parents: 5704
diff changeset
  2256
    ].
5f97733ff519 methods now send change-notifications when the category changes
Claus Gittinger <cg@exept.de>
parents: 5704
diff changeset
  2257
5f97733ff519 methods now send change-notifications when the category changes
Claus Gittinger <cg@exept.de>
parents: 5704
diff changeset
  2258
    (src findString:'resource:') == 0 ifTrue:[
5f97733ff519 methods now send change-notifications when the category changes
Claus Gittinger <cg@exept.de>
parents: 5704
diff changeset
  2259
        ^ nil "/ actually: error
5f97733ff519 methods now send change-notifications when the category changes
Claus Gittinger <cg@exept.de>
parents: 5704
diff changeset
  2260
    ].
5f97733ff519 methods now send change-notifications when the category changes
Claus Gittinger <cg@exept.de>
parents: 5704
diff changeset
  2261
    "/ no need to parse all - only interested in resource-info
5f97733ff519 methods now send change-notifications when the category changes
Claus Gittinger <cg@exept.de>
parents: 5704
diff changeset
  2262
    parser := Parser parseMethodArgAndVarSpecificationSilent:src in:nil.
5f97733ff519 methods now send change-notifications when the category changes
Claus Gittinger <cg@exept.de>
parents: 5704
diff changeset
  2263
    parser isNil ifTrue:[
5f97733ff519 methods now send change-notifications when the category changes
Claus Gittinger <cg@exept.de>
parents: 5704
diff changeset
  2264
        ^ nil "/ actually error
5f97733ff519 methods now send change-notifications when the category changes
Claus Gittinger <cg@exept.de>
parents: 5704
diff changeset
  2265
    ].
5f97733ff519 methods now send change-notifications when the category changes
Claus Gittinger <cg@exept.de>
parents: 5704
diff changeset
  2266
    ^ parser primitiveResources.
5f97733ff519 methods now send change-notifications when the category changes
Claus Gittinger <cg@exept.de>
parents: 5704
diff changeset
  2267
!
5f97733ff519 methods now send change-notifications when the category changes
Claus Gittinger <cg@exept.de>
parents: 5704
diff changeset
  2268
1923
97b099fef985 optionally keep a history of changed methods
Claus Gittinger <cg@exept.de>
parents: 1873
diff changeset
  2269
previousVersion
5339
c922450b57b5 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5324
diff changeset
  2270
    |history entry|
1923
97b099fef985 optionally keep a history of changed methods
Claus Gittinger <cg@exept.de>
parents: 1873
diff changeset
  2271
1925
f1c8c6374af8 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1923
diff changeset
  2272
    history := Class methodHistory.
1923
97b099fef985 optionally keep a history of changed methods
Claus Gittinger <cg@exept.de>
parents: 1873
diff changeset
  2273
    history isNil ifTrue:[^ nil].
5339
c922450b57b5 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5324
diff changeset
  2274
c922450b57b5 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5324
diff changeset
  2275
    entry := history detect:[:entry | |type old new|
5644
8d0d817060ec *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5636
diff changeset
  2276
				    type := entry first.
8d0d817060ec *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5636
diff changeset
  2277
				    type == #methodChange ifTrue:[
8d0d817060ec *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5636
diff changeset
  2278
					old := entry second.
8d0d817060ec *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5636
diff changeset
  2279
					new := entry third.
8d0d817060ec *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5636
diff changeset
  2280
					new == self
8d0d817060ec *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5636
diff changeset
  2281
				    ] ifFalse:[
8d0d817060ec *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5636
diff changeset
  2282
					false
8d0d817060ec *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5636
diff changeset
  2283
				    ]
8d0d817060ec *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5636
diff changeset
  2284
			     ] 
8d0d817060ec *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5636
diff changeset
  2285
		     ifNone:nil.
5339
c922450b57b5 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5324
diff changeset
  2286
    entry isNil ifTrue:[^nil].
c922450b57b5 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5324
diff changeset
  2287
    ^ entry second.
c922450b57b5 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5324
diff changeset
  2288
"/    ^ history at:self ifAbsent:nil
1923
97b099fef985 optionally keep a history of changed methods
Claus Gittinger <cg@exept.de>
parents: 1873
diff changeset
  2289
1925
f1c8c6374af8 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 1923
diff changeset
  2290
    "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
  2291
!
97b099fef985 optionally keep a history of changed methods
Claus Gittinger <cg@exept.de>
parents: 1873
diff changeset
  2292
5564
0f513f04c50f #readsFields: and #writesField: for st80 compatibility
Claus Gittinger <cg@exept.de>
parents: 5562
diff changeset
  2293
readsField:instVarIndex
0f513f04c50f #readsFields: and #writesField: for st80 compatibility
Claus Gittinger <cg@exept.de>
parents: 5562
diff changeset
  2294
    "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
  2295
     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
  2296
0f513f04c50f #readsFields: and #writesField: for st80 compatibility
Claus Gittinger <cg@exept.de>
parents: 5562
diff changeset
  2297
    |varName readInstVars|
0f513f04c50f #readsFields: and #writesField: for st80 compatibility
Claus Gittinger <cg@exept.de>
parents: 5562
diff changeset
  2298
0f513f04c50f #readsFields: and #writesField: for st80 compatibility
Claus Gittinger <cg@exept.de>
parents: 5562
diff changeset
  2299
    varName := (self mclass allInstVarNames) at:instVarIndex.
5636
eab6a71fb3d0 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5634
diff changeset
  2300
    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
  2301
    ^ readInstVars includes:varName.
0f513f04c50f #readsFields: and #writesField: for st80 compatibility
Claus Gittinger <cg@exept.de>
parents: 5562
diff changeset
  2302
!
0f513f04c50f #readsFields: and #writesField: for st80 compatibility
Claus Gittinger <cg@exept.de>
parents: 5562
diff changeset
  2303
3052
f384e7082ee9 more resource stuff (VW compatibility)
Claus Gittinger <cg@exept.de>
parents: 3030
diff changeset
  2304
resourceType
f384e7082ee9 more resource stuff (VW compatibility)
Claus Gittinger <cg@exept.de>
parents: 3030
diff changeset
  2305
    "ST-80 compatibility:
f384e7082ee9 more resource stuff (VW compatibility)
Claus Gittinger <cg@exept.de>
parents: 3030
diff changeset
  2306
     return the methods first resource specs key; either nil, 
3243
b67d9d90ea1f method #resourceType extented for h'Lists and tabLists
tz
parents: 3224
diff changeset
  2307
     or a single symbol containing in Method>>resourceTypes."
3052
f384e7082ee9 more resource stuff (VW compatibility)
Claus Gittinger <cg@exept.de>
parents: 3030
diff changeset
  2308
3387
dbe1b3cf7b83 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 3372
diff changeset
  2309
    |resources|
dbe1b3cf7b83 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 3372
diff changeset
  2310
dbe1b3cf7b83 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 3372
diff changeset
  2311
    (resources := self resources) notNil ifTrue:[
5322
411b6c0f7250 renamed sone structures;
Claus Gittinger <cg@exept.de>
parents: 5294
diff changeset
  2312
	resources keysAndValuesDo:[:key :val|
411b6c0f7250 renamed sone structures;
Claus Gittinger <cg@exept.de>
parents: 5294
diff changeset
  2313
	    (self class resourceTypes includes:key) ifTrue:[^key]
411b6c0f7250 renamed sone structures;
Claus Gittinger <cg@exept.de>
parents: 5294
diff changeset
  2314
	].
3341
c5773eb96bd2 resource icons moved to class BrowserView
tz
parents: 3297
diff changeset
  2315
    ].
3387
dbe1b3cf7b83 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 3372
diff changeset
  2316
    ^ nil
dbe1b3cf7b83 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 3372
diff changeset
  2317
dbe1b3cf7b83 checkin from browser
Claus Gittinger <cg@exept.de>
parents: 3372
diff changeset
  2318
    "Modified: / 22.4.1998 / 10:26:31 / cg"
3052
f384e7082ee9 more resource stuff (VW compatibility)
Claus Gittinger <cg@exept.de>
parents: 3030
diff changeset
  2319
!
f384e7082ee9 more resource stuff (VW compatibility)
Claus Gittinger <cg@exept.de>
parents: 3030
diff changeset
  2320
f384e7082ee9 more resource stuff (VW compatibility)
Claus Gittinger <cg@exept.de>
parents: 3030
diff changeset
  2321
resources
f384e7082ee9 more resource stuff (VW compatibility)
Claus Gittinger <cg@exept.de>
parents: 3030
diff changeset
  2322
    "return the methods resource spec; either nil, a single symbol
f384e7082ee9 more resource stuff (VW compatibility)
Claus Gittinger <cg@exept.de>
parents: 3030
diff changeset
  2323
     or a collection of symbols."
f384e7082ee9 more resource stuff (VW compatibility)
Claus Gittinger <cg@exept.de>
parents: 3030
diff changeset
  2324
f384e7082ee9 more resource stuff (VW compatibility)
Claus Gittinger <cg@exept.de>
parents: 3030
diff changeset
  2325
    |src parser|
f384e7082ee9 more resource stuff (VW compatibility)
Claus Gittinger <cg@exept.de>
parents: 3030
diff changeset
  2326
f384e7082ee9 more resource stuff (VW compatibility)
Claus Gittinger <cg@exept.de>
parents: 3030
diff changeset
  2327
    self hasResource ifFalse:[^ nil].
5721
5f97733ff519 methods now send change-notifications when the category changes
Claus Gittinger <cg@exept.de>
parents: 5704
diff changeset
  2328
    ^ self parseResources.
5f97733ff519 methods now send change-notifications when the category changes
Claus Gittinger <cg@exept.de>
parents: 5704
diff changeset
  2329
5f97733ff519 methods now send change-notifications when the category changes
Claus Gittinger <cg@exept.de>
parents: 5704
diff changeset
  2330
"/    src := self source.
5f97733ff519 methods now send change-notifications when the category changes
Claus Gittinger <cg@exept.de>
parents: 5704
diff changeset
  2331
"/    src isNil ifTrue:[
5f97733ff519 methods now send change-notifications when the category changes
Claus Gittinger <cg@exept.de>
parents: 5704
diff changeset
  2332
"/        ^ nil "/ actually: dont know
5f97733ff519 methods now send change-notifications when the category changes
Claus Gittinger <cg@exept.de>
parents: 5704
diff changeset
  2333
"/    ].
5f97733ff519 methods now send change-notifications when the category changes
Claus Gittinger <cg@exept.de>
parents: 5704
diff changeset
  2334
"/
5f97733ff519 methods now send change-notifications when the category changes
Claus Gittinger <cg@exept.de>
parents: 5704
diff changeset
  2335
"/    (src findString:'resource:') == 0 ifTrue:[
5f97733ff519 methods now send change-notifications when the category changes
Claus Gittinger <cg@exept.de>
parents: 5704
diff changeset
  2336
"/        ^ nil "/ actually: error
5f97733ff519 methods now send change-notifications when the category changes
Claus Gittinger <cg@exept.de>
parents: 5704
diff changeset
  2337
"/    ].
5f97733ff519 methods now send change-notifications when the category changes
Claus Gittinger <cg@exept.de>
parents: 5704
diff changeset
  2338
"/    "/ no need to parse all - only interested in resource-info
5f97733ff519 methods now send change-notifications when the category changes
Claus Gittinger <cg@exept.de>
parents: 5704
diff changeset
  2339
"/    parser := Parser parseMethodArgAndVarSpecificationSilent:src in:nil.
5f97733ff519 methods now send change-notifications when the category changes
Claus Gittinger <cg@exept.de>
parents: 5704
diff changeset
  2340
"/"/    parser := Parser
5f97733ff519 methods now send change-notifications when the category changes
Claus Gittinger <cg@exept.de>
parents: 5704
diff changeset
  2341
"/"/                    parseMethod:src 
5f97733ff519 methods now send change-notifications when the category changes
Claus Gittinger <cg@exept.de>
parents: 5704
diff changeset
  2342
"/"/                    in:nil 
5f97733ff519 methods now send change-notifications when the category changes
Claus Gittinger <cg@exept.de>
parents: 5704
diff changeset
  2343
"/"/                    ignoreErrors:true 
5f97733ff519 methods now send change-notifications when the category changes
Claus Gittinger <cg@exept.de>
parents: 5704
diff changeset
  2344
"/"/                    ignoreWarnings:true.
5f97733ff519 methods now send change-notifications when the category changes
Claus Gittinger <cg@exept.de>
parents: 5704
diff changeset
  2345
"/    parser isNil ifTrue:[
5f97733ff519 methods now send change-notifications when the category changes
Claus Gittinger <cg@exept.de>
parents: 5704
diff changeset
  2346
"/        ^ nil "/ actually error
5f97733ff519 methods now send change-notifications when the category changes
Claus Gittinger <cg@exept.de>
parents: 5704
diff changeset
  2347
"/    ].
5f97733ff519 methods now send change-notifications when the category changes
Claus Gittinger <cg@exept.de>
parents: 5704
diff changeset
  2348
"/    ^ parser primitiveResources.
5f97733ff519 methods now send change-notifications when the category changes
Claus Gittinger <cg@exept.de>
parents: 5704
diff changeset
  2349
"/
5f97733ff519 methods now send change-notifications when the category changes
Claus Gittinger <cg@exept.de>
parents: 5704
diff changeset
  2350
"/    "Created: / 26.10.1997 / 16:23:18 / cg"
3052
f384e7082ee9 more resource stuff (VW compatibility)
Claus Gittinger <cg@exept.de>
parents: 3030
diff changeset
  2351
!
f384e7082ee9 more resource stuff (VW compatibility)
Claus Gittinger <cg@exept.de>
parents: 3030
diff changeset
  2352
952
d600e08a5936 handle the case where a method has a sourceFileInfo, but the class has not
Claus Gittinger <cg@exept.de>
parents: 934
diff changeset
  2353
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
  2354
    "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
  2355
     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
  2356
     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
  2357
d600e08a5936 handle the case where a method has a sourceFileInfo, but the class has not
Claus Gittinger <cg@exept.de>
parents: 934
diff changeset
  2358
    "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
  2359
1851
4accc9fafd19 change #who to return a proper object
Claus Gittinger <cg@exept.de>
parents: 1813
diff changeset
  2360
    |who|
68
59faa75185ba *** empty log message ***
claus
parents: 56
diff changeset
  2361
1851
4accc9fafd19 change #who to return a proper object
Claus Gittinger <cg@exept.de>
parents: 1813
diff changeset
  2362
    who := self who.
4accc9fafd19 change #who to return a proper object
Claus Gittinger <cg@exept.de>
parents: 1813
diff changeset
  2363
    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
  2364
    "
d600e08a5936 handle the case where a method has a sourceFileInfo, but the class has not
Claus Gittinger <cg@exept.de>
parents: 934
diff changeset
  2365
     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
  2366
    "
d600e08a5936 handle the case where a method has a sourceFileInfo, but the class has not
Claus Gittinger <cg@exept.de>
parents: 934
diff changeset
  2367
    ^ 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
  2368
d600e08a5936 handle the case where a method has a sourceFileInfo, but the class has not
Claus Gittinger <cg@exept.de>
parents: 934
diff changeset
  2369
    "
d600e08a5936 handle the case where a method has a sourceFileInfo, but the class has not
Claus Gittinger <cg@exept.de>
parents: 934
diff changeset
  2370
     |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
  2371
     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
  2372
     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
  2373
    "
1851
4accc9fafd19 change #who to return a proper object
Claus Gittinger <cg@exept.de>
parents: 1813
diff changeset
  2374
4accc9fafd19 change #who to return a proper object
Claus Gittinger <cg@exept.de>
parents: 1813
diff changeset
  2375
    "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
  2376
!
68
59faa75185ba *** empty log message ***
claus
parents: 56
diff changeset
  2377
5534
bf00d9a2dfd5 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5530
diff changeset
  2378
sends:aSelectorSymbol
bf00d9a2dfd5 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5530
diff changeset
  2379
    "return true, if this method contains a message-send
bf00d9a2dfd5 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5530
diff changeset
  2380
     with aSelectorSymbol as selector."
bf00d9a2dfd5 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5530
diff changeset
  2381
bf00d9a2dfd5 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5530
diff changeset
  2382
    (self referencesLiteral:aSelectorSymbol) ifTrue:[
5644
8d0d817060ec *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5636
diff changeset
  2383
	^ self messagesSent includesIdentical:aSelectorSymbol
5534
bf00d9a2dfd5 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5530
diff changeset
  2384
    ].
bf00d9a2dfd5 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5530
diff changeset
  2385
    ^ false
bf00d9a2dfd5 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5530
diff changeset
  2386
!
bf00d9a2dfd5 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5530
diff changeset
  2387
5696
958a0643496d compatibility
Claus Gittinger <cg@exept.de>
parents: 5676
diff changeset
  2388
superMessages
958a0643496d compatibility
Claus Gittinger <cg@exept.de>
parents: 5676
diff changeset
  2389
    "return a collection of message-selectors, sent to super by this method."
958a0643496d compatibility
Claus Gittinger <cg@exept.de>
parents: 5676
diff changeset
  2390
958a0643496d compatibility
Claus Gittinger <cg@exept.de>
parents: 5676
diff changeset
  2391
    ^ self messagesSentToSuper
958a0643496d compatibility
Claus Gittinger <cg@exept.de>
parents: 5676
diff changeset
  2392
!
958a0643496d compatibility
Claus Gittinger <cg@exept.de>
parents: 5676
diff changeset
  2393
5523
86ad12f4afc9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5509
diff changeset
  2394
usedGlobals
86ad12f4afc9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5509
diff changeset
  2395
    "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
  2396
     Uses Parser to parse methods source and extract them."
86ad12f4afc9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5509
diff changeset
  2397
5633
15b028ad5e03 #usedGlobals check was wrong sometimes
Claus Gittinger <cg@exept.de>
parents: 5584
diff changeset
  2398
    ^ self parse:#'parseMethodSilent:in:' with:self mclass return:#usedGlobals or:#() 
5523
86ad12f4afc9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5509
diff changeset
  2399
86ad12f4afc9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5509
diff changeset
  2400
    "
86ad12f4afc9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5509
diff changeset
  2401
     (Method compiledMethodAt:#resources) usedGlobals 
86ad12f4afc9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5509
diff changeset
  2402
    "
86ad12f4afc9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5509
diff changeset
  2403
!
86ad12f4afc9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5509
diff changeset
  2404
5509
c0277123fe4a added #usedSymbols query
Claus Gittinger <cg@exept.de>
parents: 5500
diff changeset
  2405
usedSymbols
c0277123fe4a added #usedSymbols query
Claus Gittinger <cg@exept.de>
parents: 5500
diff changeset
  2406
    "return a collection with the symbols referred to by the receiver.
c0277123fe4a added #usedSymbols query
Claus Gittinger <cg@exept.de>
parents: 5500
diff changeset
  2407
     Uses Parser to parse methods source and extract them.
5523
86ad12f4afc9 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5509
diff changeset
  2408
     This collection only includes implicit symbols references (i.e. not
5509
c0277123fe4a added #usedSymbols query
Claus Gittinger <cg@exept.de>
parents: 5500
diff changeset
  2409
     messages sent)"
c0277123fe4a added #usedSymbols query
Claus Gittinger <cg@exept.de>
parents: 5500
diff changeset
  2410
5634
47327d0e8dbb checkin from browser
Claus Gittinger <cg@exept.de>
parents: 5633
diff changeset
  2411
    ^ self parse:#'parseMethodSilent:in:' with:self mclass return:#usedSymbols or:#() 
5509
c0277123fe4a added #usedSymbols query
Claus Gittinger <cg@exept.de>
parents: 5500
diff changeset
  2412
c0277123fe4a added #usedSymbols query
Claus Gittinger <cg@exept.de>
parents: 5500
diff changeset
  2413
    "
c0277123fe4a added #usedSymbols query
Claus Gittinger <cg@exept.de>
parents: 5500
diff changeset
  2414
     (Method compiledMethodAt:#usedSymbols) usedSymbols 
c0277123fe4a added #usedSymbols query
Claus Gittinger <cg@exept.de>
parents: 5500
diff changeset
  2415
    "
c0277123fe4a added #usedSymbols query
Claus Gittinger <cg@exept.de>
parents: 5500
diff changeset
  2416
!
c0277123fe4a added #usedSymbols query
Claus Gittinger <cg@exept.de>
parents: 5500
diff changeset
  2417
952
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
who
1851
4accc9fafd19 change #who to return a proper object
Claus Gittinger <cg@exept.de>
parents: 1813
diff changeset
  2419
    "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
  2420
     nil is returned for unbound methods.
4accc9fafd19 change #who to return a proper object
Claus Gittinger <cg@exept.de>
parents: 1813
diff changeset
  2421
4accc9fafd19 change #who to return a proper object
Claus Gittinger <cg@exept.de>
parents: 1813
diff changeset
  2422
     ST/X special notice: 
5665
9a0e73dc5efb cache mclass in #who
Claus Gittinger <cg@exept.de>
parents: 5652
diff changeset
  2423
        returns an instance of MethodWhoInfo, which
9a0e73dc5efb cache mclass in #who
Claus Gittinger <cg@exept.de>
parents: 5652
diff changeset
  2424
        responds to #methodClass and #methodSelector query messages.
9a0e73dc5efb cache mclass in #who
Claus Gittinger <cg@exept.de>
parents: 5652
diff changeset
  2425
        For backward- (& ST-80) compatibility, the returned object also
9a0e73dc5efb cache mclass in #who
Claus Gittinger <cg@exept.de>
parents: 5652
diff changeset
  2426
        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
  2427
4accc9fafd19 change #who to return a proper object
Claus Gittinger <cg@exept.de>
parents: 1813
diff changeset
  2428
     Implementation notice:
5665
9a0e73dc5efb cache mclass in #who
Claus Gittinger <cg@exept.de>
parents: 5652
diff changeset
  2429
        Since there is no information of the containing class 
9a0e73dc5efb cache mclass in #who
Claus Gittinger <cg@exept.de>
parents: 5652
diff changeset
  2430
        in the method, we have to do a search here.
9a0e73dc5efb cache mclass in #who
Claus Gittinger <cg@exept.de>
parents: 5652
diff changeset
  2431
9a0e73dc5efb cache mclass in #who
Claus Gittinger <cg@exept.de>
parents: 5652
diff changeset
  2432
        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
  2433
        accepted in the debugger or redefined from within a method
9a0e73dc5efb cache mclass in #who
Claus Gittinger <cg@exept.de>
parents: 5652
diff changeset
  2434
        (maybe done indirectly, if #doIt is done recursively)
9a0e73dc5efb cache mclass in #who
Claus Gittinger <cg@exept.de>
parents: 5652
diff changeset
  2435
        - the information about which class the original method was 
9a0e73dc5efb cache mclass in #who
Claus Gittinger <cg@exept.de>
parents: 5652
diff changeset
  2436
        defined in is lost in this case.
68
59faa75185ba *** empty log message ***
claus
parents: 56
diff changeset
  2437
1851
4accc9fafd19 change #who to return a proper object
Claus Gittinger <cg@exept.de>
parents: 1813
diff changeset
  2438
     Problem: 
5665
9a0e73dc5efb cache mclass in #who
Claus Gittinger <cg@exept.de>
parents: 5652
diff changeset
  2439
        this is heavily called for in the debugger to create
9a0e73dc5efb cache mclass in #who
Claus Gittinger <cg@exept.de>
parents: 5652
diff changeset
  2440
        a readable context walkback. For unbound methods, it is
9a0e73dc5efb cache mclass in #who
Claus Gittinger <cg@exept.de>
parents: 5652
diff changeset
  2441
        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
  2442
952
d600e08a5936 handle the case where a method has a sourceFileInfo, but the class has not
Claus Gittinger <cg@exept.de>
parents: 934
diff changeset
  2443
     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
  2444
        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
  2445
     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
  2446
         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
  2447
5294
f2d689cf7be4 speedup #who (guess className from sourceFileName)
Claus Gittinger <cg@exept.de>
parents: 5284
diff changeset
  2448
    |classes cls sel fn clsName|
952
d600e08a5936 handle the case where a method has a sourceFileInfo, but the class has not
Claus Gittinger <cg@exept.de>
parents: 934
diff changeset
  2449
5324
5c9959ce98af make use of mclass
Claus Gittinger <cg@exept.de>
parents: 5322
diff changeset
  2450
    mclass notNil ifTrue:[
5665
9a0e73dc5efb cache mclass in #who
Claus Gittinger <cg@exept.de>
parents: 5652
diff changeset
  2451
        sel := mclass selectorAtMethod:self.
9a0e73dc5efb cache mclass in #who
Claus Gittinger <cg@exept.de>
parents: 5652
diff changeset
  2452
        sel notNil ifTrue:[
9a0e73dc5efb cache mclass in #who
Claus Gittinger <cg@exept.de>
parents: 5652
diff changeset
  2453
            ^ MethodWhoInfo class:mclass selector:sel
9a0e73dc5efb cache mclass in #who
Claus Gittinger <cg@exept.de>
parents: 5652
diff changeset
  2454
        ].
5704
aeeece3a93ef flush mclass, if no longer valid
Claus Gittinger <cg@exept.de>
parents: 5700
diff changeset
  2455
        "/ flush outdated mclass info
aeeece3a93ef flush mclass, if no longer valid
Claus Gittinger <cg@exept.de>
parents: 5700
diff changeset
  2456
        mclass := nil.
5324
5c9959ce98af make use of mclass
Claus Gittinger <cg@exept.de>
parents: 5322
diff changeset
  2457
    ].
5c9959ce98af make use of mclass
Claus Gittinger <cg@exept.de>
parents: 5322
diff changeset
  2458
952
d600e08a5936 handle the case where a method has a sourceFileInfo, but the class has not
Claus Gittinger <cg@exept.de>
parents: 934
diff changeset
  2459
    "
5294
f2d689cf7be4 speedup #who (guess className from sourceFileName)
Claus Gittinger <cg@exept.de>
parents: 5284
diff changeset
  2460
     speedup kludge: if my sourceFileName is valid,
f2d689cf7be4 speedup #who (guess className from sourceFileName)
Claus Gittinger <cg@exept.de>
parents: 5284
diff changeset
  2461
     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
  2462
    "
f2d689cf7be4 speedup #who (guess className from sourceFileName)
Claus Gittinger <cg@exept.de>
parents: 5284
diff changeset
  2463
    (fn := self sourceFilename) notNil ifTrue:[
5665
9a0e73dc5efb cache mclass in #who
Claus Gittinger <cg@exept.de>
parents: 5652
diff changeset
  2464
        clsName := fn asFilename withoutSuffix name.
9a0e73dc5efb cache mclass in #who
Claus Gittinger <cg@exept.de>
parents: 5652
diff changeset
  2465
        clsName := clsName asSymbolIfInterned.
9a0e73dc5efb cache mclass in #who
Claus Gittinger <cg@exept.de>
parents: 5652
diff changeset
  2466
        clsName notNil ifTrue:[
9a0e73dc5efb cache mclass in #who
Claus Gittinger <cg@exept.de>
parents: 5652
diff changeset
  2467
            cls := Smalltalk at:clsName ifAbsent:nil.
9a0e73dc5efb cache mclass in #who
Claus Gittinger <cg@exept.de>
parents: 5652
diff changeset
  2468
            cls notNil ifTrue:[
9a0e73dc5efb cache mclass in #who
Claus Gittinger <cg@exept.de>
parents: 5652
diff changeset
  2469
                sel := cls selectorAtMethod:self.
9a0e73dc5efb cache mclass in #who
Claus Gittinger <cg@exept.de>
parents: 5652
diff changeset
  2470
                sel notNil ifTrue:[
9a0e73dc5efb cache mclass in #who
Claus Gittinger <cg@exept.de>
parents: 5652
diff changeset
  2471
                    mclass isNil ifTrue:[
9a0e73dc5efb cache mclass in #who
Claus Gittinger <cg@exept.de>
parents: 5652
diff changeset
  2472
                        mclass := cls
9a0e73dc5efb cache mclass in #who
Claus Gittinger <cg@exept.de>
parents: 5652
diff changeset
  2473
                    ].
9a0e73dc5efb cache mclass in #who
Claus Gittinger <cg@exept.de>
parents: 5652
diff changeset
  2474
                    ^ MethodWhoInfo class:cls selector:sel
9a0e73dc5efb cache mclass in #who
Claus Gittinger <cg@exept.de>
parents: 5652
diff changeset
  2475
                ].
9a0e73dc5efb cache mclass in #who
Claus Gittinger <cg@exept.de>
parents: 5652
diff changeset
  2476
9a0e73dc5efb cache mclass in #who
Claus Gittinger <cg@exept.de>
parents: 5652
diff changeset
  2477
                cls := cls class.
9a0e73dc5efb cache mclass in #who
Claus Gittinger <cg@exept.de>
parents: 5652
diff changeset
  2478
                sel := cls selectorAtMethod:self.
9a0e73dc5efb cache mclass in #who
Claus Gittinger <cg@exept.de>
parents: 5652
diff changeset
  2479
                sel notNil ifTrue:[
9a0e73dc5efb cache mclass in #who
Claus Gittinger <cg@exept.de>
parents: 5652
diff changeset
  2480
                    mclass isNil ifTrue:[
9a0e73dc5efb cache mclass in #who
Claus Gittinger <cg@exept.de>
parents: 5652
diff changeset
  2481
                        mclass := cls
9a0e73dc5efb cache mclass in #who
Claus Gittinger <cg@exept.de>
parents: 5652
diff changeset
  2482
                    ].
9a0e73dc5efb cache mclass in #who
Claus Gittinger <cg@exept.de>
parents: 5652
diff changeset
  2483
                    ^ MethodWhoInfo class:cls selector:sel
9a0e73dc5efb cache mclass in #who
Claus Gittinger <cg@exept.de>
parents: 5652
diff changeset
  2484
                ].
9a0e73dc5efb cache mclass in #who
Claus Gittinger <cg@exept.de>
parents: 5652
diff changeset
  2485
            ]
9a0e73dc5efb cache mclass in #who
Claus Gittinger <cg@exept.de>
parents: 5652
diff changeset
  2486
        ].
5294
f2d689cf7be4 speedup #who (guess className from sourceFileName)
Claus Gittinger <cg@exept.de>
parents: 5284
diff changeset
  2487
    ].
f2d689cf7be4 speedup #who (guess className from sourceFileName)
Claus Gittinger <cg@exept.de>
parents: 5284
diff changeset
  2488
f2d689cf7be4 speedup #who (guess className from sourceFileName)
Claus Gittinger <cg@exept.de>
parents: 5284
diff changeset
  2489
    "
f2d689cf7be4 speedup #who (guess className from sourceFileName)
Claus Gittinger <cg@exept.de>
parents: 5284
diff changeset
  2490
     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
  2491
     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
  2492
     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
  2493
     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
  2494
    "
d600e08a5936 handle the case where a method has a sourceFileInfo, but the class has not
Claus Gittinger <cg@exept.de>
parents: 934
diff changeset
  2495
    LastWhoClass notNil ifTrue:[
5665
9a0e73dc5efb cache mclass in #who
Claus Gittinger <cg@exept.de>
parents: 5652
diff changeset
  2496
        cls := Smalltalk at:LastWhoClass ifAbsent:nil.
9a0e73dc5efb cache mclass in #who
Claus Gittinger <cg@exept.de>
parents: 5652
diff changeset
  2497
        cls notNil ifTrue:[
9a0e73dc5efb cache mclass in #who
Claus Gittinger <cg@exept.de>
parents: 5652
diff changeset
  2498
            sel := cls selectorAtMethod:self.
9a0e73dc5efb cache mclass in #who
Claus Gittinger <cg@exept.de>
parents: 5652
diff changeset
  2499
            sel notNil ifTrue:[
9a0e73dc5efb cache mclass in #who
Claus Gittinger <cg@exept.de>
parents: 5652
diff changeset
  2500
                mclass isNil ifTrue:[
9a0e73dc5efb cache mclass in #who
Claus Gittinger <cg@exept.de>
parents: 5652
diff changeset
  2501
                    mclass := cls
9a0e73dc5efb cache mclass in #who
Claus Gittinger <cg@exept.de>
parents: 5652
diff changeset
  2502
                ].
9a0e73dc5efb cache mclass in #who
Claus Gittinger <cg@exept.de>
parents: 5652
diff changeset
  2503
                ^ MethodWhoInfo class:cls selector:sel
9a0e73dc5efb cache mclass in #who
Claus Gittinger <cg@exept.de>
parents: 5652
diff changeset
  2504
            ].
9a0e73dc5efb cache mclass in #who
Claus Gittinger <cg@exept.de>
parents: 5652
diff changeset
  2505
9a0e73dc5efb cache mclass in #who
Claus Gittinger <cg@exept.de>
parents: 5652
diff changeset
  2506
            cls := cls class.
9a0e73dc5efb cache mclass in #who
Claus Gittinger <cg@exept.de>
parents: 5652
diff changeset
  2507
            sel := cls selectorAtMethod:self.
9a0e73dc5efb cache mclass in #who
Claus Gittinger <cg@exept.de>
parents: 5652
diff changeset
  2508
            sel notNil ifTrue:[
9a0e73dc5efb cache mclass in #who
Claus Gittinger <cg@exept.de>
parents: 5652
diff changeset
  2509
                mclass isNil ifTrue:[
9a0e73dc5efb cache mclass in #who
Claus Gittinger <cg@exept.de>
parents: 5652
diff changeset
  2510
                    mclass := cls
9a0e73dc5efb cache mclass in #who
Claus Gittinger <cg@exept.de>
parents: 5652
diff changeset
  2511
                ].
9a0e73dc5efb cache mclass in #who
Claus Gittinger <cg@exept.de>
parents: 5652
diff changeset
  2512
                ^ MethodWhoInfo class:cls selector:sel
9a0e73dc5efb cache mclass in #who
Claus Gittinger <cg@exept.de>
parents: 5652
diff changeset
  2513
            ].
9a0e73dc5efb cache mclass in #who
Claus Gittinger <cg@exept.de>
parents: 5652
diff changeset
  2514
        ]
68
59faa75185ba *** empty log message ***
claus
parents: 56
diff changeset
  2515
    ].
227
23b1c4de3402 package & cleanup
claus
parents: 216
diff changeset
  2516
142
c7844287bddf *** empty log message ***
claus
parents: 109
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
     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
  2519
     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
  2520
    "
d600e08a5936 handle the case where a method has a sourceFileInfo, but the class has not
Claus Gittinger <cg@exept.de>
parents: 934
diff changeset
  2521
    classes := Smalltalk allClasses.
142
c7844287bddf *** empty log message ***
claus
parents: 109
diff changeset
  2522
    "
952
d600e08a5936 handle the case where a method has a sourceFileInfo, but the class has not
Claus Gittinger <cg@exept.de>
parents: 934
diff changeset
  2523
     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
  2524
    "
d600e08a5936 handle the case where a method has a sourceFileInfo, but the class has not
Claus Gittinger <cg@exept.de>
parents: 934
diff changeset
  2525
    classes do:[:aClass |
5665
9a0e73dc5efb cache mclass in #who
Claus Gittinger <cg@exept.de>
parents: 5652
diff changeset
  2526
        |sel|
9a0e73dc5efb cache mclass in #who
Claus Gittinger <cg@exept.de>
parents: 5652
diff changeset
  2527
9a0e73dc5efb cache mclass in #who
Claus Gittinger <cg@exept.de>
parents: 5652
diff changeset
  2528
        sel := aClass selectorAtMethod:self ifAbsent:nil.
9a0e73dc5efb cache mclass in #who
Claus Gittinger <cg@exept.de>
parents: 5652
diff changeset
  2529
        sel notNil ifTrue:[
9a0e73dc5efb cache mclass in #who
Claus Gittinger <cg@exept.de>
parents: 5652
diff changeset
  2530
            LastWhoClass := aClass theNonMetaclass name.
9a0e73dc5efb cache mclass in #who
Claus Gittinger <cg@exept.de>
parents: 5652
diff changeset
  2531
            mclass isNil ifTrue:[
9a0e73dc5efb cache mclass in #who
Claus Gittinger <cg@exept.de>
parents: 5652
diff changeset
  2532
                mclass := aClass
9a0e73dc5efb cache mclass in #who
Claus Gittinger <cg@exept.de>
parents: 5652
diff changeset
  2533
            ].
9a0e73dc5efb cache mclass in #who
Claus Gittinger <cg@exept.de>
parents: 5652
diff changeset
  2534
            ^ MethodWhoInfo class:aClass selector:sel
9a0e73dc5efb cache mclass in #who
Claus Gittinger <cg@exept.de>
parents: 5652
diff changeset
  2535
        ].
5277
d457937a69e5 comments & code-cleanup in #who
Claus Gittinger <cg@exept.de>
parents: 5241
diff changeset
  2536
    ].
d457937a69e5 comments & code-cleanup in #who
Claus Gittinger <cg@exept.de>
parents: 5241
diff changeset
  2537
d457937a69e5 comments & code-cleanup in #who
Claus Gittinger <cg@exept.de>
parents: 5241
diff changeset
  2538
    classes do:[:aClass |
5665
9a0e73dc5efb cache mclass in #who
Claus Gittinger <cg@exept.de>
parents: 5652
diff changeset
  2539
        |sel|
9a0e73dc5efb cache mclass in #who
Claus Gittinger <cg@exept.de>
parents: 5652
diff changeset
  2540
9a0e73dc5efb cache mclass in #who
Claus Gittinger <cg@exept.de>
parents: 5652
diff changeset
  2541
        sel := aClass class selectorAtMethod:self.
9a0e73dc5efb cache mclass in #who
Claus Gittinger <cg@exept.de>
parents: 5652
diff changeset
  2542
        sel notNil ifTrue:[ 
9a0e73dc5efb cache mclass in #who
Claus Gittinger <cg@exept.de>
parents: 5652
diff changeset
  2543
            LastWhoClass := aClass theNonMetaclass name.
9a0e73dc5efb cache mclass in #who
Claus Gittinger <cg@exept.de>
parents: 5652
diff changeset
  2544
            mclass isNil ifTrue:[
9a0e73dc5efb cache mclass in #who
Claus Gittinger <cg@exept.de>
parents: 5652
diff changeset
  2545
                mclass := aClass class
9a0e73dc5efb cache mclass in #who
Claus Gittinger <cg@exept.de>
parents: 5652
diff changeset
  2546
            ].
9a0e73dc5efb cache mclass in #who
Claus Gittinger <cg@exept.de>
parents: 5652
diff changeset
  2547
            ^ MethodWhoInfo class:aClass class selector:sel
9a0e73dc5efb cache mclass in #who
Claus Gittinger <cg@exept.de>
parents: 5652
diff changeset
  2548
        ].
142
c7844287bddf *** empty log message ***
claus
parents: 109
diff changeset
  2549
    ].
952
d600e08a5936 handle the case where a method has a sourceFileInfo, but the class has not
Claus Gittinger <cg@exept.de>
parents: 934
diff changeset
  2550
d600e08a5936 handle the case where a method has a sourceFileInfo, but the class has not
Claus Gittinger <cg@exept.de>
parents: 934
diff changeset
  2551
    LastWhoClass := nil.
142
c7844287bddf *** empty log message ***
claus
parents: 109
diff changeset
  2552
    "
952
d600e08a5936 handle the case where a method has a sourceFileInfo, but the class has not
Claus Gittinger <cg@exept.de>
parents: 934
diff changeset
  2553
     mhmh - must be a method of some anonymous class (i.e. one 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
  2554
     in the Smalltalk dictionary). Search all instances of Behavior
142
c7844287bddf *** empty log message ***
claus
parents: 109
diff changeset
  2555
    "
952
d600e08a5936 handle the case where a method has a sourceFileInfo, but the class has not
Claus Gittinger <cg@exept.de>
parents: 934
diff changeset
  2556
    Behavior allSubInstancesDo:[:someClass |
5665
9a0e73dc5efb cache mclass in #who
Claus Gittinger <cg@exept.de>
parents: 5652
diff changeset
  2557
        |sel|
9a0e73dc5efb cache mclass in #who
Claus Gittinger <cg@exept.de>
parents: 5652
diff changeset
  2558
9a0e73dc5efb cache mclass in #who
Claus Gittinger <cg@exept.de>
parents: 5652
diff changeset
  2559
        (classes includes:someClass) ifFalse:[
9a0e73dc5efb cache mclass in #who
Claus Gittinger <cg@exept.de>
parents: 5652
diff changeset
  2560
            sel := someClass selectorAtMethod:self.
9a0e73dc5efb cache mclass in #who
Claus Gittinger <cg@exept.de>
parents: 5652
diff changeset
  2561
            sel notNil ifTrue:[
9a0e73dc5efb cache mclass in #who
Claus Gittinger <cg@exept.de>
parents: 5652
diff changeset
  2562
                mclass isNil ifTrue:[
9a0e73dc5efb cache mclass in #who
Claus Gittinger <cg@exept.de>
parents: 5652
diff changeset
  2563
                    mclass := someClass
9a0e73dc5efb cache mclass in #who
Claus Gittinger <cg@exept.de>
parents: 5652
diff changeset
  2564
                ].
9a0e73dc5efb cache mclass in #who
Claus Gittinger <cg@exept.de>
parents: 5652
diff changeset
  2565
                ^ MethodWhoInfo class:someClass selector:sel
9a0e73dc5efb cache mclass in #who
Claus Gittinger <cg@exept.de>
parents: 5652
diff changeset
  2566
            ]
9a0e73dc5efb cache mclass in #who
Claus Gittinger <cg@exept.de>
parents: 5652
diff changeset
  2567
        ]
952
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
    "
d600e08a5936 handle the case where a method has a sourceFileInfo, but the class has not
Claus Gittinger <cg@exept.de>
parents: 934
diff changeset
  2570
     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
  2571
    "
d600e08a5936 handle the case where a method has a sourceFileInfo, but the class has not
Claus Gittinger <cg@exept.de>
parents: 934
diff changeset
  2572
    ^ nil
444
071b4f32272c *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 443
diff changeset
  2573
952
d600e08a5936 handle the case where a method has a sourceFileInfo, but the class has not
Claus Gittinger <cg@exept.de>
parents: 934
diff changeset
  2574
    "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
  2575
    "
d600e08a5936 handle the case where a method has a sourceFileInfo, but the class has not
Claus Gittinger <cg@exept.de>
parents: 934
diff changeset
  2576
     |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
  2577
     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
  2578
     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
  2579
    "
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
    "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
  2582
    "
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
     |m cls|
444
071b4f32272c *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 443
diff changeset
  2584
952
d600e08a5936 handle the case where a method has a sourceFileInfo, but the class has not
Claus Gittinger <cg@exept.de>
parents: 934
diff changeset
  2585
     Object 
5665
9a0e73dc5efb cache mclass in #who
Claus Gittinger <cg@exept.de>
parents: 5652
diff changeset
  2586
        subclass:#FunnyClass 
9a0e73dc5efb cache mclass in #who
Claus Gittinger <cg@exept.de>
parents: 5652
diff changeset
  2587
        instanceVariableNames:'foo'
9a0e73dc5efb cache mclass in #who
Claus Gittinger <cg@exept.de>
parents: 5652
diff changeset
  2588
        classVariableNames:''
9a0e73dc5efb cache mclass in #who
Claus Gittinger <cg@exept.de>
parents: 5652
diff changeset
  2589
        poolDictionaries:''
9a0e73dc5efb cache mclass in #who
Claus Gittinger <cg@exept.de>
parents: 5652
diff changeset
  2590
        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
  2591
     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
  2592
     Smalltalk removeClass:cls.
444
071b4f32272c *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 443
diff changeset
  2593
952
d600e08a5936 handle the case where a method has a sourceFileInfo, but the class has not
Claus Gittinger <cg@exept.de>
parents: 934
diff changeset
  2594
     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
  2595
     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
  2596
     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
  2597
d600e08a5936 handle the case where a method has a sourceFileInfo, but the class has not
Claus Gittinger <cg@exept.de>
parents: 934
diff changeset
  2598
     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
  2599
    "
1851
4accc9fafd19 change #who to return a proper object
Claus Gittinger <cg@exept.de>
parents: 1813
diff changeset
  2600
5277
d457937a69e5 comments & code-cleanup in #who
Claus Gittinger <cg@exept.de>
parents: 5241
diff changeset
  2601
    "Modified: / 23.2.2000 / 11:32:49 / cg"
68
59faa75185ba *** empty log message ***
claus
parents: 56
diff changeset
  2602
!
59faa75185ba *** empty log message ***
claus
parents: 56
diff changeset
  2603
952
d600e08a5936 handle the case where a method has a sourceFileInfo, but the class has not
Claus Gittinger <cg@exept.de>
parents: 934
diff changeset
  2604
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
  2605
    "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
  2606
     Thats the WrapperMethod which contains myself."
159
514c749165c3 *** empty log message ***
claus
parents: 142
diff changeset
  2607
952
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
    WrappedMethod allInstancesDo:[: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
  2609
	m originalMethod == self ifTrue:[^ 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
  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
    ^ nil
5564
0f513f04c50f #readsFields: and #writesField: for st80 compatibility
Claus Gittinger <cg@exept.de>
parents: 5562
diff changeset
  2612
!
0f513f04c50f #readsFields: and #writesField: for st80 compatibility
Claus Gittinger <cg@exept.de>
parents: 5562
diff changeset
  2613
0f513f04c50f #readsFields: and #writesField: for st80 compatibility
Claus Gittinger <cg@exept.de>
parents: 5562
diff changeset
  2614
writesField:instVarIndex
0f513f04c50f #readsFields: and #writesField: for st80 compatibility
Claus Gittinger <cg@exept.de>
parents: 5562
diff changeset
  2615
    "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
  2616
     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
  2617
0f513f04c50f #readsFields: and #writesField: for st80 compatibility
Claus Gittinger <cg@exept.de>
parents: 5562
diff changeset
  2618
    |varName modifiedInstVars|
0f513f04c50f #readsFields: and #writesField: for st80 compatibility
Claus Gittinger <cg@exept.de>
parents: 5562
diff changeset
  2619
0f513f04c50f #readsFields: and #writesField: for st80 compatibility
Claus Gittinger <cg@exept.de>
parents: 5562
diff changeset
  2620
    varName := (self mclass allInstVarNames) at:instVarIndex.
5636
eab6a71fb3d0 *** empty log message ***
Claus Gittinger <cg@exept.de>
parents: 5634
diff changeset
  2621
    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
  2622
    ^ 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
  2623
! !
13
62303f84ff5f *** empty log message ***
claus
parents: 10
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
!Method methodsFor:'trap methods'!
13
62303f84ff5f *** empty log message ***
claus
parents: 10
diff changeset
  2626
952
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
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
  2628
    "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
  2629
     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
  2630
     the objectFileLoader to invalidate methods whose code is unloaded."
1
a27a279701f8 Initial revision
claus
parents:
diff changeset
  2631
952
d600e08a5936 handle the case where a method has a sourceFileInfo, but the class has not
Claus Gittinger <cg@exept.de>
parents: 934
diff changeset
  2632
    |invldMethod|
159
514c749165c3 *** empty log message ***
claus
parents: 142
diff changeset
  2633
1873
3544a4a94a2a checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1870
diff changeset
  2634
    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
  2635
    self code:invldMethod code.
1873
3544a4a94a2a checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1870
diff changeset
  2636
    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
  2637
d600e08a5936 handle the case where a method has a sourceFileInfo, but the class has not
Claus Gittinger <cg@exept.de>
parents: 934
diff changeset
  2638
    "Created: 17.9.1995 / 15:00:52 / claus"
1873
3544a4a94a2a checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1870
diff changeset
  2639
    "Modified: 4.11.1996 / 23:04:34 / cg"
1
a27a279701f8 Initial revision
claus
parents:
diff changeset
  2640
!
a27a279701f8 Initial revision
claus
parents:
diff changeset
  2641
952
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
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
  2643
    "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
  2644
     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
  2645
     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
  2646
     after a class definition change (for example: instvars are no longer there)."
1
a27a279701f8 Initial revision
claus
parents:
diff changeset
  2647
952
d600e08a5936 handle the case where a method has a sourceFileInfo, but the class has not
Claus Gittinger <cg@exept.de>
parents: 934
diff changeset
  2648
    |invldMethod|
872
af04035b443d binary class storage support
Claus Gittinger <cg@exept.de>
parents: 829
diff changeset
  2649
952
d600e08a5936 handle the case where a method has a sourceFileInfo, but the class has not
Claus Gittinger <cg@exept.de>
parents: 934
diff changeset
  2650
    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
  2651
    self code:invldMethod code.
1873
3544a4a94a2a checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1870
diff changeset
  2652
    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
  2653
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
    "Created: 17.9.1995 / 15:01:14 / claus"
1873
3544a4a94a2a checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1870
diff changeset
  2655
    "Modified: 4.11.1996 / 23:04:46 / cg"
3544a4a94a2a checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1870
diff changeset
  2656
!
3544a4a94a2a checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1870
diff changeset
  2657
3544a4a94a2a checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1870
diff changeset
  2658
makeUnloaded
3544a4a94a2a checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1870
diff changeset
  2659
    "make the receiver an unloaded method, which raises an invalidCodeObject
3544a4a94a2a checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1870
diff changeset
  2660
     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
  2661
     the objectFileLoader to invalidate methods for which a shared library has
3544a4a94a2a checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1870
diff changeset
  2662
     been removed."
3544a4a94a2a checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1870
diff changeset
  2663
3544a4a94a2a checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1870
diff changeset
  2664
    |invldMethod|
3544a4a94a2a checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1870
diff changeset
  2665
3544a4a94a2a checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1870
diff changeset
  2666
    invldMethod := self class compiledMethodAt:#unloadedCodeObject.
3544a4a94a2a checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1870
diff changeset
  2667
    self code:invldMethod code.
3544a4a94a2a checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1870
diff changeset
  2668
    self byteCode:nil.
3544a4a94a2a checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1870
diff changeset
  2669
3544a4a94a2a checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1870
diff changeset
  2670
    "Created: 4.11.1996 / 22:59:21 / cg"
3544a4a94a2a checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1870
diff changeset
  2671
    "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
  2672
!
2623b60c27e1 lifted numVars; added access for invalidCodeObject-trappers
Claus Gittinger <cg@exept.de>
parents: 1855
diff changeset
  2673
2623b60c27e1 lifted numVars; added access for invalidCodeObject-trappers
Claus Gittinger <cg@exept.de>
parents: 1855
diff changeset
  2674
trapMethodForNumArgs:numArgs
2623b60c27e1 lifted numVars; added access for invalidCodeObject-trappers
Claus Gittinger <cg@exept.de>
parents: 1855
diff changeset
  2675
    |trapSel|
2623b60c27e1 lifted numVars; added access for invalidCodeObject-trappers
Claus Gittinger <cg@exept.de>
parents: 1855
diff changeset
  2676
2623b60c27e1 lifted numVars; added access for invalidCodeObject-trappers
Claus Gittinger <cg@exept.de>
parents: 1855
diff changeset
  2677
    trapSel := #(
3030
fc5d632d133f when compiling a lazy method, use the classes namespace
Claus Gittinger <cg@exept.de>
parents: 2979
diff changeset
  2678
		  #'invalidCodeObject'
fc5d632d133f when compiling a lazy method, use the classes namespace
Claus Gittinger <cg@exept.de>
parents: 2979
diff changeset
  2679
		  #'invalidCodeObjectWith:'
fc5d632d133f when compiling a lazy method, use the classes namespace
Claus Gittinger <cg@exept.de>
parents: 2979
diff changeset
  2680
		  #'invalidCodeObjectWith:with:'
fc5d632d133f when compiling a lazy method, use the classes namespace
Claus Gittinger <cg@exept.de>
parents: 2979
diff changeset
  2681
		  #'invalidCodeObjectWith:with:with:'
fc5d632d133f when compiling a lazy method, use the classes namespace
Claus Gittinger <cg@exept.de>
parents: 2979
diff changeset
  2682
		  #'invalidCodeObjectWith:with:with:with:'
fc5d632d133f when compiling a lazy method, use the classes namespace
Claus Gittinger <cg@exept.de>
parents: 2979
diff changeset
  2683
		  #'invalidCodeObjectWith:with:with:with:with:'
fc5d632d133f when compiling a lazy method, use the classes namespace
Claus Gittinger <cg@exept.de>
parents: 2979
diff changeset
  2684
		  #'invalidCodeObjectWith:with:with:with:with:with:'
fc5d632d133f when compiling a lazy method, use the classes namespace
Claus Gittinger <cg@exept.de>
parents: 2979
diff changeset
  2685
		  #'invalidCodeObjectWith:with:with:with:with:with:with:'
fc5d632d133f when compiling a lazy method, use the classes namespace
Claus Gittinger <cg@exept.de>
parents: 2979
diff changeset
  2686
		  #'invalidCodeObjectWith:with:with:with:with:with:with:with:'
fc5d632d133f when compiling a lazy method, use the classes namespace
Claus Gittinger <cg@exept.de>
parents: 2979
diff changeset
  2687
		  #'invalidCodeObjectWith:with:with:with:with:with:with:with:with:'
fc5d632d133f when compiling a lazy method, use the classes namespace
Claus Gittinger <cg@exept.de>
parents: 2979
diff changeset
  2688
		  #'invalidCodeObjectWith:with:with:with:with:with:with:with:with:with:'
fc5d632d133f when compiling a lazy method, use the classes namespace
Claus Gittinger <cg@exept.de>
parents: 2979
diff changeset
  2689
		  #'invalidCodeObjectWith:with:with:with:with:with:with:with:with:with:with:'
fc5d632d133f when compiling a lazy method, use the classes namespace
Claus Gittinger <cg@exept.de>
parents: 2979
diff changeset
  2690
		  #'invalidCodeObjectWith:with:with:with:with:with:with:with:with:with:with:with:'
fc5d632d133f when compiling a lazy method, use the classes namespace
Claus Gittinger <cg@exept.de>
parents: 2979
diff changeset
  2691
		  #'invalidCodeObjectWith:with:with:with:with:with:with:with:with:with:with:with:with:'
fc5d632d133f when compiling a lazy method, use the classes namespace
Claus Gittinger <cg@exept.de>
parents: 2979
diff changeset
  2692
		  #'invalidCodeObjectWith:with:with:with:with:with:with:with:with:with:with:with:with:with:'
fc5d632d133f when compiling a lazy method, use the classes namespace
Claus Gittinger <cg@exept.de>
parents: 2979
diff changeset
  2693
		  #'invalidCodeObjectWith:with:with:with:with:with:with:with:with:with:with:with:with:with:with:'
fc5d632d133f when compiling a lazy method, use the classes namespace
Claus Gittinger <cg@exept.de>
parents: 2979
diff changeset
  2694
		) at:(numArgs + 1).
1870
2623b60c27e1 lifted numVars; added access for invalidCodeObject-trappers
Claus Gittinger <cg@exept.de>
parents: 1855
diff changeset
  2695
2623b60c27e1 lifted numVars; added access for invalidCodeObject-trappers
Claus Gittinger <cg@exept.de>
parents: 1855
diff changeset
  2696
    ^ Method compiledMethodAt:trapSel.
2623b60c27e1 lifted numVars; added access for invalidCodeObject-trappers
Claus Gittinger <cg@exept.de>
parents: 1855
diff changeset
  2697
2623b60c27e1 lifted numVars; added access for invalidCodeObject-trappers
Claus Gittinger <cg@exept.de>
parents: 1855
diff changeset
  2698
    "Created: 4.11.1996 / 21:58:58 / cg"
1873
3544a4a94a2a checkin from browser
Claus Gittinger <cg@exept.de>
parents: 1870
diff changeset
  2699
    "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
  2700
! !
872
af04035b443d binary class storage support
Claus Gittinger <cg@exept.de>
parents: 829
diff changeset
  2701
2022
24529e2b7cee commentary for MethodWhoInfo
Claus Gittinger <cg@exept.de>
parents: 1995
diff changeset
  2702
!Method::MethodWhoInfo class methodsFor:'documentation'!
24529e2b7cee commentary for MethodWhoInfo
Claus Gittinger <cg@exept.de>
parents: 1995
diff changeset
  2703
24529e2b7cee commentary for MethodWhoInfo
Claus Gittinger <cg@exept.de>
parents: 1995
diff changeset
  2704
documentation
24529e2b7cee commentary for MethodWhoInfo
Claus Gittinger <cg@exept.de>
parents: 1995
diff changeset
  2705
"
24529e2b7cee commentary for MethodWhoInfo
Claus Gittinger <cg@exept.de>
parents: 1995
diff changeset
  2706
    In earlier times, Method>>who returned an array filled
24529e2b7cee commentary for MethodWhoInfo
Claus Gittinger <cg@exept.de>
parents: 1995
diff changeset
  2707
    with the methods class and selector.
24529e2b7cee commentary for MethodWhoInfo
Claus Gittinger <cg@exept.de>
parents: 1995
diff changeset
  2708
    This was done, since a smalltalk method cannot return multiple
24529e2b7cee commentary for MethodWhoInfo
Claus Gittinger <cg@exept.de>
parents: 1995
diff changeset
  2709
    values, but 2 values had to be returned from that method.
24529e2b7cee commentary for MethodWhoInfo
Claus Gittinger <cg@exept.de>
parents: 1995
diff changeset
  2710
    Thus, the who-interface was used as:
3030
fc5d632d133f when compiling a lazy method, use the classes namespace
Claus Gittinger <cg@exept.de>
parents: 2979
diff changeset
  2711
	info := <someMethod> who.
fc5d632d133f when compiling a lazy method, use the classes namespace
Claus Gittinger <cg@exept.de>
parents: 2979
diff changeset
  2712
	class := info at:1.
fc5d632d133f when compiling a lazy method, use the classes namespace
Claus Gittinger <cg@exept.de>
parents: 2979
diff changeset
  2713
	sel := info at:2.
2022
24529e2b7cee commentary for MethodWhoInfo
Claus Gittinger <cg@exept.de>
parents: 1995
diff changeset
  2714
24529e2b7cee commentary for MethodWhoInfo
Claus Gittinger <cg@exept.de>
parents: 1995
diff changeset
  2715
    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
  2716
    an object (an instance of MethodWhoInfo) which responds to the two
24529e2b7cee commentary for MethodWhoInfo
Claus Gittinger <cg@exept.de>
parents: 1995
diff changeset
  2717
    messages: #methodClass and #methodSelector.
24529e2b7cee commentary for MethodWhoInfo
Claus Gittinger <cg@exept.de>
parents: 1995
diff changeset
  2718
    This allows to write things much more intuitive:
3030
fc5d632d133f when compiling a lazy method, use the classes namespace
Claus Gittinger <cg@exept.de>
parents: 2979
diff changeset
  2719
	info := <someMethod> who.
fc5d632d133f when compiling a lazy method, use the classes namespace
Claus Gittinger <cg@exept.de>
parents: 2979
diff changeset
  2720
	class := info methodClass.
fc5d632d133f when compiling a lazy method, use the classes namespace
Claus Gittinger <cg@exept.de>
parents: 2979
diff changeset
  2721
	sel := info methodSelector.
2022
24529e2b7cee commentary for MethodWhoInfo
Claus Gittinger <cg@exept.de>
parents: 1995
diff changeset
  2722
24529e2b7cee commentary for MethodWhoInfo
Claus Gittinger <cg@exept.de>
parents: 1995
diff changeset
  2723
    However, to be backward compatible, the returned object still responds to
24529e2b7cee commentary for MethodWhoInfo
Claus Gittinger <cg@exept.de>
parents: 1995
diff changeset
  2724
    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
  2725
24529e2b7cee commentary for MethodWhoInfo
Claus Gittinger <cg@exept.de>
parents: 1995
diff changeset
  2726
    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
  2727
    classes.
2242
5037033b8002 commentary
Claus Gittinger <cg@exept.de>
parents: 2218
diff changeset
  2728
5037033b8002 commentary
Claus Gittinger <cg@exept.de>
parents: 2218
diff changeset
  2729
    [author:]
3030
fc5d632d133f when compiling a lazy method, use the classes namespace
Claus Gittinger <cg@exept.de>
parents: 2979
diff changeset
  2730
	Claus Gittinger
2242
5037033b8002 commentary
Claus Gittinger <cg@exept.de>
parents: 2218
diff changeset
  2731
5037033b8002 commentary
Claus Gittinger <cg@exept.de>
parents: 2218
diff changeset
  2732
    [see also:]
3030
fc5d632d133f when compiling a lazy method, use the classes namespace
Claus Gittinger <cg@exept.de>
parents: 2979
diff changeset
  2733
	Method
2022
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
! !
24529e2b7cee commentary for MethodWhoInfo
Claus Gittinger <cg@exept.de>
parents: 1995
diff changeset
  2736
1851
4accc9fafd19 change #who to return a proper object
Claus Gittinger <cg@exept.de>
parents: 1813
diff changeset
  2737
!Method::MethodWhoInfo class methodsFor:'instance creation'!
4accc9fafd19 change #who to return a proper object
Claus Gittinger <cg@exept.de>
parents: 1813
diff changeset
  2738
4accc9fafd19 change #who to return a proper object
Claus Gittinger <cg@exept.de>
parents: 1813
diff changeset
  2739
class:cls selector:sel
2023
4c6416d1a54d checkin from browser
Claus Gittinger <cg@exept.de>
parents: 2022
diff changeset
  2740
    "return a new MethodWhoInfo object;
4c6416d1a54d checkin from browser
Claus Gittinger <cg@exept.de>
parents: 2022
diff changeset
  2741
     this is a private interface for Method"
4c6416d1a54d checkin from browser
Claus Gittinger <cg@exept.de>
parents: 2022
diff changeset
  2742
1851
4accc9fafd19 change #who to return a proper object
Claus Gittinger <cg@exept.de>
parents: 1813
diff changeset
  2743
    ^ self basicNew class:cls selector:sel
2023
4c6416d1a54d checkin from browser
Claus Gittinger <cg@exept.de>
parents: 2022
diff changeset
  2744
4c6416d1a54d checkin from browser
Claus Gittinger <cg@exept.de>
parents: 2022
diff changeset
  2745
    "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
  2746
! !
4accc9fafd19 change #who to return a proper object
Claus Gittinger <cg@exept.de>
parents: 1813
diff changeset
  2747
4accc9fafd19 change #who to return a proper object
Claus Gittinger <cg@exept.de>
parents: 1813
diff changeset
  2748
!Method::MethodWhoInfo methodsFor:'accessing'!
4accc9fafd19 change #who to return a proper object
Claus Gittinger <cg@exept.de>
parents: 1813
diff changeset
  2749
4669
828addb1c376 source code access - care for package different from my classes
Claus Gittinger <cg@exept.de>
parents: 4595
diff changeset
  2750
method
828addb1c376 source code access - care for package different from my classes
Claus Gittinger <cg@exept.de>
parents: 4595
diff changeset
  2751
    ^ myClass compiledMethodAt:mySelector
828addb1c376 source code access - care for package different from my classes
Claus Gittinger <cg@exept.de>
parents: 4595
diff changeset
  2752
!
828addb1c376 source code access - care for package different from my classes
Claus Gittinger <cg@exept.de>
parents: 4595
diff changeset
  2753
1851
4accc9fafd19 change #who to return a proper object
Claus Gittinger <cg@exept.de>
parents: 1813
diff changeset
  2754
methodClass
2022
24529e2b7cee commentary for MethodWhoInfo
Claus Gittinger <cg@exept.de>
parents: 1995
diff changeset
  2755
    "return the class which contains the method represented by myself"
24529e2b7cee commentary for MethodWhoInfo
Claus Gittinger <cg@exept.de>
parents: 1995
diff changeset
  2756
1851
4accc9fafd19 change #who to return a proper object
Claus Gittinger <cg@exept.de>
parents: 1813
diff changeset
  2757
    ^ myClass
2022
24529e2b7cee commentary for MethodWhoInfo
Claus Gittinger <cg@exept.de>
parents: 1995
diff changeset
  2758
24529e2b7cee commentary for MethodWhoInfo
Claus Gittinger <cg@exept.de>
parents: 1995
diff changeset
  2759
    "
24529e2b7cee commentary for MethodWhoInfo
Claus Gittinger <cg@exept.de>
parents: 1995
diff changeset
  2760
     (Method compiledMethodAt:#who) who methodClass
24529e2b7cee commentary for MethodWhoInfo
Claus Gittinger <cg@exept.de>
parents: 1995
diff changeset
  2761
     (Method::MethodWhoInfo compiledMethodAt:#methodClass) who methodClass
24529e2b7cee commentary for MethodWhoInfo
Claus Gittinger <cg@exept.de>
parents: 1995
diff changeset
  2762
    "
24529e2b7cee commentary for MethodWhoInfo
Claus Gittinger <cg@exept.de>
parents: 1995
diff changeset
  2763
24529e2b7cee commentary for MethodWhoInfo
Claus Gittinger <cg@exept.de>
parents: 1995
diff changeset
  2764
    "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
  2765
!
4accc9fafd19 change #who to return a proper object
Claus Gittinger <cg@exept.de>
parents: 1813
diff changeset
  2766
4accc9fafd19 change #who to return a proper object
Claus Gittinger <cg@exept.de>
parents: 1813
diff changeset
  2767
methodSelector
2022
24529e2b7cee commentary for MethodWhoInfo
Claus Gittinger <cg@exept.de>
parents: 1995
diff changeset
  2768
    "return the selector under which the the method represented by myself
24529e2b7cee commentary for MethodWhoInfo
Claus Gittinger <cg@exept.de>
parents: 1995
diff changeset
  2769
     is found in the class"
24529e2b7cee commentary for MethodWhoInfo
Claus Gittinger <cg@exept.de>
parents: 1995
diff changeset
  2770
1851
4accc9fafd19 change #who to return a proper object
Claus Gittinger <cg@exept.de>
parents: 1813
diff changeset
  2771
    ^ mySelector
2022
24529e2b7cee commentary for MethodWhoInfo
Claus Gittinger <cg@exept.de>
parents: 1995
diff changeset
  2772
24529e2b7cee commentary for MethodWhoInfo
Claus Gittinger <cg@exept.de>
parents: 1995
diff changeset
  2773
    "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
  2774
! !
4accc9fafd19 change #who to return a proper object
Claus Gittinger <cg@exept.de>
parents: 1813
diff changeset
  2775
4accc9fafd19 change #who to return a proper object
Claus Gittinger <cg@exept.de>
parents: 1813
diff changeset
  2776
!Method::MethodWhoInfo methodsFor:'compatibility'!
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
at:index
4accc9fafd19 change #who to return a proper object
Claus Gittinger <cg@exept.de>
parents: 1813
diff changeset
  2779
    "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
  2780
4accc9fafd19 change #who to return a proper object
Claus Gittinger <cg@exept.de>
parents: 1813
diff changeset
  2781
    index == 1 ifTrue:[
3030
fc5d632d133f when compiling a lazy method, use the classes namespace
Claus Gittinger <cg@exept.de>
parents: 2979
diff changeset
  2782
	^ myClass
1851
4accc9fafd19 change #who to return a proper object
Claus Gittinger <cg@exept.de>
parents: 1813
diff changeset
  2783
    ].
4accc9fafd19 change #who to return a proper object
Claus Gittinger <cg@exept.de>
parents: 1813
diff changeset
  2784
    index == 2 ifTrue:[
3030
fc5d632d133f when compiling a lazy method, use the classes namespace
Claus Gittinger <cg@exept.de>
parents: 2979
diff changeset
  2785
	^ mySelector
1851
4accc9fafd19 change #who to return a proper object
Claus Gittinger <cg@exept.de>
parents: 1813
diff changeset
  2786
    ].
4accc9fafd19 change #who to return a proper object
Claus Gittinger <cg@exept.de>
parents: 1813
diff changeset
  2787
4accc9fafd19 change #who to return a proper object
Claus Gittinger <cg@exept.de>
parents: 1813
diff changeset
  2788
    "/ sigh - full compatibility ?
4accc9fafd19 change #who to return a proper object
Claus Gittinger <cg@exept.de>
parents: 1813
diff changeset
  2789
4accc9fafd19 change #who to return a proper object
Claus Gittinger <cg@exept.de>
parents: 1813
diff changeset
  2790
    index isInteger ifFalse:[
3030
fc5d632d133f when compiling a lazy method, use the classes namespace
Claus Gittinger <cg@exept.de>
parents: 2979
diff changeset
  2791
	^ self indexNotInteger
1851
4accc9fafd19 change #who to return a proper object
Claus Gittinger <cg@exept.de>
parents: 1813
diff changeset
  2792
    ].
4accc9fafd19 change #who to return a proper object
Claus Gittinger <cg@exept.de>
parents: 1813
diff changeset
  2793
    ^ self subscriptBoundsError:index
4accc9fafd19 change #who to return a proper object
Claus Gittinger <cg@exept.de>
parents: 1813
diff changeset
  2794
4accc9fafd19 change #who to return a proper object
Claus Gittinger <cg@exept.de>
parents: 1813
diff changeset
  2795
! !
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
!Method::MethodWhoInfo methodsFor:'private accessing'!
4accc9fafd19 change #who to return a proper object
Claus Gittinger <cg@exept.de>
parents: 1813
diff changeset
  2798
4accc9fafd19 change #who to return a proper object
Claus Gittinger <cg@exept.de>
parents: 1813
diff changeset
  2799
class:cls selector:sel
4accc9fafd19 change #who to return a proper object
Claus Gittinger <cg@exept.de>
parents: 1813
diff changeset
  2800
    myClass := cls.
4accc9fafd19 change #who to return a proper object
Claus Gittinger <cg@exept.de>
parents: 1813
diff changeset
  2801
    mySelector := sel
4accc9fafd19 change #who to return a proper object
Claus Gittinger <cg@exept.de>
parents: 1813
diff changeset
  2802
4accc9fafd19 change #who to return a proper object
Claus Gittinger <cg@exept.de>
parents: 1813
diff changeset
  2803
4accc9fafd19 change #who to return a proper object
Claus Gittinger <cg@exept.de>
parents: 1813
diff changeset
  2804
! !
4accc9fafd19 change #who to return a proper object
Claus Gittinger <cg@exept.de>
parents: 1813
diff changeset
  2805
1775
6892b91ddc0b F_CALLED flag is no longer present
Claus Gittinger <cg@exept.de>
parents: 1692
diff changeset
  2806
!Method class methodsFor:'documentation'!
872
af04035b443d binary class storage support
Claus Gittinger <cg@exept.de>
parents: 829
diff changeset
  2807
952
d600e08a5936 handle the case where a method has a sourceFileInfo, but the class has not
Claus Gittinger <cg@exept.de>
parents: 934
diff changeset
  2808
version
5721
5f97733ff519 methods now send change-notifications when the category changes
Claus Gittinger <cg@exept.de>
parents: 5704
diff changeset
  2809
    ^ '$Header: /cvs/stx/stx/libbasic/Method.st,v 1.217 2000-11-21 23:31:50 cg Exp $'
1
a27a279701f8 Initial revision
claus
parents:
diff changeset
  2810
! !
952
d600e08a5936 handle the case where a method has a sourceFileInfo, but the class has not
Claus Gittinger <cg@exept.de>
parents: 934
diff changeset
  2811
Method initialize!