Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix __js__ and Utf8 deprecation warnings #23

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 4 additions & 0 deletions src/yaml/Parser.hx
Original file line number Diff line number Diff line change
Expand Up @@ -1980,9 +1980,13 @@ class Parser

static function createUtf8Char(hex:Int):String
{
#if haxe4
return String.fromCharCode(hex);
#else
var utf8 = new Utf8(1);
utf8.addChar(hex);
return utf8.toString();
#end
}

public static var HEXADECIMAL_ESCAPE_SEQUENCES:IntMap<Int> =
Expand Down
4 changes: 4 additions & 0 deletions src/yaml/type/YTimestamp.hx
Original file line number Diff line number Diff line change
Expand Up @@ -116,8 +116,12 @@ class YTimestamp extends YamlType<Date, String>
#elseif flash
return untyped _global["Date"];
#elseif js
#if haxe4
return js.Syntax.code("Date");
#else
return untyped __js__("Date");
#end
#end
return null;
}
#end
Expand Down
8 changes: 8 additions & 0 deletions src/yaml/util/Dates.hx
Original file line number Diff line number Diff line change
Expand Up @@ -36,8 +36,12 @@ class Dates
#elseif flash
return untyped _global["Date"];
#elseif js
#if haxe4
return js.Syntax.code("Date");
#else
return untyped __js__("Date");
#end
#end
return null;
}

Expand All @@ -54,7 +58,11 @@ class Dates
public static function toISOString(date:Date):String
{
var NativeDate = getNativeDate();
#if haxe4
var d = js.Syntax.construct(NativeDate, date.getTime());
#else
var d = untyped __new__(NativeDate, date.getTime());
#end

return d.getUTCFullYear() + '-'
+ StringTools.lpad("" + (d.getUTCMonth() + 1), "0", 2) + '-'
Expand Down
5 changes: 5 additions & 0 deletions src/yaml/util/Ints.hx
Original file line number Diff line number Diff line change
Expand Up @@ -102,8 +102,13 @@ class Ints

#if js

#if haxe4
var v = js.Syntax.code("parseInt")(value, radix);
return (js.Syntax.code("isNaN")(v)) ? null : v;
#else
var v = untyped __js__("parseInt")(value, radix);
return (untyped __js__("isNaN")(v)) ? null : v;
#end

#elseif flash9

Expand Down