소스 검색

[python] don't generate args default expressions
in functions declarations (fixes #8542)

Aleksandr Kuzmenko 6 년 전
부모
커밋
fc214bf883
3개의 변경된 파일13개의 추가작업 그리고 1개의 파일을 삭제
  1. 1 1
      src/generators/genpy.ml
  2. 9 0
      tests/misc/python/projects/Issue8542/Main.hx
  3. 3 0
      tests/misc/python/projects/Issue8542/build.hxml

+ 1 - 1
src/generators/genpy.ml

@@ -1145,7 +1145,7 @@ module Printer = struct
 						| None -> ""
 						| Some ct ->
 							had_value := true;
-							Printf.sprintf " = %s" (print_expr pctx ct)
+							" = None"
 		) args in
 		String.concat "," sl
 

+ 9 - 0
tests/misc/python/projects/Issue8542/Main.hx

@@ -0,0 +1,9 @@
+class Main {
+	public function new(e:E = E.Ea) {}
+
+	public static function main(){}
+}
+
+enum E {
+	Ea;
+}

+ 3 - 0
tests/misc/python/projects/Issue8542/build.hxml

@@ -0,0 +1,3 @@
+-python bin/test.py
+--main Main
+-cmd python3 bin/test.py