Skip to content

Commit

Permalink
Merge branch 'development'
Browse files Browse the repository at this point in the history
  • Loading branch information
Simn committed Mar 17, 2017
2 parents 95993d3 + 976223e commit 5c44548
Show file tree
Hide file tree
Showing 22 changed files with 440 additions and 237 deletions.
10 changes: 9 additions & 1 deletion extra/CHANGES.txt
@@ -1,15 +1,23 @@
2017-03-14: 3.4.1
2017-03-17: 3.4.1

New features:

php7 : added source maps generation with `-D source_map` flag.

General improvements and optimizations:

cpp : added cpp.Star and cpp.Struct to help with extern typing
lua : cleaned up various parts of the standard library

Bugfixes:

all : fixed compilation server issue with two identical @:native paths on extern abstracts (#5993)
all : fixed invalid inling in a specific case (#6067)
all : fixed various display related issues
all : fixed inline super() calls missing field initializations (#6097)
all : consider UNC paths to be absolute in haxe.io.Path.isAbsolute (#6061)
cpp : improved typing of some Function/Callable-related types
cpp : fixed problem with line numbers when debugging
hl : various fixes and improvements
php : fixed FileSystem.stat() for directories on Windows (#6057)
php/php7 : fixed invalid result of Web.getPostData() (#6033)
Expand Down
16 changes: 10 additions & 6 deletions extra/release-checklist.txt
Expand Up @@ -19,13 +19,17 @@

# Making the release

- Copy relevant changelog part to downloads/$version/CHANGES.md.
- Write announcement post.
- Copy announcement post to downloads/$version/RELEASE.md.
- Update downloads/versions.json
- Push the generated binaries and installers to haxe.org, requires git-lfs
- Regenerate API documentation (check --title and -D version values).
- Make a GitHub release in https://github.com/HaxeFoundation/haxe/releases with
- the generated binaries and installers
- the API documentation
- Update haxe.org
- Copy relevant changelog part to downloads/$version/CHANGES.md.
- Write announcement post in downloads/$version/RELEASE.md.
- Update downloads/versions.json.
- Push to staging, check https://staging.haxe.org/.
- Merge staging to master, check https://haxe.org/.

# Announcing the release

- Regenerate and upload API documentation (check --title and -D version values).
- Post announcement post to haxelang.
228 changes: 190 additions & 38 deletions src/generators/gencpp.ml

Large diffs are not rendered by default.

22 changes: 4 additions & 18 deletions src/generators/genlua.ml
Expand Up @@ -1742,15 +1742,13 @@ let generate_type ctx = function
| ([],_) -> ()
| _ -> generate_package_create ctx c.cl_path);
check_multireturn ctx c;
| TEnumDecl e when not e.e_extern -> generate_enum ctx e
| TTypeDecl _ | TAbstractDecl _ -> ()
| TEnumDecl e ->
if not e.e_extern then generate_enum ctx e
else ();
| TTypeDecl _ | TAbstractDecl _ | _ -> ()

let generate_type_forward ctx = function
| TClassDecl c ->
(match c.cl_init with
| None -> ()
| Some e ->
ctx.inits <- e :: ctx.inits);
if not c.cl_extern then
begin
generate_package_create ctx c.cl_path;
Expand Down Expand Up @@ -2015,18 +2013,6 @@ let generate com =
println ctx "end";
newline ctx;

let rec chk_features e =
if is_dynamic_iterator ctx e then add_feature ctx "use._iterator";
match e.eexpr with
| TField (_,FClosure _) ->
add_feature ctx "use._hx_bind"
| _ ->
Type.iter chk_features e
in

List.iter chk_features ctx.inits;

List.iter (fun (_,_,e) -> chk_features e) ctx.statics;
if has_feature ctx "use._iterator" then begin
add_feature ctx "use._hx_bind";
println ctx "function _hx_iterator(o) if ( lua.Boot.__instanceof(o, Array) ) then return function() return HxOverrides.iter(o) end elseif (typeof(o.iterator) == 'function') then return _hx_bind(o,o.iterator) else return o.iterator end end";
Expand Down
44 changes: 31 additions & 13 deletions src/optimization/optimizer.ml
Expand Up @@ -492,8 +492,8 @@ let rec type_inline ctx cf f ethis params tret config p ?(self_calling_closure=f
{ e with eexpr = TFunction { tf_args = args; tf_expr = expr; tf_type = f.tf_type } }
| TCall({eexpr = TConst TSuper; etype = t},el) ->
begin match follow t with
| TInst({ cl_constructor = Some ({cf_kind = Method MethInline; cf_expr = Some ({eexpr = TFunction tf})} as cf)},_) ->
begin match type_inline ctx cf tf ethis el ctx.t.tvoid None po true with
| TInst({ cl_constructor = Some ({cf_kind = Method MethInline; cf_expr = Some ({eexpr = TFunction tf})} as cf)} as c,_) ->
begin match type_inline_ctor ctx c cf tf ethis el po with
| Some e -> map term e
| None -> error "Could not inline super constructor call" po
end
Expand Down Expand Up @@ -651,6 +651,29 @@ let rec type_inline ctx cf f ethis params tret config p ?(self_calling_closure=f
let rec map_expr_type e = Type.map_expr_type map_expr_type map_type map_var e in
Some (map_expr_type e)

(* Same as type_inline, but modifies the function body to add field inits *)
and type_inline_ctor ctx c cf tf ethis el po =
let field_inits =
let cparams = List.map snd c.cl_params in
let ethis = mk (TConst TThis) (TInst (c,cparams)) c.cl_pos in
let el = List.fold_left (fun acc cf ->
match cf.cf_kind,cf.cf_expr with
| Var _,Some e ->
let lhs = mk (TField(ethis,FInstance (c,cparams,cf))) cf.cf_type e.epos in
let eassign = mk (TBinop(OpAssign,lhs,e)) cf.cf_type e.epos in
eassign :: acc
| _ -> acc
) [] c.cl_ordered_fields in
List.rev el
in
let tf =
if field_inits = [] then tf
else
let bl = match tf.tf_expr with {eexpr = TBlock b } -> b | x -> [x] in
{tf with tf_expr = mk (TBlock (field_inits @ bl)) ctx.t.tvoid c.cl_pos}
in
type_inline ctx cf tf ethis el ctx.t.tvoid None po true


(* ---------------------------------------------------------------------- *)
(* LOOPS *)
Expand Down Expand Up @@ -1222,6 +1245,7 @@ let inline_constructors ctx e =
if i < 0 then "n" ^ (string_of_int (-i))
else (string_of_int i)
in
let is_extern_ctor c cf = c.cl_extern || Meta.has Meta.Extern cf.cf_meta in
let rec find_locals e = match e.eexpr with
| TVar(v,Some e1) ->
find_locals e1;
Expand All @@ -1234,22 +1258,13 @@ let inline_constructors ctx e =
()
end
| TNew({ cl_constructor = Some ({cf_kind = Method MethInline; cf_expr = Some ({eexpr = TFunction tf})} as cf)} as c,tl,pl) when type_iseq v.v_type e1.etype ->
begin match type_inline ctx cf tf (mk (TLocal v) (TInst (c,tl)) e1.epos) pl ctx.t.tvoid None e1.epos true with
begin match type_inline_ctor ctx c cf tf (mk (TLocal v) (TInst (c,tl)) e1.epos) pl e1.epos with
| Some e ->
(* add field inits here because the filter has not run yet (issue #2336) *)
let ev = mk (TLocal v) v.v_type e.epos in
let el_init = List.fold_left (fun acc cf -> match cf.cf_kind,cf.cf_expr with
| Var _,Some e ->
let ef = mk (TField(ev,FInstance(c,tl,cf))) cf.cf_type e.epos in
let e = mk (TBinop(OpAssign,ef,e)) cf.cf_type e.epos in
e :: acc
| _ -> acc
) el_init c.cl_ordered_fields in
let e' = match el_init with
| [] -> e
| _ -> mk (TBlock (List.rev (e :: el_init))) e.etype e.epos
in
add v e' (IKCtor(cf,c.cl_extern || Meta.has Meta.Extern cf.cf_meta));
add v e' (IKCtor(cf,is_extern_ctor c cf));
find_locals e
| None ->
()
Expand Down Expand Up @@ -1399,6 +1414,9 @@ let inline_constructors ctx e =
in
let el = block [] el in
mk (TBlock (List.rev el)) e.etype e.epos
| TNew({ cl_constructor = Some ({cf_kind = Method MethInline; cf_expr = Some ({eexpr = TFunction _})} as cf)} as c,_,_) when is_extern_ctor c cf ->
display_error ctx "Extern constructor could not be inlined" e.epos;
Type.map_expr loop e
| _ ->
Type.map_expr loop e
in
Expand Down
27 changes: 27 additions & 0 deletions std/cpp/ConstStar.hx
@@ -0,0 +1,27 @@
/*
* Copyright (C)2005-2017 Haxe Foundation
*
* Permission is hereby granted, free of charge, to any person obtaining a
* copy of this software and associated documentation files (the "Software"),
* to deal in the Software without restriction, including without limitation
* the rights to use, copy, modify, merge, publish, distribute, sublicense,
* and/or sell copies of the Software, and to permit persons to whom the
* Software is furnished to do so, subject to the following conditions:
*
* The above copyright notice and this permission notice shall be included in
* all copies or substantial portions of the Software.
*
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
* FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
* DEALINGS IN THE SOFTWARE.
*/
package cpp;

// Allows haxe to type result correctly, and hxcpp can recognise this use the correct type
typedef ConstStar<T> = T;


28 changes: 28 additions & 0 deletions std/cpp/Struct.hx
@@ -0,0 +1,28 @@
/*
* Copyright (C)2005-2017 Haxe Foundation
*
* Permission is hereby granted, free of charge, to any person obtaining a
* copy of this software and associated documentation files (the "Software"),
* to deal in the Software without restriction, including without limitation
* the rights to use, copy, modify, merge, publish, distribute, sublicense,
* and/or sell copies of the Software, and to permit persons to whom the
* Software is furnished to do so, subject to the following conditions:
*
* The above copyright notice and this permission notice shall be included in
* all copies or substantial portions of the Software.
*
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
* FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
* DEALINGS IN THE SOFTWARE.
*/
package cpp;

// Wrap external types with a class that integrates with Dynamic
typedef Struct<T> = T;



2 changes: 1 addition & 1 deletion std/haxe/EnumFlags.hx
Expand Up @@ -73,7 +73,7 @@ abstract EnumFlags<T:EnumValue>(Int) {
If `v` is null, the result is unspecified.
**/
public inline function unset( v : T ) : Void {
this &= 0xFFFFFFF - (1 << Type.enumIndex(v));
this &= 0xFFFFFFFF - (1 << Type.enumIndex(v));
}

/**
Expand Down
1 change: 1 addition & 0 deletions std/haxe/io/Path.hx
Expand Up @@ -301,6 +301,7 @@ class Path {
public static function isAbsolute ( path : String ) : Bool {
if (StringTools.startsWith(path, '/')) return true;
if (path.charAt(1) == ':') return true;
if (StringTools.startsWith(path, '\\\\')) return true;
return false;
}

Expand Down
5 changes: 5 additions & 0 deletions std/hl/UI.hx
Expand Up @@ -28,6 +28,10 @@ abstract Sentinel(SentinelHandle) {
public function new( timeout, callback ) {
this = create_sentinel(timeout,callback);
}

public function setPause( p : Bool ) {
_pause(this, p);
}

public function tick() {
_tick(this);
Expand All @@ -38,6 +42,7 @@ abstract Sentinel(SentinelHandle) {
}

@:hlNative("ui","ui_sentinel_tick") static function _tick( h : SentinelHandle ) : Void {}
@:hlNative("ui","ui_sentinel_pause") static function _pause( h : SentinelHandle, b : Bool ) : Void {}

}

Expand Down
1 change: 0 additions & 1 deletion std/java/Lib.hx
Expand Up @@ -57,7 +57,6 @@ package java;

/**
Gets the native `java.lang.Class` from the supplied object. Will throw an exception in case of null being passed.
[deprecated] - use `getNativeType` instead
**/
inline public static function getNativeType<T>(obj:T):java.lang.Class<T>
{
Expand Down

0 comments on commit 5c44548

Please sign in to comment.