<html>
<head>
<meta content="text/html; charset=ISO-8859-1"
http-equiv="Content-Type">
</head>
<body text="#000000" bgcolor="#FFFFFF">
If what you want is to see the source for a methods and compare that
source to something, then <font face="Georgia"><br>
<br>
aClass sourceCodeAt: aMethod</font> "aMethod is assumed to be a
Symbol here, so aSymbol or aSelector might be a better name"<br>
<br>
will do what you want.<br>
<br>
E.g.<br>
<br>
<font face="Georgia">Array sourceCodeAt: #printOn: <br>
<br>
will give you:<br>
<br>
a Text for 'printOn: aStream<br>
self shouldBePrintedAsLiteral ifTrue: [^self
printAsLiteralFormOn: aStream].<br>
self class = Array ifTrue: [^self printAsBraceFormOn:
aStream].<br>
^super printOn: aStream'<br>
<br>
Cheers,<br>
Bob<br>
<br>
</font>
<div class="moz-cite-prefix">On 4/28/13 4:55 PM, Dvir Faivel wrote:<br>
</div>
<blockquote
cite="mid:CAKK6UNe_=PvzmFyUKg8JHa-nHHPyUU+jsja34xKMYPYJM8n9Bw@mail.gmail.com"
type="cite">
<div dir="ltr">
<div class="gmail_default" style="color:rgb(51,51,255)"><span
style="color:rgb(0,0,0);font-family:arial,sans-serif;font-size:13.333333969116211px;line-height:20px">hi
there,</span><br
style="color:rgb(0,0,0);font-family:arial,sans-serif;font-size:13.333333969116211px;line-height:20px">
<span
style="color:rgb(0,0,0);font-family:arial,sans-serif;font-size:13.333333969116211px;line-height:20px">i
have a question about squeak object model.</span><br
style="color:rgb(0,0,0);font-family:arial,sans-serif;font-size:13.333333969116211px;line-height:20px">
<br
style="color:rgb(0,0,0);font-family:arial,sans-serif;font-size:13.333333969116211px;line-height:20px">
<span
style="color:rgb(0,0,0);font-family:arial,sans-serif;font-size:13.333333969116211px;line-height:20px">how
can i check whether a method contains a certain piece of
code?</span><br
style="color:rgb(0,0,0);font-family:arial,sans-serif;font-size:13.333333969116211px;line-height:20px">
<span
style="color:rgb(0,0,0);font-family:arial,sans-serif;font-size:13.333333969116211px;line-height:20px">i.e
if the method "isKindOf:" has the code "class inheritsFrom"
- return true, otherwise - return false (in this
case, isKindOf indeed has that code, so i expect to get
true).</span><br
style="color:rgb(0,0,0);font-family:arial,sans-serif;font-size:13.333333969116211px;line-height:20px">
<br
style="color:rgb(0,0,0);font-family:arial,sans-serif;font-size:13.333333969116211px;line-height:20px">
<span
style="color:rgb(0,0,0);font-family:arial,sans-serif;font-size:13.333333969116211px;line-height:20px">obviously
if i know the class+method, than i can check the code in the
Browser, but how can i perform this check at runtime when
the class+methods are given as an input?</span><br
style="color:rgb(0,0,0);font-family:arial,sans-serif;font-size:13.333333969116211px;line-height:20px">
<br
style="color:rgb(0,0,0);font-family:arial,sans-serif;font-size:13.333333969116211px;line-height:20px">
<span
style="color:rgb(0,0,0);font-family:arial,sans-serif;font-size:13.333333969116211px;line-height:20px">if
the class is represented as aClass, the method is
represented as aMethod, and the code to check is: 'check if
this code exist', than i guess the start would be:</span><br
style="color:rgb(0,0,0);font-family:arial,sans-serif;font-size:13.333333969116211px;line-height:20px">
<br
style="color:rgb(0,0,0);font-family:arial,sans-serif;font-size:13.333333969116211px;line-height:20px">
<span
style="color:rgb(0,0,0);font-family:arial,sans-serif;font-size:13.333333969116211px;line-height:20px">checkClass:
aClass andMethod: aMethod</span><br
style="color:rgb(0,0,0);font-family:arial,sans-serif;font-size:13.333333969116211px;line-height:20px">
<span
style="color:rgb(0,0,0);font-family:arial,sans-serif;font-size:13.333333969116211px;line-height:20px">
aClass respondsTo: aMethod</span><br
style="color:rgb(0,0,0);font-family:arial,sans-serif;font-size:13.333333969116211px;line-height:20px">
<span
style="color:rgb(0,0,0);font-family:arial,sans-serif;font-size:13.333333969116211px;line-height:20px">
ifTrue: [ ^ hmmmmm hasCode: 'check if this code
exist' ]</span><br
style="color:rgb(0,0,0);font-family:arial,sans-serif;font-size:13.333333969116211px;line-height:20px">
<span
style="color:rgb(0,0,0);font-family:arial,sans-serif;font-size:13.333333969116211px;line-height:20px">
ifFalse: [ ^ false ]</span><br
style="color:rgb(0,0,0);font-family:arial,sans-serif;font-size:13.333333969116211px;line-height:20px">
<br
style="color:rgb(0,0,0);font-family:arial,sans-serif;font-size:13.333333969116211px;line-height:20px">
<span
style="color:rgb(0,0,0);font-family:arial,sans-serif;font-size:13.333333969116211px;line-height:20px">but
what should i actually check in the ifTrue block?</span></div>
<div class="gmail_default"><font color="#000000">i need to be
able to check this by code, and not with the refactoring
browser.</font><br
style="color:rgb(0,0,0);font-family:arial,sans-serif;font-size:13.333333969116211px;line-height:20px">
<br
style="color:rgb(0,0,0);font-family:arial,sans-serif;font-size:13.333333969116211px;line-height:20px">
<span
style="color:rgb(0,0,0);font-family:arial,sans-serif;font-size:13.333333969116211px;line-height:20px">sorry
for the (very) long question.</span><br
style="color:rgb(0,0,0);font-family:arial,sans-serif;font-size:13.333333969116211px;line-height:20px">
<span
style="color:rgb(0,0,0);font-family:arial,sans-serif;font-size:13.333333969116211px;line-height:20px">thanks,</span><br
style="color:rgb(0,0,0);font-family:arial,sans-serif;font-size:13.333333969116211px;line-height:20px">
<span
style="color:rgb(0,0,0);font-family:arial,sans-serif;font-size:13.333333969116211px;line-height:20px">dvir.</span><br>
</div>
</div>
<br>
<fieldset class="mimeAttachmentHeader"></fieldset>
<br>
<pre wrap="">
</pre>
</blockquote>
<br>
</body>
</html>