Browse Source

rename params of functions, fix #4016

frabbit 10 năm trước cách đây
mục cha
commit
17c8ae600d
2 tập tin đã thay đổi với 3 bổ sung2 xóa
  1. 1 0
      genpy.ml
  2. 2 2
      std/haxe/io/Bytes.hx

+ 1 - 0
genpy.ml

@@ -1091,6 +1091,7 @@ module Printer = struct
 		let had_kw_args = ref false in
 		let sl = List.map (fun (v,cto) ->
 			let check_err () = if !had_var_args || !had_kw_args then error "Arguments after KwArgs/VarArgs are not allowed" p in
+			KeywordHandler.check_var_declaration v;
 			let name = handle_keywords v.v_name in
 			match follow v.v_type with
 				| TAbstract({a_path = ["python"],"KwArgs"},_) ->

+ 2 - 2
std/haxe/io/Bytes.hx

@@ -92,7 +92,7 @@ class Bytes {
 		#elseif cs
 		cs.system.Array.Copy(src.b, srcpos, b, pos, len);
 		#elseif python
-		python.Syntax.pythonCode("self.b[pos:pos+len] = src.b[srcpos:srcpos+len]");
+		python.Syntax.pythonCode("self.b[{0}:{0}+{1}] = src.b[srcpos:srcpos+{1}]", pos, len);
 		#elseif cpp
 		b.blit(pos, src.b, srcpos, len);
 		#else
@@ -380,7 +380,7 @@ class Bytes {
 			return new String(b, pos, len, "UTF-8")
 		catch (e:Dynamic) throw e;
 		#elseif python
-		return python.Syntax.pythonCode("self.b[pos:pos+len].decode('UTF-8','replace')");
+		return python.Syntax.pythonCode("self.b[{0}:{0}+{1}].decode('UTF-8','replace')", pos, len);
 		#else
 		var s = "";
 		var b = b;