Skip to content

Commit

Permalink
Remove AS3 target (#8934)
Browse files Browse the repository at this point in the history
  • Loading branch information
RealyUniqueName committed Nov 6, 2019
1 parent 91dc4be commit 5c8e27d
Show file tree
Hide file tree
Showing 17 changed files with 14 additions and 1,417 deletions.
4 changes: 2 additions & 2 deletions azure-pipelines.yml
Original file line number Diff line number Diff line change
Expand Up @@ -63,7 +63,7 @@ stages:
php:
TEST: php
flash:
TEST: flash9,as3
TEST: flash9
APT_PACKAGES: libglib2.0 libfreetype6 xvfb
DISPLAY: ':99.0'
AUDIODEV: 'null'
Expand Down Expand Up @@ -140,7 +140,7 @@ stages:
php:
TEST: php
flash:
TEST: flash9,as3
TEST: flash9
python:
TEST: python
lua:
Expand Down
2 changes: 1 addition & 1 deletion extra/azure-pipelines/test-windows.yml
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@ jobs:
TEST: php
# TODO. flash has never been enabled on our AppVeyor builds.
# flash:
# TEST: flash9,as3
# TEST: flash9
python:
TEST: python
# TODO. Lua has never been enabled on our AppVeyor builds.
Expand Down
5 changes: 0 additions & 5 deletions src-json/define.json
Original file line number Diff line number Diff line change
Expand Up @@ -16,11 +16,6 @@
"doc": "Add additional comments to generated source code.",
"platforms": ["cpp"]
},
{
"name": "As3",
"define": "as3",
"doc": "Defined when outputting flash9 as3 source code."
},
{
"name": "CheckXmlProxy",
"define": "check_xml_proxy",
Expand Down
2 changes: 0 additions & 2 deletions src/codegen/codegen.ml
Original file line number Diff line number Diff line change
Expand Up @@ -189,8 +189,6 @@ let fix_override com c f fd =
{ e with eexpr = TBlock (el_v @ el) }
);
} in
(* as3 does not allow wider visibility, so the base method has to be made public *)
if Common.defined com Define.As3 && has_class_field_flag f CfPublic then add_class_field_flag f2 CfPublic;
let targs = List.map (fun(v,c) -> (v.v_name, Option.is_some c, v.v_type)) nargs in
let fde = (match f.cf_expr with None -> assert false | Some e -> e) in
f.cf_expr <- Some { fde with eexpr = TFunction fd2 };
Expand Down
9 changes: 1 addition & 8 deletions src/compiler/haxe.ml
Original file line number Diff line number Diff line change
Expand Up @@ -82,7 +82,7 @@ let error ctx msg p =

let reserved_flags = [
"true";"false";"null";"cross";"js";"lua";"neko";"flash";"php";"cpp";"cs";"java";"python";
"as3";"swc";"macro";"sys";"static";"utf16";"haxe";"haxe_ver"
"swc";"macro";"sys";"static";"utf16";"haxe";"haxe_ver"
]

