소스 검색

fixed issue with optional parameters in inline functions

Nicolas Cannasse 16 년 전
부모
커밋
c1761c7d5d
2개의 변경된 파일7개의 추가작업 그리고 0개의 파일을 삭제
  1. 1 0
      doc/CHANGES.txt
  2. 6 0
      optimizer.ml

+ 1 - 0
doc/CHANGES.txt

@@ -52,6 +52,7 @@ TODO :
 	php: fixed php.db.Manager (was uncorrectly removing superclass fields)
 	php: fixed php.db.Manager (was uncorrectly removing superclass fields)
 	php: added support for native Iterator and IteratorAggregate interfaces
 	php: added support for native Iterator and IteratorAggregate interfaces
 	all : added --display classes and --display keywords
 	all : added --display classes and --display keywords
+	all : fixed issue with optional parameters in inline functions
 
 
 2009-03-22: 2.03
 2009-03-22: 2.03
 	optimized Type.enumEq : use index instead of tag comparison for neko/flash9/php
 	optimized Type.enumEq : use index instead of tag comparison for neko/flash9/php

+ 6 - 0
optimizer.ml

@@ -33,6 +33,12 @@ let type_inline ctx cf f ethis params tret p =
 		Hashtbl.add hcount name (ref 0);
 		Hashtbl.add hcount name (ref 0);
 		name
 		name
 	) f.tf_args in
 	) f.tf_args in
+	(* use default values for null arguments *)
+	let params = List.map2 (fun e (_,opt,t) ->
+		match e.eexpr, opt with
+		| TConst TNull , Some c -> mk (TConst c) t e.epos
+		| _ -> e
+	) params f.tf_args in
 	let vthis = gen_local ctx ethis.etype in
 	let vthis = gen_local ctx ethis.etype in
 	let this_count = ref 0 in
 	let this_count = ref 0 in
 	let local i =
 	let local i =