Bladeren bron

Added possibility to do string appends through + operator (order of
operation is weird)

Yentl Van Tendeloo 9 jaren geleden
bovenliggende
commit
36cf45eded
1 gewijzigde bestanden met toevoegingen van 4 en 0 verwijderingen
  1. 4 0
      interface/HUTN/hutn_compiler/semantics_visitor.py

+ 4 - 0
interface/HUTN/hutn_compiler/semantics_visitor.py

@@ -283,6 +283,10 @@ class SemanticsVisitor(Visitor):
 
     @staticmethod
     def call_name_binary(operand_type, operator):
+        # String joins should also be possible
+        if str(operand_type) == "String":
+            if operator.head == "PLUS":
+                return "string_join"
         call_name = "{}_{}".format(SemanticsVisitor.types[str(operand_type)],
                                    SemanticsVisitor.binary_ops[operator.head])