VariableNode.st
changeset 3622 834a43f3bbfa
parent 3574 2fcbcae02707
child 3725 03c05fd2cf6a
equal deleted inserted replaced
3621:706bc503cdb4 3622:834a43f3bbfa
   987         ^ aCompiler methodArgs indexOf:name.
   987         ^ aCompiler methodArgs indexOf:name.
   988     ].
   988     ].
   989     ^ index
   989     ^ index
   990 
   990 
   991     "Created: / 06-08-2006 / 16:03:56 / cg"
   991     "Created: / 06-08-2006 / 16:03:56 / cg"
   992 !
   992 ! !
       
   993 
       
   994 !VariableNode methodsFor:'testing'!
   993 
   995 
   994 isArgument
   996 isArgument
   995     "return true, if this is a node for an argument (block or method)"
   997     "return true, if this is a node for an argument (block or method)"
   996 
   998 
   997     ^ (type == #MethodArg) or:[type == #BlockArg]
   999     ^ (type == #MethodArg) or:[type == #BlockArg]
  1037     "return true, if this is a node for global variable"
  1039     "return true, if this is a node for global variable"
  1038 
  1040 
  1039     ^ type == #GlobalVariable
  1041     ^ type == #GlobalVariable
  1040 !
  1042 !
  1041 
  1043 
       
  1044 isInstance
       
  1045     <resource: #obsolete>
       
  1046 
       
  1047     self obsoleteMethodWarning.
       
  1048     ^ self isInstanceVariable
       
  1049 !
       
  1050 
  1042 isInstanceVariable
  1051 isInstanceVariable
  1043     ^ type == #InstanceVariable
  1052     ^ type == #InstanceVariable
  1044 !
  1053 !
  1045 
  1054 
  1046 isJAVA
  1055 isJAVA
  1048      Used to highlight Java class references."
  1057      Used to highlight Java class references."
  1049 
  1058 
  1050     ^ (type == #GlobalVariable) and:[name = 'JAVA']
  1059     ^ (type == #GlobalVariable) and:[name = 'JAVA']
  1051 
  1060 
  1052     "Created: / 19-04-2012 / 09:38:10 / Jan Vrany <jan.vrany@fit.cvut.cz>"
  1061     "Created: / 19-04-2012 / 09:38:10 / Jan Vrany <jan.vrany@fit.cvut.cz>"
  1053 !
       
  1054 
       
  1055 isLocal
       
  1056     "return true, if this is a node for a local (block or method) variable"
       
  1057 
       
  1058     ^ self isLocalVariable
       
  1059 !
       
  1060 
       
  1061 isLocalVariable
       
  1062     "return true, if this is a node for a local (block or method) variable"
       
  1063 
       
  1064     ^ (type == #MethodVariable) or:[type == #BlockVariable]
       
  1065 !
       
  1066 
       
  1067 isMethodArg
       
  1068     ^ type == #MethodArg
       
  1069 !
       
  1070 
       
  1071 isMethodVariable
       
  1072     ^ type == #MethodVariable
       
  1073 !
       
  1074 
       
  1075 isPoolVariable
       
  1076     ^ type == #PoolVariable
       
  1077 !
       
  1078 
       
  1079 isUndeclared
       
  1080     |sym|
       
  1081 
       
  1082     type == #PrivateClass ifTrue:[
       
  1083         sym := (value name , '::' , name) asSymbolIfInterned.
       
  1084         ^ sym isNil or:[(Smalltalk includesKey:sym) not].
       
  1085     ].
       
  1086     type == #GlobalVariable ifTrue:[
       
  1087         sym := name asSymbolIfInterned.
       
  1088         ^ sym isNil or:[(Smalltalk includesKey:sym) not]
       
  1089     ].
       
  1090     ^ false
       
  1091 
       
  1092     "Modified: / 05-09-2013 / 02:35:27 / Jan Vrany <jan.vrany@fit.cvut.cz>"
       
  1093 !
       
  1094 
       
  1095 isVariable
       
  1096     "return true, if this is a node for a variable"
       
  1097 
       
  1098     ^ true
       
  1099 
       
  1100     "Created: 14.4.1996 / 00:46:32 / cg"
       
  1101 ! !
       
  1102 
       
  1103 !VariableNode methodsFor:'testing'!
       
  1104 
       
  1105 isInstance
       
  1106     <resource: #obsolete>
       
  1107 
       
  1108     self obsoleteMethodWarning.
       
  1109     ^ self isInstanceVariable
       
  1110 !
  1062 !
  1111 
  1063 
  1112 isJavaPackageReference
  1064 isJavaPackageReference
  1113     "Return true, given node is JAVA package reference in form:
  1065     "Return true, given node is JAVA package reference in form:
  1114         JAVA package1 package2 
  1066         JAVA package1 package2 
  1115     "
  1067     "
  1116 
  1068 
  1117     ^self isJAVA
  1069     ^self isJAVA
  1118 
  1070 
  1119     "Created: / 19-04-2012 / 09:53:06 / Jan Vrany <jan.vrany@fit.cvut.cz>"
  1071     "Created: / 19-04-2012 / 09:53:06 / Jan Vrany <jan.vrany@fit.cvut.cz>"
       
  1072 !
       
  1073 
       
  1074 isLocal
       
  1075     "return true, if this is a node for a local (block or method) variable"
       
  1076 
       
  1077     ^ self isLocalVariable
       
  1078 !
       
  1079 
       
  1080 isLocalVariable
       
  1081     "return true, if this is a node for a local (block or method) variable"
       
  1082 
       
  1083     ^ (type == #MethodVariable) or:[type == #BlockVariable]
       
  1084 !
       
  1085 
       
  1086 isMethodArg
       
  1087     ^ type == #MethodArg
       
  1088 !
       
  1089 
       
  1090 isMethodVariable
       
  1091     ^ type == #MethodVariable
       
  1092 !
       
  1093 
       
  1094 isPoolVariable
       
  1095     ^ type == #PoolVariable
       
  1096 !
       
  1097 
       
  1098 isUndeclared
       
  1099     |sym|
       
  1100 
       
  1101     type == #PrivateClass ifTrue:[
       
  1102         sym := (value name , '::' , name) asSymbolIfInterned.
       
  1103         ^ sym isNil or:[(Smalltalk includesKey:sym) not].
       
  1104     ].
       
  1105     type == #GlobalVariable ifTrue:[
       
  1106         sym := name asSymbolIfInterned.
       
  1107         ^ sym isNil or:[(Smalltalk includesKey:sym) not]
       
  1108     ].
       
  1109     ^ false
       
  1110 
       
  1111     "Modified: / 05-09-2013 / 02:35:27 / Jan Vrany <jan.vrany@fit.cvut.cz>"
       
  1112 !
       
  1113 
       
  1114 isVariable
       
  1115     "return true, if this is a node for a variable"
       
  1116 
       
  1117     ^ true
       
  1118 
       
  1119     "Created: 14.4.1996 / 00:46:32 / cg"
  1120 ! !
  1120 ! !
  1121 
  1121 
  1122 !VariableNode methodsFor:'visiting'!
  1122 !VariableNode methodsFor:'visiting'!
  1123 
  1123 
  1124 acceptVisitor:aVisitor 
  1124 acceptVisitor:aVisitor 
  1131 ! !
  1131 ! !
  1132 
  1132 
  1133 !VariableNode class methodsFor:'documentation'!
  1133 !VariableNode class methodsFor:'documentation'!
  1134 
  1134 
  1135 version
  1135 version
  1136     ^ '$Header: /cvs/stx/stx/libcomp/VariableNode.st,v 1.103 2015-02-06 10:36:04 stefan Exp $'
  1136     ^ '$Header: /cvs/stx/stx/libcomp/VariableNode.st,v 1.104 2015-04-17 15:15:02 stefan Exp $'
  1137 !
  1137 !
  1138 
  1138 
  1139 version_CVS
  1139 version_CVS
  1140     ^ '$Header: /cvs/stx/stx/libcomp/VariableNode.st,v 1.103 2015-02-06 10:36:04 stefan Exp $'
  1140     ^ '$Header: /cvs/stx/stx/libcomp/VariableNode.st,v 1.104 2015-04-17 15:15:02 stefan Exp $'
  1141 ! !
  1141 ! !
  1142 
  1142