Jelajahi Sumber

[lua] fix #5323 and add unit test

Justin Donaldson 9 tahun lalu
induk
melakukan
564270f94c
2 mengubah file dengan 18 tambahan dan 1 penghapusan
  1. 1 1
      src/generators/genlua.ml
  2. 17 0
      tests/unit/src/unit/issues/Issue5323.hx

+ 1 - 1
src/generators/genlua.ml

@@ -78,7 +78,7 @@ let kwds =
 	    "end"; "false"; "for"; "function"; "if";
 	    "end"; "false"; "for"; "function"; "if";
 	    "in"; "local"; "nil"; "not"; "or"; "repeat";
 	    "in"; "local"; "nil"; "not"; "or"; "repeat";
 	    "return"; "then"; "true"; "until"; "while";
 	    "return"; "then"; "true"; "until"; "while";
-	    "goto"
+	    "goto"; "self";
 	];
 	];
 	h
 	h
 
 

+ 17 - 0
tests/unit/src/unit/issues/Issue5323.hx

@@ -0,0 +1,17 @@
+package unit.issues;
+class Issue5323 extends Test{
+	function new() super();
+    function test() {
+    	var expected = 1;
+        var actual = new Issue5323().doStuff(function() return 0);
+        eq(actual, expected);
+    }
+
+    function doStuff(self) {
+        return doOtherStuff();
+    }
+
+    function doOtherStuff() {
+    	return 1;
+    }
+}