removed unneeded text

This commit is contained in:
hyunghwan.chung
2016-05-07 01:37:44 +00:00
parent f9ad51b5c5
commit 4bbd5b52bb
14 changed files with 81 additions and 159 deletions

View File

@ -201,7 +201,45 @@
^true.
}
## -------------------------------------------------------
## -------------------------------------------------------
#method(#class) inheritsFrom: aClass
{
| c |
c := self superclass.
[c notNil] whileTrue: [
[ c == aClass ] ifTrue: [^true].
c := c superclass.
].
^false
}
#method(#class) isMemberOf: aClass
{
## a class object is an instance of Class
## but Class inherits from Apex. On the other hand,
## most of ordinary classes are under Object again under Apex.
## special consideration is required here.
^aClass == Class
}
#method(#class) isKindOf: aClass
{
^(self isMemberOf: aClass) or: [self inheritsFrom: aClass].
}
#method isMemberOf: aClass
{
^self class == aClass
}
#method isKindOf: aClass
{
^(self isMemberOf: aClass) or: [self class inheritsFrom: aClass].
}
## -------------------------------------------------------
## -------------------------------------------------------
"

View File

@ -14,6 +14,11 @@
^self.
}
## ########################################################################
## most of the following methods can actuall become class methods of Apex.
## ########################################################################
#method name
{
^self.name
@ -31,7 +36,7 @@
^self.spec bitShift: -7
}
#method inheritsFrom: aSuperclass
"#method inheritsFrom: aSuperclass
{
| c |
c := self superclass.
@ -40,5 +45,5 @@
c := c superclass.
].
^false
}
}"
}

View File

@ -56,7 +56,7 @@
^self.method preambleCode == 10.
}
#method findExceptionHandlerBlock: anException
#method findExceptionHandlerBlock: anExceptionClass
{
## for this to work, self must be an exception handler context.
## For a single on:do: call,
@ -70,7 +70,7 @@
bound := self basicSize - 1.
8 to: bound by: 2 do: [ :i |
exc := self basicAt: i.
((anException == exc) or: [anException inheritsFrom: exc]) ifTrue: [^self basicAt: (i + 1)].
((anExceptionClass == exc) or: [anExceptionClass inheritsFrom: exc]) ifTrue: [^self basicAt: (i + 1)].
]
].
^nil.
@ -415,13 +415,13 @@ thisContext isExceptionHandlerContext dump.
ctx := thisContext.
[ctx notNil] whileTrue: [
(ctx class == MethodContext)
ifTrue: [ (ctx method owner name, ' - ', ctx method name) dump ].
ifTrue: [ (ctx method owner name, '>>', ctx method name) dump ].
## TODO: include blockcontext???
ctx := ctx sender.
].
PrimitiveFailureException signal: 'PRIMITIVE FAILED'.
}
#method(#class) cannotInstantiate
{
Exception signal: 'Cannot instantiate'.

View File

@ -5,6 +5,8 @@
#include 'Boolean.st'.
#########################################################################################
#class Error(Object)
{
#method(#class) signal: aString
@ -350,3 +352,7 @@ f isNil ifTrue: [ self error: 'No such function' ].
}
#########################################################################################
## #include 'Console.st'

View File

@ -171,13 +171,28 @@
## self test4.
## self test5.
## self test11.
self test11.
## self test12.
##100 timesRepeat: ['>>>>> END OF MAIN' dump].
"(Exception isKindOf: Apex) dump.
(Exception isMemberOf: Apex) dump.
(Exception isMemberOf: Class) dump.
(1 isMemberOf: SmallInteger) dump.
(1 isKindOf: Integer) dump.
(1 isKindOf: Class) dump.
(1 isKindOf: Apex) dump.
(Exception isKindOf: Class) dump.
(Exception isKindOf: Apex) dump.
(Exception isKindOf: Object) dump.
(Exception isKindOf: (Apex new)) dump.
(Exception isKindOf: (Object new)) dump."
'@@@@@@@@@@@@@@@@@@@@@@@@@@@@' dump.
## the following line(return:to:) must cause primitive failure...
[ Processor return: 10 to: 20. ] on: Exception do: [:ex | ex messageText dump].
##[ Processor return: 10 to: 20. ] on: Exception do: [:ex | ex messageText dump].
##[ Processor return: 10 to: 20. ]
## on: PrimitiveFailureException do: [:ex | 'PRIMITIVE FAILURE CAUGHT HERE HERE HERE' dump]