Ver código fonte

[typer] allow rich argument names for externs

see #9575
Simon Krajewski 5 anos atrás
pai
commit
f8317d2c0a

+ 1 - 1
src/typing/typeloadFields.ml

@@ -1216,7 +1216,7 @@ let create_method (ctx,cctx,fctx) c f fd p =
 				begin if ctx.com.platform = Flash && c.cl_extern then
 				begin if ctx.com.platform = Flash && c.cl_extern then
 					()
 					()
 				else
 				else
-					ignore(TypeloadFunction.process_function_arg ctx n t ct fctx.is_display_field pn)
+					ignore(TypeloadFunction.process_function_arg ctx n t ct fctx.is_display_field (not c.cl_extern && not fctx.is_extern) pn)
 				end;
 				end;
 				if fctx.is_display_field && DisplayPosition.display_position#enclosed_in pn then begin
 				if fctx.is_display_field && DisplayPosition.display_position#enclosed_in pn then begin
 					let v = add_local_with_origin ctx TVOArgument n t pn in
 					let v = add_local_with_origin ctx TVOArgument n t pn in

+ 3 - 3
src/typing/typeloadFunction.ml

@@ -93,13 +93,13 @@ let type_function_arg_value ctx t c do_display =
 			in
 			in
 			loop e
 			loop e
 
 
-let process_function_arg ctx n t c do_display p =
-	if starts_with n '$' then error "Function argument names starting with a dollar are not allowed" p;
+let process_function_arg ctx n t c do_display check_name p =
+	if check_name && starts_with n '$' then error "Function argument names starting with a dollar are not allowed" p;
 	type_function_arg_value ctx t c do_display
 	type_function_arg_value ctx t c do_display
 
 
 let type_function ctx args ret fmode f do_display p =
 let type_function ctx args ret fmode f do_display p =
 	let fargs = List.map2 (fun (n,c,t) ((_,pn),_,m,_,_) ->
 	let fargs = List.map2 (fun (n,c,t) ((_,pn),_,m,_,_) ->
-		let c = process_function_arg ctx n t c do_display pn in
+		let c = process_function_arg ctx n t c do_display true pn in
 		let v = add_local_with_origin ctx TVOArgument n t pn in
 		let v = add_local_with_origin ctx TVOArgument n t pn in
 		v.v_meta <- v.v_meta @ m;
 		v.v_meta <- v.v_meta @ m;
 		if do_display && DisplayPosition.display_position#enclosed_in pn then
 		if do_display && DisplayPosition.display_position#enclosed_in pn then

+ 0 - 0
tests/misc/projects/Issue7752/compile2-fail.hxml → tests/misc/projects/Issue7752/compile2-fail.hxml.disabled