compiler: associate escape_marks to to frame (because of inlining)
authorJean Privat <jean@pryen.org>
Mon, 15 Dec 2014 15:08:28 +0000 (10:08 -0500)
committerJean Privat <jean@pryen.org>
Mon, 15 Dec 2014 15:08:28 +0000 (10:08 -0500)
Signed-off-by: Jean Privat <jean@pryen.org>

src/compiler/abstract_compiler.nit

index ca3269e..00a226c 100644 (file)
@@ -1279,11 +1279,11 @@ abstract class AbstractCompilerVisitor
        fun escapemark_name(e: nullable EscapeMark): String
        do
                assert e != null
-               if escapemark_names.has_key(e) then return escapemark_names[e]
+               if frame.escapemark_names.has_key(e) then return frame.escapemark_names[e]
                var name = e.name
                if name == null then name = "label"
                name = get_name(name)
-               escapemark_names[e] = name
+               frame.escapemark_names[e] = name
                return name
        end
 
@@ -1295,8 +1295,6 @@ abstract class AbstractCompilerVisitor
                add("BREAK_{escapemark_name(e)}: (void)0;")
        end
 
-       private var escapemark_names = new HashMap[EscapeMark, String]
-
        # Return a "const char*" variable associated to the classname of the dynamic type of an object
        # NOTE: we do not return a `RuntimeVariable` "NativeString" as the class may not exist in the module/program
        fun class_name_string(value: RuntimeVariable): String is abstract
@@ -1681,6 +1679,10 @@ class Frame
 
        # The label at the end of the property
        var returnlabel: nullable String = null is writable
+
+       # Labels associated to a each escapemarks.
+       # Because of inlinings, escape-marks must be associated to their context (the frame)
+       private var escapemark_names = new HashMap[EscapeMark, String]
 end
 
 redef class MType