|
@@ -4487,11 +4487,12 @@ class script_writer common_ctx ctx filename =
|
|
|
this#writeBool v.v_capture;
|
|
|
this#writeType v.v_type;
|
|
|
method writeList prefix len = this#write (prefix ^" " ^ (string_of_int (len)) ^ "\n");
|
|
|
- method checkCast toType expr forceCast =
|
|
|
+ method checkCast toType expr forceCast fromGenExpression=
|
|
|
let write_cast text =
|
|
|
- this#begin_expr;
|
|
|
- this#write ((string_of_int (Lexer.get_error_line expr.epos) ) ^ "\t" ^ (this#fileText expr.epos.pfile) ^ indent);
|
|
|
+ if (not fromGenExpression) then
|
|
|
+ this#write ( (this#fileText expr.epos.pfile) ^ "\t" ^ (string_of_int (Lexer.get_error_line expr.epos) ) ^ indent);
|
|
|
this#write (text ^"\n" );
|
|
|
+ this#begin_expr;
|
|
|
this#gen_expression expr;
|
|
|
this#end_expr;
|
|
|
true;
|
|
@@ -4572,7 +4573,7 @@ class script_writer common_ctx ctx filename =
|
|
|
| TBinop (op,e1,e2) when op=OpAssign ->
|
|
|
this#write ("SET \n");
|
|
|
this#gen_expression e1;
|
|
|
- this#checkCast e1.etype e2 false;
|
|
|
+ this#checkCast e1.etype e2 false false;
|
|
|
| TBinop (OpEq ,e1, { eexpr = TConst TNull } ) -> this#write "ISNULL\n";
|
|
|
this#gen_expression e1;
|
|
|
| TBinop (OpNotEq ,e1, { eexpr = TConst TNull }) -> this#write "NOTNULL\n";
|
|
@@ -4633,7 +4634,7 @@ class script_writer common_ctx ctx filename =
|
|
|
let matched_args = match func.etype with
|
|
|
| TFun (args,_) ->
|
|
|
( try (
|
|
|
- List.iter2 (fun (_,_,protoT) arg -> this#checkCast protoT arg false ) args arg_list;
|
|
|
+ List.iter2 (fun (_,_,protoT) arg -> this#checkCast protoT arg false false) args arg_list;
|
|
|
true; )
|
|
|
with Invalid_argument _ -> (*print_endline "Bad count?";*) false )
|
|
|
| _ -> false
|
|
@@ -4686,7 +4687,7 @@ class script_writer common_ctx ctx filename =
|
|
|
this#writeVar tvar;
|
|
|
this#write (" " ^ (this#typeText init.etype));
|
|
|
this#write "\n";
|
|
|
- this#checkCast tvar.v_type init false);
|
|
|
+ this#checkCast tvar.v_type init false false);
|
|
|
| TNew (clazz,params,arg_list) ->
|
|
|
this#write ("NEW " ^ (this#typeText (TInst(clazz,params))) ^ (string_of_int (List.length arg_list)) ^ "\n");
|
|
|
List.iter this#gen_expression arg_list;
|
|
@@ -4746,7 +4747,7 @@ class script_writer common_ctx ctx filename =
|
|
|
this#gen_expression catch_expr;
|
|
|
) catches;
|
|
|
| TCast (cast,None) -> error "Unexpected cast" expression.epos
|
|
|
- | TCast (cast,Some _) -> this#checkCast expression.etype cast true
|
|
|
+ | TCast (cast,Some _) -> this#checkCast expression.etype cast true true
|
|
|
| TParenthesis _ -> error "Unexpected parens" expression.epos
|
|
|
| TMeta(_,_) -> error "Unexpected meta" expression.epos
|
|
|
| TPatMatch _ -> error "Unexpected pattern match" expression.epos
|