JavaScriptFunctionWithBreakpoints.st
author Jan Vrany <jan.vrany@fit.cvut.cz>
Tue, 24 Sep 2013 23:18:24 +0200
branchinitialV
changeset 1180 01c6be61f29c
parent 625 4c814c8123ed
child 749 1a1ce2bdc3d8
permissions -rw-r--r--
checkin from stx browser
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
625
4c814c8123ed initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
     1
"
4c814c8123ed initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
     2
 COPYRIGHT (c) 2013 by Claus Gittinger
4c814c8123ed initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
     3
              All Rights Reserved
4c814c8123ed initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
     4
4c814c8123ed initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
     5
 This software is furnished under a license and may be used
4c814c8123ed initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
     6
 only in accordance with the terms of that license and with the
4c814c8123ed initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
     7
 inclusion of the above copyright notice.   This software may not
4c814c8123ed initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
     8
 be provided or otherwise made available to, or used by, any
4c814c8123ed initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
     9
 other person.  No title to or ownership of the software is
4c814c8123ed initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    10
 hereby transferred.
4c814c8123ed initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    11
"
4c814c8123ed initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    12
"{ Package: 'stx:libjavascript' }"
4c814c8123ed initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    13
4c814c8123ed initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    14
JavaScriptFunction variableSubclass:#JavaScriptFunctionWithBreakpoints
4c814c8123ed initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    15
	instanceVariableNames:'originalMethod'
4c814c8123ed initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    16
	classVariableNames:''
4c814c8123ed initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    17
	poolDictionaries:''
4c814c8123ed initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    18
	category:'Languages-JavaScript-Compiling & Parsing'
4c814c8123ed initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    19
!
4c814c8123ed initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    20
4c814c8123ed initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    21
!JavaScriptFunctionWithBreakpoints class methodsFor:'documentation'!
4c814c8123ed initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    22
4c814c8123ed initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    23
copyright
4c814c8123ed initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    24
"
4c814c8123ed initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    25
 COPYRIGHT (c) 2013 by Claus Gittinger
4c814c8123ed initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    26
              All Rights Reserved
4c814c8123ed initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    27
4c814c8123ed initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    28
 This software is furnished under a license and may be used
4c814c8123ed initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    29
 only in accordance with the terms of that license and with the
4c814c8123ed initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    30
 inclusion of the above copyright notice.   This software may not
4c814c8123ed initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    31
 be provided or otherwise made available to, or used by, any
4c814c8123ed initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    32
 other person.  No title to or ownership of the software is
4c814c8123ed initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    33
 hereby transferred.
4c814c8123ed initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    34
"
4c814c8123ed initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    35
!
4c814c8123ed initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    36
4c814c8123ed initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    37
documentation
4c814c8123ed initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    38
"
4c814c8123ed initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    39
    support for line-Breakpoints
4c814c8123ed initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    40
4c814c8123ed initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    41
    instances of me are created when line-breakpoints are placed.
4c814c8123ed initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    42
    The only function I serve is to provide the originalMethod information,
4c814c8123ed initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    43
    and an easy way to check for having a breakpoint (is breakpointed).
4c814c8123ed initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    44
4c814c8123ed initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    45
    [author:]
4c814c8123ed initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    46
        Claus Gittinger
4c814c8123ed initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    47
4c814c8123ed initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    48
    [see also:]
4c814c8123ed initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    49
        Tools::BreakpointService
4c814c8123ed initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    50
"
4c814c8123ed initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    51
! !
4c814c8123ed initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    52
4c814c8123ed initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    53
!JavaScriptFunctionWithBreakpoints methodsFor:'accessing'!
4c814c8123ed initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    54
4c814c8123ed initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    55
originalMethod
4c814c8123ed initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    56
    ^ originalMethod
4c814c8123ed initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    57
!
4c814c8123ed initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    58
4c814c8123ed initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    59
originalMethod:something
4c814c8123ed initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    60
    originalMethod := something.
4c814c8123ed initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    61
! !
4c814c8123ed initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    62
4c814c8123ed initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    63
!JavaScriptFunctionWithBreakpoints methodsFor:'misc'!
4c814c8123ed initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    64
4c814c8123ed initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    65
restoreOriginalMethod
4c814c8123ed initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    66
    "remove myself - i.e. replace by the original method 
4c814c8123ed initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    67
     (i.e. the one without line breakpoints)"
4c814c8123ed initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    68
4c814c8123ed initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    69
    |cls selector|
4c814c8123ed initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    70
4c814c8123ed initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    71
    (cls := self mclass) notNil ifTrue:[
4c814c8123ed initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    72
        (selector := self selector) notNil ifTrue:[
4c814c8123ed initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    73
            self halt.
4c814c8123ed initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    74
            cls basicAddSelector:selector withMethod:originalMethod    
4c814c8123ed initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    75
        ]
4c814c8123ed initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    76
    ]
4c814c8123ed initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    77
! !
4c814c8123ed initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    78
4c814c8123ed initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    79
!JavaScriptFunctionWithBreakpoints methodsFor:'queries'!
4c814c8123ed initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    80
4c814c8123ed initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    81
isMethodWithBreakpoints
4c814c8123ed initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    82
    ^ true
4c814c8123ed initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    83
4c814c8123ed initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    84
    "Created: / 01-08-2012 / 17:26:59 / cg"
4c814c8123ed initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    85
! !
4c814c8123ed initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    86
4c814c8123ed initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    87
!JavaScriptFunctionWithBreakpoints class methodsFor:'documentation'!
4c814c8123ed initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    88
4c814c8123ed initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    89
version
4c814c8123ed initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    90
    ^ '$Header$'
4c814c8123ed initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    91
!
4c814c8123ed initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    92
4c814c8123ed initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    93
version_CVS
4c814c8123ed initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    94
    ^ '$Header$'
4c814c8123ed initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    95
! !
4c814c8123ed initial checkin
Claus Gittinger <cg@exept.de>
parents:
diff changeset
    96