| 1204 | } |
| 1205 | |
| 1206 | void VisjectExecutor::ProcessGroupComparisons(Box* box, Node* node, Value& value) |
| 1207 | { |
| 1208 | switch (node->TypeID) |
| 1209 | { |
| 1210 | // ==, !=, >, <=, >= |
| 1211 | case 1: |
| 1212 | case 2: |
| 1213 | case 3: |
| 1214 | case 4: |
| 1215 | case 5: |
| 1216 | case 6: |
| 1217 | { |
| 1218 | const Value a = tryGetValue(node->GetBox(0), 0, node->Values[0]); |
| 1219 | const Value b = tryGetValue(node->GetBox(1), 1, node->Values[1]).Cast(a.Type); |
| 1220 | bool result = false; |
| 1221 | switch (node->TypeID) |
| 1222 | { |
| 1223 | case 1: |
| 1224 | result = a == b; |
| 1225 | break; |
| 1226 | case 2: |
| 1227 | result = a != b; |
| 1228 | break; |
| 1229 | case 3: |
| 1230 | result = a > b; |
| 1231 | break; |
| 1232 | case 4: |
| 1233 | result = a < b; |
| 1234 | break; |
| 1235 | case 5: |
| 1236 | result = a <= b; |
| 1237 | break; |
| 1238 | case 6: |
| 1239 | result = a >= b; |
| 1240 | break; |
| 1241 | } |
| 1242 | value = result; |
| 1243 | break; |
| 1244 | } |
| 1245 | // Switch On Bool |
| 1246 | case 7: |
| 1247 | { |
| 1248 | const Value condition = tryGetValue(node->GetBox(0), Value::False); |
| 1249 | if (condition) |
| 1250 | value = tryGetValue(node->GetBox(2), 1, Value::Zero); |
| 1251 | else |
| 1252 | value = tryGetValue(node->GetBox(1), 0, Value::Zero); |
| 1253 | break; |
| 1254 | } |
| 1255 | // Switch On Enum |
| 1256 | case 8: |
| 1257 | { |
| 1258 | const Value v = tryGetValue(node->GetBox(0), Value::Null); |
| 1259 | if (v.Type.Type == VariantType::Enum && node->Values.Count() == 1 && node->Values[0].Type.Type == VariantType::Blob) |
| 1260 | { |
| 1261 | int32* dataValues = (int32*)node->Values[0].AsBlob.Data; |
| 1262 | int32 dataValuesCount = node->Values[0].AsBlob.Length / 4; |
| 1263 | int32 vAsInt = (int32)v; |