compiler/TTypechecker.st
changeset 13 97090c2baa33
parent 11 6d39860d0fdb
child 14 fa42d3f1a578
equal deleted inserted replaced
12:d716a8181fc1 13:97090c2baa33
     6 	instanceVariableNames:''
     6 	instanceVariableNames:''
     7 	classVariableNames:''
     7 	classVariableNames:''
     8 	poolDictionaries:''
     8 	poolDictionaries:''
     9 	category:'Languages-Tea-Compiler-Internals'
     9 	category:'Languages-Tea-Compiler-Internals'
    10 !
    10 !
       
    11 
       
    12 !TTypechecker methodsFor:'visiting'!
       
    13 
       
    14 visitArgument: anRBVariableNode
       
    15     | binding |
       
    16 
       
    17 
       
    18     super visitArgument: anRBVariableNode.
       
    19     binding := anRBVariableNode binding.
       
    20     binding type: (anRBVariableNode typeSpec asType)
       
    21 
       
    22     "Created: / 20-09-2015 / 07:19:27 / Jan Vrany <jan.vrany@fit.cvut.cz>"
       
    23 ! !
    11 
    24 
    12 !TTypechecker methodsFor:'visitor-double dispatching'!
    25 !TTypechecker methodsFor:'visitor-double dispatching'!
    13 
    26 
    14 acceptIfTrueIfFalseNode: node
    27 acceptIfTrueIfFalseNode: node
    15     | receiverType booleanType |
    28     | receiverType booleanType |
    36     ].
    49     ].
    37 
    50 
    38     "Created: / 14-09-2015 / 14:18:28 / Jan Vrany <jan.vrany@fit.cvut.cz>"
    51     "Created: / 14-09-2015 / 14:18:28 / Jan Vrany <jan.vrany@fit.cvut.cz>"
    39 !
    52 !
    40 
    53 
       
    54 acceptLiteralNode: aLiteralNode
       
    55     | binding value |
       
    56 
       
    57     binding := aLiteralNode binding.
       
    58     value := binding value.
       
    59     value isInteger ifTrue:[ 
       
    60         binding type: (context environment binding lookupClassSIntegerW) type.
       
    61         ^ self
       
    62     ].
       
    63     value isBoolean ifTrue:[ 
       
    64         binding type: (context environment binding lookupClassBoolean) type.
       
    65         ^ self.
       
    66     ].
       
    67     context reportTypeError: 'Unsupported constant type'.
       
    68 
       
    69     "Created: / 20-09-2015 / 07:13:45 / Jan Vrany <jan.vrany@fit.cvut.cz>"
       
    70 !
       
    71 
    41 acceptMessageNode: aMessageNode 
    72 acceptMessageNode: aMessageNode 
    42     | receiverType receiverBinding methodBinding |
    73     | receiverType receiverBinding methodBinding |
    43 
    74 
    44     super acceptMessageNode: aMessageNode.
    75     super acceptMessageNode: aMessageNode.
    45     receiverType := aMessageNode receiver binding type.
    76     receiverType := aMessageNode receiver binding type.