Permalink
Browse files

[cs] fixed TryCatch error where Std.is() wasn't being transformed int…

…o the "is" operator

- fixed variable naming scope issue

git-svn-id: http://haxe.googlecode.com/svn/trunk@4604 f16182fa-f095-11de-8f43-4547254af6c6
  • Loading branch information...
1 parent f8db42b commit 02c525fe72805b6118789727fde749fc6cb96770 waneck@gmail.com committed May 13, 2012
Showing with 7 additions and 13 deletions.
  1. +2 −2 codegen.ml
  2. +1 −6 gencommon.ml
  3. +3 −3 gencs.ml
  4. +1 −2 genjava.ml
View
@@ -807,8 +807,8 @@ let captured_vars com e =
(* RENAME LOCAL VARS *)
let rename_local_vars com e =
- let as3 = Common.defined com "as3" in
- let no_scope = com.platform = Js || com.platform = Java || com.platform = Cs || as3 in
+ let as3 = Common.defined com "as3" || com.platform = Cs in (* C# demands a similar behavior than AS3 *)
+ let no_scope = com.platform = Js || com.platform = Java || as3 in
let vars = ref PMap.empty in
let all_vars = ref PMap.empty in
let vtemp = alloc_var "~" t_dynamic in
View
@@ -8770,16 +8770,11 @@ struct
let basic = gen.gcon.basic in
let rec run e =
match e.eexpr with
- | TBinop((Ast.OpDiv as op), e1, e2)
- | TBinop(((Ast.OpAssignOp (Ast.OpDiv)) as op), e1, e2) when is_int e1.etype && is_int e2.etype ->
+ | TBinop((Ast.OpDiv as op), e1, e2) when is_int e1.etype && is_int e2.etype ->
{ e with eexpr = TBinop(op, mk_cast basic.tfloat (run e1), run e2) }
| TCall(
{ eexpr = TField( { eexpr = TTypeExpr ( TClassDecl ({ cl_path = ([], "Std") }) ) }, "int") },
[ ({ eexpr = TBinop((Ast.OpDiv as op), e1, e2) } as ebinop ) ]
- )
- | TCall(
- { eexpr = TField( { eexpr = TTypeExpr ( TClassDecl ({ cl_path = ([], "Std") }) ) }, "int") },
- [ ({ eexpr = TBinop(((Ast.OpAssignOp (Ast.OpDiv)) as op), e1, e2) } as ebinop ) ]
) when catch_int_div && is_int e1.etype && is_int e2.etype ->
{ ebinop with eexpr = TBinop(op, run e1, run e2); etype = basic.tint }
| TCast( ({ eexpr = TBinop((Ast.OpDiv as op), e1, e2) } as ebinop ), _ )
View
@@ -102,7 +102,7 @@ struct
let name = "csharp_specific"
- let priority = solve_deps name [DBefore ExpressionUnwrap.priority; DBefore ClassInstance.priority]
+ let priority = solve_deps name [DBefore ExpressionUnwrap.priority; DBefore ClassInstance.priority; DAfter TryCatchWrapper.priority]
let get_cl_from_t t =
match follow t with
@@ -140,8 +140,8 @@ struct
{ e with eexpr = TBlock(ret) }
(* Std.is() *)
| TCall(
- { eexpr = TField( { eexpr = TTypeExpr ( TClassDecl ({ cl_path = ([], "Std") }) ) }, "is") },
- [obj; { eexpr = TTypeExpr(md) }]
+ { eexpr = TField( { eexpr = TTypeExpr ( TClassDecl { cl_path = ([], "Std") } ) }, "is") },
+ [ obj; { eexpr = TTypeExpr(md) }]
) ->
let mk_is obj md =
{ e with eexpr = TCall( { eexpr = TLocal is_var; etype = t_dynamic; epos = e.epos }, [
View
@@ -170,7 +170,7 @@ struct
(* Std.is() *)
| TCall(
- { eexpr = TField( { eexpr = TTypeExpr ( TClassDecl ({ cl_path = ([], "Std") }) ) }, "is") },
+ { eexpr = TField( { eexpr = TTypeExpr ( TClassDecl { cl_path = ([], "Std") } ) }, "is") },
[ obj; { eexpr = TTypeExpr(md) } ]
) ->
let mk_is obj md =
@@ -179,7 +179,6 @@ struct
{ eexpr = TTypeExpr md; etype = t_dynamic (* this is after all a syntax filter *); epos = e.epos }
] ) }
in
- let obj = run obj in
(match follow_module follow md with
| TClassDecl({ cl_path = ([], "Float") }) ->
{

0 comments on commit 02c525f

Please sign in to comment.