Explorar o código

Add meaningful error message on empty blocks in compiled HUTN files

Yentl Van Tendeloo %!s(int64=8) %!d(string=hai) anos
pai
achega
fbfd65de20
Modificáronse 1 ficheiros con 2 adicións e 0 borrados
  1. 2 0
      interface/HUTN/hutn_compiler/primitives_visitor.py

+ 2 - 0
interface/HUTN/hutn_compiler/primitives_visitor.py

@@ -322,6 +322,8 @@ class PrimitivesVisitor(Visitor):
                     break
         for i in range(len(primitives)-1):
             self.dict(primitives[i], "next", primitives[i+1])
+        if len(primitives) == 0:
+            raise Exception("Block with no body found at %s" % tree.get_reference_line())
         self.set_primitive(tree, primitives[0])
 
     def visit_func_body(self, tree):