Skip to content

Commit

Permalink
Merge remote-tracking branch 'remotes/upstream/development' into brid…
Browse files Browse the repository at this point in the history
…geProperties
  • Loading branch information
Atry committed May 16, 2014
2 parents 8511640 + dc5c119 commit 33e66c1
Show file tree
Hide file tree
Showing 169 changed files with 4,651 additions and 2,443 deletions.
1 change: 1 addition & 0 deletions .gitignore
Expand Up @@ -57,6 +57,7 @@ build.bat
tests/unit/compile.php.hxml
/extra/*.xml
tests/optimization/testopt.js
tests/unit/native_python/__pycache__
tests/unit/unit.py
tests/unit/unit.py.res1.txt
tests/unit/unit.py.res2.bin
Expand Down
43 changes: 17 additions & 26 deletions .travis.yml
Expand Up @@ -7,46 +7,37 @@ env:
# SAUCE_ACCESS_KEY
- secure: sUvWUjCyPuWht4seNa4f2VG9DkvXkhZyLZfjJO9TUAHB2JndS16E2j/qrvKEjycyH6w8tU/B9vnjDRvvGrYXxEXcBEwsJVfkorFnRl9uwGCGIYrzjMhssEl3fMYZK7P304f+gAp5ULrDBX2gIaKeSa8lUNRtz2PsZOieE4kMdhk=
matrix:
- TARGET=macro
- TARGET=neko
- TARGET=js
- TARGET=php
- TARGET=cpp
- TARGET=flash9
- TARGET=as3
- TARGET=java
- TARGET=cs
- TARGET=python
- TARGET=flash8
- TARGET=neko-sys
- TARGET=python-sys
- TARGET=cpp-sys
- TARGET=misc
- TARGET=polygonal-ds
- TARGET=flambe
- TARGET=hxtemplo
- TARGET=munit
- TARGET=openfl-samples
- TARGET=flixel-demos
- TARGET=bytecode
- TEST=third-party
- TEST=macro
- TEST=neko
- TEST=js
- TEST=php
- TEST=cpp
- TEST=flash9
- TEST=as3
- TEST=java
- TEST=cs
- TEST=python
- TEST=flash8

matrix:
fast_finish: true
allow_failures:
- env: TARGET=flash8
- env: TEST=flash8

before_install:
install:
- travis_retry sudo apt-get update
- travis_retry sudo apt-get install ocaml zlib1g-dev libgc-dev -y
- travis_retry git clone https://github.com/HaxeFoundation/neko.git ~/neko
- cd ~/neko && make && sudo make install && cd $TRAVIS_BUILD_DIR

script:
- /bin/sh -c '[ $TARGET = "bytecode" ] && make BYTECODE=1 || make'
- make
- make tools
- sudo make install
- cd tests/
- mkdir ~/haxelib && haxelib setup ~/haxelib
- haxelib git hx-yaml https://github.com/mikestead/hx-yaml master src
- haxe -version
- haxe -main RunTravis -lib hx-yaml --interp
- haxe -neko RunTravis.n -main RunTravis -lib hx-yaml
- neko RunTravis.n
16 changes: 9 additions & 7 deletions Makefile
Expand Up @@ -30,18 +30,20 @@ NATIVE_LIBS=-cclib libs/extc/extc_stubs.o -cclib -lz -cclib libs/objsize/c_objsi

ifeq ($(BYTECODE),1)
TARGET_FLAG = bytecode
CC_CMD = $(OCAMLC)
COMPILER = $(OCAMLC)
LIB_EXT = cma
MODULE_EXT = cmo
NATIVE_LIB_FLAG = -custom
else
TARGET_FLAG = native
CC_CMD = $(OCAMLOPT)
COMPILER = $(OCAMLOPT)
LIB_EXT = cmxa
MODULE_EXT = cmx
endif

CC_PARSER_CMD = $(CC_CMD) -pp camlp4o $(CFLAGS) -c parser.ml
CC_CMD = $(COMPILER) $(CFLAGS) -c $<

CC_PARSER_CMD = $(COMPILER) -pp camlp4o $(CFLAGS) -c parser.ml

RELDIR=../../..

Expand Down Expand Up @@ -79,7 +81,7 @@ libs:
make -C libs/objsize OCAMLOPT=$(OCAMLOPT) OCAMLC=$(OCAMLC) $(TARGET_FLAG)

haxe: $(MODULES:=.$(MODULE_EXT))
$(CC_CMD) -o $(OUTPUT) $(NATIVE_LIBS) $(NATIVE_LIB_FLAG) $(LFLAGS) $(LIBS:=.$(LIB_EXT)) $(MODULES:=.$(MODULE_EXT))
$(COMPILER) -o $(OUTPUT) $(NATIVE_LIBS) $(NATIVE_LIB_FLAG) $(LFLAGS) $(LIBS:=.$(LIB_EXT)) $(MODULES:=.$(MODULE_EXT))

haxelib:
(cd $(CURDIR)/extra/haxelib_src && $(CURDIR)/$(OUTPUT) haxelib.hxml && nekotools boot bin/haxelib.n)
Expand Down Expand Up @@ -175,7 +177,7 @@ ast.$(MODULE_EXT):

version.$(MODULE_EXT):
echo $(VERSION_EXTRA) > version.ml
$(CC_CMD) $(CFLAGS) -c version.ml
$(COMPILER) $(CFLAGS) -c version.ml

# Clean

Expand All @@ -202,10 +204,10 @@ clean_tools:
# SUFFIXES

.ml.cmx:
$(CC_CMD) $(CFLAGS) -c $<
$(CC_CMD)

.ml.cmo:
$(CC_CMD) $(CFLAGS) -c $<
$(CC_CMD)

.mll.ml:
ocamllex $<
Expand Down
5 changes: 5 additions & 0 deletions ast.ml
Expand Up @@ -84,11 +84,13 @@ module Meta = struct
| HxGen
| IfFeature
| Impl
| PythonImport
| Include
| InitPackage
| Internal
| IsVar
| JavaNative
| JsRequire
| Keep
| KeepInit
| KeepSub
Expand All @@ -98,6 +100,7 @@ module Meta = struct
| MergeBlock
| MultiType
| Native
| NativeChildren
| NativeGen
| NativeGeneric
| NoCompletion
Expand Down Expand Up @@ -131,6 +134,7 @@ module Meta = struct
| SkipReflection
| Sound
| Struct
| StructAccess
| SuppressWarnings
| This
| Throws
Expand All @@ -145,6 +149,7 @@ module Meta = struct
| Unsafe
| Usage
| Used
| Void
| Last
(* do not put any custom metadata after Last *)
| Dollar of string
Expand Down
49 changes: 36 additions & 13 deletions codegen.ml
Expand Up @@ -298,7 +298,7 @@ let rec build_generic ctx c p tl =
if !recurse then begin
TInst (c,tl) (* build a normal instance *)
end else begin
let gctx = try make_generic ctx c.cl_types tl p with Generic_Exception (msg,p) -> error msg p in
let gctx = make_generic ctx c.cl_types tl p in
let name = (snd c.cl_path) ^ "_" ^ gctx.name in
try
Typeload.load_instance ctx { tpackage = pack; tname = name; tparams = []; tsub = None } p false
Expand Down Expand Up @@ -648,13 +648,13 @@ module Abstract = struct

let find_to ab pl b =
if follow b == t_dynamic then
List.find (fun (t,_) -> t == t_dynamic) ab.a_to
List.find (fun (t,_) -> follow t == t_dynamic) ab.a_to
else
List.find (Type.unify_to_field ab pl b) ab.a_to

let find_from ab pl a b =
if follow a == t_dynamic then
List.find (fun (t,_) -> t == t_dynamic) ab.a_from
List.find (fun (t,_) -> follow t == t_dynamic) ab.a_from
else
List.find (Type.unify_from_field ab pl a b) ab.a_from

Expand Down Expand Up @@ -913,21 +913,44 @@ let detect_usage com =
let usage = ref [] in
List.iter (fun t -> match t with
| TClassDecl c ->
let check_constructor c p =
try
let _,cf = get_constructor (fun cf -> cf.cf_type) c in
if Meta.has Meta.Usage cf.cf_meta then
usage := p :: !usage;
with Not_found ->
()
in
let rec expr e = match e.eexpr with
| TField(_,fa) ->
begin match extract_field fa with
| Some cf when Meta.has Meta.Usage cf.cf_meta ->
let p = {e.epos with pmin = e.epos.pmax - (String.length cf.cf_name)} in
usage := p :: !usage;
| _ ->
()
end;
| TField(_,FEnum(_,ef)) when Meta.has Meta.Usage ef.ef_meta ->
let p = {e.epos with pmin = e.epos.pmax - (String.length ef.ef_name)} in
usage := p :: !usage;
Type.iter expr e
| TField(_,(FAnon cf | FInstance (_,cf) | FStatic (_,cf) | FClosure (_,cf))) when Meta.has Meta.Usage cf.cf_meta ->
let p = {e.epos with pmin = e.epos.pmax - (String.length cf.cf_name)} in
usage := p :: !usage;
Type.iter expr e
| TLocal v when Meta.has Meta.Usage v.v_meta ->
usage := e.epos :: !usage
| TVar (v,_) when com.display = DMPosition && Meta.has Meta.Usage v.v_meta ->
raise (Typecore.DisplayPosition [e.epos])
| TFunction tf when com.display = DMPosition && List.exists (fun (v,_) -> Meta.has Meta.Usage v.v_meta) tf.tf_args ->
raise (Typecore.DisplayPosition [e.epos])
| TTypeExpr mt when (Meta.has Meta.Usage (t_infos mt).mt_meta) ->
usage := e.epos :: !usage
| TNew (c,_,_) ->
check_constructor c e.epos;
Type.iter expr e;
| TCall({eexpr = TConst TSuper},_) ->
begin match c.cl_super with
| Some (c,_) ->
check_constructor c e.epos
| _ ->
()
end
| _ -> Type.iter expr e
in
let field cf = match cf.cf_expr with None -> () | Some e -> expr e in
let field cf = ignore(follow cf.cf_type); match cf.cf_expr with None -> () | Some e -> expr e in
(match c.cl_constructor with None -> () | Some cf -> field cf);
(match c.cl_init with None -> () | Some e -> expr e);
List.iter field c.cl_ordered_statics;
Expand Down Expand Up @@ -1710,4 +1733,4 @@ module DeprecationCheck = struct
| _ ->
()
) com.types
end
end
25 changes: 17 additions & 8 deletions common.ml
Expand Up @@ -104,8 +104,8 @@ type display_mode =
| DMNone
| DMDefault
| DMUsage
| DMMetadata
| DMPosition
| DMToplevel

type context = {
(* config *)
Expand Down Expand Up @@ -168,6 +168,7 @@ module Define = struct
| As3
| CheckXmlProxy
| CoreApi
| CoreApiSerialize
| Cppia
| Dce
| DceDebug
Expand Down Expand Up @@ -228,6 +229,7 @@ module Define = struct
| SwfScriptTimeout
| SwfUseDoAbc
| Sys
| UnityStdTarget
| Unsafe
| UseNekoc
| UseRttiDoc
Expand All @@ -241,6 +243,7 @@ module Define = struct
| As3 -> ("as3","Defined when outputing flash9 as3 source code")
| CheckXmlProxy -> ("check_xml_proxy","Check the used fields of the xml proxy")
| CoreApi -> ("core_api","Defined in the core api context")
| CoreApiSerialize -> ("core_api_serialize","Sets so some generated core api classes be marked with the Serializable attribute on C#")
| Cppia -> ("cppia", "Generate experimental cpp instruction assembly")
| Dce -> ("dce","The current DCE mode")
| DceDebug -> ("dce_debug","Show DCE log")
Expand Down Expand Up @@ -302,6 +305,7 @@ module Define = struct
| SwfScriptTimeout -> ("swf_script_timeout", "Maximum ActionScript processing time before script stuck dialog box displays (in seconds)")
| SwfUseDoAbc -> ("swf_use_doabc", "Use DoAbc swf-tag instead of DoAbcDefine")
| Sys -> ("sys","Defined for all system platforms")
| UnityStdTarget -> ("unity_std_target", "Changes C# sources location so that each generated C# source is relative to the Haxe source location. If the location is outside the current directory, the value set here will be used")
| Unsafe -> ("unsafe","Allow unsafe code when targeting C#")
| UseNekoc -> ("use_nekoc","Use nekoc compiler instead of internal one")
| UseRttiDoc -> ("use_rtti_doc","Allows access to documentation during compilation")
Expand Down Expand Up @@ -386,11 +390,13 @@ module MetaInfo = struct
| HxGen -> ":hxGen",("Annotates that an extern class was generated by Haxe",[Platforms [Java;Cs]; UsedOnEither [TClass;TEnum]])
| IfFeature -> ":ifFeature",("Causes a field to be kept by DCE if the given feature is part of the compilation",[HasParam "Feature name";UsedOn TClassField])
| Impl -> ":impl",("Used internally to mark abstract implementation fields",[UsedOn TAbstractField; Internal])
| PythonImport -> ":pythonImport",("Generates python import statement for extern classes",[Platforms [Python]; UsedOn TClass])
| Include -> ":include",("",[Platform Cpp])
| InitPackage -> ":initPackage",("?",[])
| Meta.Internal -> ":internal",("Generates the annotated field/class with 'internal' access",[Platforms [Java;Cs]; UsedOnEither[TClass;TEnum;TClassField]])
| IsVar -> ":isVar",("Forces a physical field to be generated for properties that otherwise would not require one",[UsedOn TClassField])
| JavaNative -> ":javaNative",("Automatically added by -java-lib on classes generated from JAR/class files",[Platform Java; UsedOnEither[TClass;TEnum]; Internal])
| JsRequire -> ":jsRequire",("Generate javascript module require expression for given extern",[Platform Js; UsedOn TClass])
| Keep -> ":keep",("Causes a field or type to be kept by DCE",[])
| KeepInit -> ":keepInit",("Causes a class to be kept by DCE even if all its field are removed",[UsedOn TClass])
| KeepSub -> ":keepSub",("Extends @:keep metadata to all implementing and extending classes",[UsedOn TClass])
Expand All @@ -400,7 +406,8 @@ module MetaInfo = struct
| MergeBlock -> ":mergeBlock",("Internally used by typer to mark block that should be merged into the outer scope",[Internal])
| MultiType -> ":multiType",("Specifies that an abstract chooses its this-type from its @:to functions",[UsedOn TAbstract; HasParam "Relevant type parameters"])
| Native -> ":native",("Rewrites the path of a class or enum during generation",[HasParam "Output type path";UsedOnEither [TClass;TEnum]])
| NativeGen -> ":nativeGen",("Annotates that a type should be treated as if it were an extern definition - platform native",[Platforms [Java;Cs]; UsedOnEither[TClass;TEnum]])
| NativeChildren -> ":nativeChildren",("Annotates that all children from a type should be treated as if it were an extern definition - platform native",[Platforms [Java;Cs]; UsedOn TClass])
| NativeGen -> ":nativeGen",("Annotates that a type should be treated as if it were an extern definition - platform native",[Platforms [Java;Cs;Python]; UsedOnEither[TClass;TEnum]])
| NativeGeneric -> ":nativeGeneric",("Used internally to annotate native generic classes",[Platform Cs; UsedOnEither[TClass;TEnum]; Internal])
| NoCompletion -> ":noCompletion",("Prevents the compiler from suggesting completion on this field",[UsedOn TClassField])
| NoDebug -> ":noDebug",("Does not generate debug information into the Swf even if -debug is set",[UsedOnEither [TClass;TClassField];Platform Flash])
Expand Down Expand Up @@ -433,6 +440,7 @@ module MetaInfo = struct
| SkipReflection -> ":skipReflection",("Used internally to annotate a field that shouldn't have its reflection data generated",[Platforms [Java;Cs]; UsedOn TClassField; Internal])
| Sound -> ":sound",( "Includes a given .wav or .mp3 file into the target Swf and associates it with the class (must extend flash.media.Sound)",[HasParam "File path";UsedOn TClass;Platform Flash])
| Struct -> ":struct",("Marks a class definition as a struct.",[Platform Cs; UsedOn TClass])
| StructAccess -> ":structAccess",("Marks an extern class as using struct access('.') not pointer('->').",[Platform Cpp; UsedOn TClass])
| SuppressWarnings -> ":suppressWarnings",("Adds a SuppressWarnings annotation for the generated Java class",[Platform Java; UsedOn TClass])
| Throws -> ":throws",("Adds a 'throws' declaration to the generated function.",[HasParam "Type as String"; Platform Java; UsedOn TClassField])
| This -> ":this",("Internally used to pass a 'this' expression to macros",[Internal; UsedOn TExpr])
Expand All @@ -447,6 +455,7 @@ module MetaInfo = struct
| Unsafe -> ":unsafe",("Declares a class, or a method with the C#'s 'unsafe' flag",[Platform Cs; UsedOnEither [TClass;TClassField]])
| Usage -> ":usage",("?",[])
| Used -> ":used",("Internally used by DCE to mark a class or field as used",[Internal])
| Void -> ":void",("Use Cpp native 'void' return type",[Platform Cpp])
| Last -> assert false
(* do not put any custom metadata after Last *)
| Dollar s -> "$" ^ s,("",[])
Expand Down Expand Up @@ -772,7 +781,7 @@ let flash_versions = List.map (fun v ->
let maj = int_of_float v in
let min = int_of_float (mod_float (v *. 10.) 10.) in
v, string_of_int maj ^ (if min = 0 then "" else "_" ^ string_of_int min)
) [9.;10.;10.1;10.2;10.3;11.;11.1;11.2;11.3;11.4;11.5;11.6;11.7;11.8;11.9;12.0;12.1;12.2;12.3;12.4;12.5]
) [9.;10.;10.1;10.2;10.3;11.;11.1;11.2;11.3;11.4;11.5;11.6;11.7;11.8;11.9;12.0;13.0;14.0;15.0;16.0;17.0]

let flash_version_tag = function
| 6. -> 6
Expand All @@ -793,11 +802,11 @@ let flash_version_tag = function
| 11.8 -> 21
| 11.9 -> 22
| 12.0 -> 23
| 12.1 -> 24
| 12.2 -> 25
| 12.3 -> 26
| 12.4 -> 27
| 12.5 -> 28
| 13.0 -> 24
| 14.0 -> 25
| 15.0 -> 26
| 16.0 -> 27
| 17.0 -> 28
| v -> failwith ("Invalid SWF version " ^ string_of_float v)

let raw_defined ctx v =
Expand Down

0 comments on commit 33e66c1

Please sign in to comment.