let reserved_flag_namespaces = ["target"]
Expand Down Expand Up @@ -308,8 +308,6 @@ let generate tctx ext interp swf_header =
()
else begin
let generate,name = match com.platform with
| Flash when Common.defined com Define.As3 ->
Genas3.generate,"AS3"
| Flash ->
Genswf.generate swf_header,"swf"
| Neko ->
Expand Down Expand Up @@ -718,11 +716,6 @@ try
("Target",["--js"],["-js"],Arg.String (Initialize.set_platform com Js),"<file>","compile code to JavaScript file");
("Target",["--lua"],["-lua"],Arg.String (Initialize.set_platform com Lua),"<file>","compile code to Lua file");
("Target",["--swf"],["-swf"],Arg.String (Initialize.set_platform com Flash),"<file>","compile code to Flash SWF file");
("Target",["--as3"],["-as3"],Arg.String (fun dir ->
Initialize.set_platform com Flash dir;
Common.define com Define.As3;
Common.define com Define.NoInline;
),"<directory>","generate AS3 code into target directory");
("Target",["--neko"],["-neko"],Arg.String (Initialize.set_platform com Neko),"<file>","compile code to Neko Binary");
("Target",["--php"],["-php"],Arg.String (fun dir ->
classes := (["php"],"Boot") :: !classes;
Expand Down
8 changes: 0 additions & 8 deletions src/context/common.ml
Original file line number Diff line number Diff line change
Expand Up @@ -355,14 +355,6 @@ let get_config com =
pf_supports_threads = true;
pf_supports_unicode = false;
}
| Flash when defined Define.As3 ->
{
default_config with
pf_sys = false;
pf_capture_policy = CPLoopVars;
pf_add_final_return = true;
pf_can_skip_non_nullable_argument = false;
}
| Flash ->
{
default_config with
Expand Down
7 changes: 2 additions & 5 deletions src/context/typecore.ml
Original file line number Diff line number Diff line change
Expand Up @@ -464,16 +464,13 @@ let rec can_access ctx ?(in_overload=false) c cf stat =
| None -> false)
with Not_found -> false
in
let b = loop c
loop c
(* access is also allowed of we access a type parameter which is constrained to our (base) class *)
|| (match c.cl_kind with
| KTypeParameter tl ->
List.exists (fun t -> match follow t with TInst(c,_) -> loop c | _ -> false) tl
| _ -> false)
|| (Meta.has Meta.PrivateAccess ctx.meta) in
(* TODO: find out what this does and move it to genas3 *)
if b && Common.defined ctx.com Common.Define.As3 && not (Meta.has Meta.Public cf.cf_meta) then cf.cf_meta <- (Meta.Public,[],cf.cf_pos) :: cf.cf_meta;
b
|| (Meta.has Meta.PrivateAccess ctx.meta)

(** removes the first argument of the class field's function type and all its overloads *)
let prepare_using_field cf = match follow cf.cf_type with
Expand Down
38 changes: 3 additions & 35 deletions src/filters/filters.ml
Original file line number Diff line number Diff line change
Expand Up @@ -545,36 +545,14 @@ let add_rtti ctx t =

(* Adds member field initializations as assignments to the constructor *)
let add_field_inits reserved ctx t =
let is_as3 = Common.defined ctx.com Define.As3 && not ctx.in_macro in
let apply c =
let ethis = mk (TConst TThis) (TInst (c,List.map snd c.cl_params)) c.cl_pos in
(* TODO: we have to find a variable name which is not used in any of the functions *)
let v = alloc_var VGenerated "_g" ethis.etype ethis.epos in
let need_this = ref false in
let inits,fields = List.fold_left (fun (inits,fields) cf ->
match cf.cf_kind,cf.cf_expr with
| Var _, Some _ ->
if is_as3 then (inits, cf :: fields) else (cf :: inits, cf :: fields)
| Method MethDynamic, Some e when is_as3 ->
(* TODO : this would have a better place in genSWF9 I think - NC *)
(* we move the initialization of dynamic functions to the constructor and also solve the
'this' problem along the way *)
let rec use_this v e = match e.eexpr with
| TConst TThis ->
need_this := true;
mk (TLocal v) v.v_type e.epos
| _ -> Type.map_expr (use_this v) e
in
let e = Type.map_expr (use_this v) e in
let cf2 = {cf with cf_expr = Some e} in
(* if the method is an override, we have to remove the class field to not get invalid overrides *)
let fields = if List.memq cf c.cl_overrides then begin
c.cl_fields <- PMap.remove cf.cf_name c.cl_fields;
fields
end else
cf2 :: fields
in
(cf2 :: inits, fields)
| Var _, Some _ -> (cf :: inits, cf :: fields)
| _ -> (inits, cf :: fields)
) ([],[]) c.cl_ordered_fields in
c.cl_ordered_fields <- (List.rev fields);
Expand All @@ -587,12 +565,7 @@ let add_field_inits reserved ctx t =
| Some e ->
let lhs = mk (TField({ ethis with epos = cf.cf_pos },FInstance (c,List.map snd c.cl_params,cf))) cf.cf_type cf.cf_pos in
cf.cf_expr <- None;
let eassign = mk (TBinop(OpAssign,lhs,e)) cf.cf_type e.epos in
if is_as3 then begin
let echeck = mk (TBinop(OpEq,lhs,(mk (TConst TNull) lhs.etype e.epos))) ctx.com.basic.tbool e.epos in
mk (TIf(echeck,eassign,None)) eassign.etype e.epos
end else
eassign;
mk (TBinop(OpAssign,lhs,e)) cf.cf_type e.epos
) inits in
let el = if !need_this then (mk (TVar((v, Some ethis))) ethis.etype ethis.epos) :: el else el in
let cf = match c.cl_constructor with
Expand Down Expand Up @@ -643,7 +616,6 @@ let add_meta_field ctx t = match t with
let cf = mk_field "__meta__" e.etype e.epos null_pos in
cf.cf_expr <- Some e;
let can_deal_with_interface_metadata () = match ctx.com.platform with
| Flash when Common.defined ctx.com Define.As3 -> false
| Cs | Java -> false
| _ -> true
in
Expand Down Expand Up @@ -929,11 +901,7 @@ let run com tctx main =
com.stage <- CDceStart;
let t = filter_timer detail_times ["dce"] in
(* DCE *)
let dce_mode = if Common.defined com Define.As3 then
"no"
else
(try Common.defined_value com Define.Dce with _ -> "no")
in
let dce_mode = try Common.defined_value com Define.Dce with _ -> "no" in
let dce_mode = match dce_mode with
| "full" -> if Common.defined com Define.Interp then Dce.DceNo else DceFull
| "std" -> DceStd
Expand Down
Loading

0 comments on commit 5c8e27d

Please sign in to comment.