src/ProxyMethodTypeCheckNode.st
branchjk_new_structure
changeset 1356 0dd28400803e
equal deleted inserted replaced
1355:bee821fd9354 1356:0dd28400803e
       
     1 "
       
     2  Copyright (c) 2010-2011 Jan Vrany, Jan Kurs & Marcel Hlopko,
       
     3                          SWING Research Group, Czech Technical University 
       
     4                          in Prague
       
     5 
       
     6  Permission is hereby granted, free of charge, to any person
       
     7  obtaining a copy of this software and associated documentation
       
     8  files (the 'Software'), to deal in the Software without
       
     9  restriction, including without limitation the rights to use,
       
    10  copy, modify, merge, publish, distribute, sublicense, and/or sell
       
    11  copies of the Software, and to permit persons to whom the
       
    12  Software is furnished to do so, subject to the following
       
    13  conditions:
       
    14 
       
    15  The above copyright notice and this permission notice shall be
       
    16  included in all copies or substantial portions of the Software.
       
    17 
       
    18  THE SOFTWARE IS PROVIDED 'AS IS', WITHOUT WARRANTY OF ANY KIND,
       
    19  EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES
       
    20  OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
       
    21  NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT
       
    22  HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY,
       
    23  WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
       
    24  FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
       
    25  OTHER DEALINGS IN THE SOFTWARE.
       
    26 "
       
    27 "{ Package: 'stx:libjava' }"
       
    28 
       
    29 ProxyMethodConditionNode subclass:#ProxyMethodTypeCheckNode
       
    30 	instanceVariableNames:'argument type'
       
    31 	classVariableNames:''
       
    32 	poolDictionaries:''
       
    33 	category:'System-Compiler-Interop'
       
    34 !
       
    35 
       
    36 !ProxyMethodTypeCheckNode class methodsFor:'documentation'!
       
    37 
       
    38 copyright
       
    39 "
       
    40  Copyright (c) 2010-2011 Jan Vrany, Jan Kurs & Marcel Hlopko,
       
    41                          SWING Research Group, Czech Technical University 
       
    42                          in Prague
       
    43 
       
    44  Permission is hereby granted, free of charge, to any person
       
    45  obtaining a copy of this software and associated documentation
       
    46  files (the 'Software'), to deal in the Software without
       
    47  restriction, including without limitation the rights to use,
       
    48  copy, modify, merge, publish, distribute, sublicense, and/or sell
       
    49  copies of the Software, and to permit persons to whom the
       
    50  Software is furnished to do so, subject to the following
       
    51  conditions:
       
    52 
       
    53  The above copyright notice and this permission notice shall be
       
    54  included in all copies or substantial portions of the Software.
       
    55 
       
    56  THE SOFTWARE IS PROVIDED 'AS IS', WITHOUT WARRANTY OF ANY KIND,
       
    57  EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES
       
    58  OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
       
    59  NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT
       
    60  HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY,
       
    61  WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
       
    62  FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
       
    63  OTHER DEALINGS IN THE SOFTWARE.
       
    64 
       
    65 "
       
    66 ! !
       
    67 
       
    68 !ProxyMethodTypeCheckNode class methodsFor:'instance creation'!
       
    69 
       
    70 type: type argument: argIndex
       
    71 
       
    72     ^self new type: type; argument: argIndex
       
    73 
       
    74     "Created: / 23-12-2011 / 12:36:28 / Jan Vrany <jan.vrany@fit.cvut.cz>"
       
    75 ! !
       
    76 
       
    77 !ProxyMethodTypeCheckNode methodsFor:'accessing'!
       
    78 
       
    79 argument
       
    80     ^ argument
       
    81 !
       
    82 
       
    83 argument:something
       
    84     argument := something.
       
    85 !
       
    86 
       
    87 type
       
    88     ^ type
       
    89 !
       
    90 
       
    91 type:something
       
    92     type := something.
       
    93 ! !
       
    94 
       
    95 !ProxyMethodTypeCheckNode methodsFor:'evaluating'!
       
    96 
       
    97 evaluateWithReceiver:receiver arguments:arguments
       
    98 
       
    99     ^(arguments at: argument) isNil or:[(arguments at: argument) class == type]
       
   100 
       
   101     "Modified: / 04-01-2012 / 21:19:32 / Jan Vrany <jan.vrany@fit.cvut.cz>"
       
   102 ! !
       
   103 
       
   104 !ProxyMethodTypeCheckNode methodsFor:'generating'!
       
   105 
       
   106 generate:compiler
       
   107     "Generate a ParseNode that evaluate myself. Used for
       
   108      byte-compiling the proxies"
       
   109 
       
   110     | arg |
       
   111 
       
   112     arg := compiler args at: argument.
       
   113 
       
   114     ^MessageNode 
       
   115         receiver: (MessageNode receiver: arg selector: #isNil)
       
   116         selector: #or:
       
   117         arg: (BlockNode 
       
   118                 withExpression:
       
   119                     (MessageNode
       
   120                         receiver: (MessageNode receiver: arg selector: #class)
       
   121                         selector: #==
       
   122                         arg: (ConstantNode value: type))
       
   123                 in: nil)
       
   124 
       
   125     "Modified: / 04-01-2012 / 21:33:34 / Jan Vrany <jan.vrany@fit.cvut.cz>"
       
   126 ! !
       
   127 
       
   128 !ProxyMethodTypeCheckNode methodsFor:'testing'!
       
   129 
       
   130 isProxyMethodTypeCheckNode
       
   131     ^ true
       
   132 ! !
       
   133 
       
   134 !ProxyMethodTypeCheckNode class methodsFor:'documentation'!
       
   135 
       
   136 version_SVN
       
   137     ^ '$Id$'
       
   138 ! !