Run formatter

This commit is contained in:
Joshua Granick
2019-12-24 10:19:56 -08:00
parent c8b994e1ce
commit ea57f2211c
19 changed files with 131 additions and 116 deletions

View File

@@ -30,7 +30,7 @@ package flash.events;
function new(type:String, bubbles:Bool = true, cancelable:Bool = false, touchPointID:Int = 0, isPrimaryTouchPoint:Bool = false, localX:Float = 0. /*NaN*/,
localY:Float = 0. /*NaN*/, sizeX:Float = 0. /*NaN*/, sizeY:Float = 0. /*NaN*/, pressure:Float = 0. /*NaN*/,
?relatedObject:flash.display.InteractiveObject, ctrlKey:Bool = false, altKey:Bool = false, shiftKey:Bool = false
#if air, commandKey:Bool = false, controlKey:Bool = false, ?timestamp:Float, ?touchIntent:TouchEventIntent, ?samples:flash.utils.ByteArray,
#if air, commandKey:Bool = false, controlKey:Bool = false, ?timestamp :Float, ?touchIntent :TouchEventIntent, ?samples :flash.utils.ByteArray,
isTouchPointCanceled:Bool = false #end):Void;
#if air
function getSamples(buffer:flash.utils.ByteArray, append:Bool = false):UInt;

View File

@@ -1067,7 +1067,7 @@ class Bytes
setInt32(pos, v.low);
}
public function getString(pos:Int, len:Int #if (!hl || haxe_ver >= 4), ?encoding:#if (haxe_ver >= 4) haxe.io.Encoding #else Dynamic #end #end):String
public function getString(pos:Int, len:Int #if (!hl || haxe_ver >= 4), ?encoding :#if (haxe_ver >= 4) haxe.io.Encoding #else Dynamic #end #end):String
{
if (outRange(pos, len)) throw Error.OutsideBounds;
@@ -1118,7 +1118,7 @@ class Bytes
}
public static function ofString(s:String
#if (!hl || haxe_ver >= 4), ?encoding:#if (haxe_ver >= 4) haxe.io.Encoding #else Dynamic #end #end):Bytes@:privateAccess {
#if (!hl || haxe_ver >= 4), ?encoding :#if (haxe_ver >= 4) haxe.io.Encoding #else Dynamic #end #end):Bytes @:privateAccess {
var size = 0;
var b = s.bytes.utf16ToUtf8(0, size);
return new Bytes(b, size);

View File

@@ -78,7 +78,7 @@ class HTML5AudioSource
if (parent.buffer != null && parent.buffer.__srcHowl != null)
{
parent.buffer.__srcHowl.stop(id);
parent.buffer.__srcHowl.off ("end", howl_onEnd, id);
parent.buffer.__srcHowl.off("end", howl_onEnd, id);
}
#end
}
@@ -100,7 +100,7 @@ class HTML5AudioSource
else if (parent.buffer != null && parent.buffer.__srcHowl != null)
{
parent.buffer.__srcHowl.stop(id);
parent.buffer.__srcHowl.off ("end", howl_onEnd, id);
parent.buffer.__srcHowl.off("end", howl_onEnd, id);
}
completed = true;

View File

@@ -81,13 +81,16 @@ class HTML5HTTPRequest
{
if (query.length > 0) query += "&";
var value:Dynamic = parent.formData.get(key);
if (key.indexOf("[]") > -1 && Std.is(value, Array)) {
var arrayValue:String = Lambda.map(value, function(v:String) {
if (key.indexOf("[]") > -1 && Std.is(value, Array))
{
var arrayValue:String = Lambda.map(value, function(v:String)
{
return StringTools.urlEncode(v);
}).join('&${key}=');
query += StringTools.urlEncode(key) + "=" + arrayValue;
}
else {
else
{
query += StringTools.urlEncode(key) + "=" + StringTools.urlEncode(Std.string(value));
}
}

View File

@@ -904,20 +904,20 @@ class HTML5Window
public function setClipboard(value:String):Void
{
if (textArea == null)
{
textArea = cast Browser.document.createElement("textarea");
textArea.style.height = "0px";
textArea.style.left = "-100px";
textArea.style.opacity = "0";
textArea.style.position = "fixed";
textArea.style.top = "-100px";
textArea.style.width = "0px";
Browser.document.body.appendChild(textArea);
}
textArea.value = value;
textArea.focus();
textArea.select();
if (textArea == null)
{
textArea = cast Browser.document.createElement("textarea");
textArea.style.height = "0px";
textArea.style.left = "-100px";
textArea.style.opacity = "0";
textArea.style.position = "fixed";
textArea.style.top = "-100px";
textArea.style.width = "0px";
Browser.document.body.appendChild(textArea);
}
textArea.value = value;
textArea.focus();
textArea.select();
if (Browser.document.queryCommandEnabled("copy"))
{

View File

@@ -386,7 +386,6 @@ class NativeHTTPRequest
// Wrong thread
// promise.progress (bytesLoaded, bytesTotal);
}
}
private function curl_onWrite(curl:CURL, output:Bytes):Int

View File

@@ -337,7 +337,8 @@ class ImageDataUtil
var destBytesPerPixel = Std.int(image.buffer.bitsPerPixel / 8);
var useAlphaImage = (alphaImage != null && alphaImage.transparent);
var blend = (mergeAlpha || (useAlphaImage && !image.transparent)) || (!mergeAlpha && !image.transparent && sourceImage.transparent);
var blend = (mergeAlpha || (useAlphaImage && !image.transparent))
|| (!mergeAlpha && !image.transparent && sourceImage.transparent);
if (!useAlphaImage)
{
@@ -424,7 +425,9 @@ class ImageDataUtil
var alphaFormat = alphaImage.buffer.format;
var alphaPosition, alphaPixel:RGBA;
var alphaView = new ImageDataView(alphaImage, new Rectangle(sourceView.x + (alphaPoint == null ? 0 : alphaPoint.x), sourceView.y + (alphaPoint == null ? 0 : alphaPoint.y), sourceView.width, sourceView.height));
var alphaView = new ImageDataView(alphaImage,
new Rectangle(sourceView.x + (alphaPoint == null ? 0 : alphaPoint.x), sourceView.y + (alphaPoint == null ? 0 : alphaPoint.y),
sourceView.width, sourceView.height));
destView.clip(Std.int(destPoint.x), Std.int(destPoint.y), alphaView.width, alphaView.height);

View File

@@ -24,8 +24,8 @@ class InternalEncoding
**/
public static var internalEncoding(get, never):String;
static inline function get_internalEncoding():String
#if (neko || php || cpp || lua || macro) return "UTF-8"; #elseif python return "UTF-32"; #else return "UTF-16"; #end
static inline function get_internalEncoding():String #if (neko || php || cpp || lua || macro) return "UTF-8"; #elseif python return "UTF-32"; #else return
"UTF-16"; #end
/**
Returns the UTF-8/16/32 code unit at position `index` of

View File

@@ -39,8 +39,7 @@ import lime.utils.Log;
@:fileXml('tags="haxe,release"')
@:noDebug
#end
@:allow(lime.app.Promise)
/*@:generic*/
@:allow(lime.app.Promise) /*@:generic*/
class Future<T>
{
/**

View File

@@ -413,7 +413,7 @@ class HXProject extends Script
}
project.languages = languages.copy();
if (launchStoryboard != null)
{
project.launchStoryboard = launchStoryboard.clone();
@@ -909,7 +909,7 @@ class HXProject extends Script
{
launchStoryboard.merge(project.launchStoryboard);
}
languages = ArrayTools.concatUnique(languages, project.languages, true);
libraries = ArrayTools.concatUnique(libraries, project.libraries, true);

View File

@@ -138,25 +138,26 @@ class ImageHelper
var toReturn = {width: 0, height: 0};
var fileInput = File.read(path);
var header = (fileInput.readByte() << 8) | fileInput.readByte();
if (header == 0x8950)
{
fileInput.seek(8 + 4 + 4, FileSeek.SeekBegin);
var width = (fileInput.readByte() << 24) | (fileInput.readByte() << 16) | (fileInput.readByte() << 8) | fileInput.readByte();
var height = (fileInput.readByte() << 24) | (fileInput.readByte() << 16) | (fileInput.readByte() << 8) | fileInput.readByte();
toReturn = {
width: width,
height: height
};
toReturn =
{
width: width,
height: height
};
}
fileInput.close();
return toReturn;
}
public static function resizeImage(image:#if (lime && lime_cffi && !macro) Image #else Dynamic #end, width:Int,
height:Int):#if (lime && lime_cffi && !macro) Image #else Dynamic #end
{

View File

@@ -7,11 +7,11 @@ class LaunchStoryboard
public var assetsPath:String;
public var assets:Array<LaunchStoryboardAsset>;
public var path:String;
public var template:String;
public var templateContext:Dynamic;
public function new ()
public function new()
{
assets = [];
templateContext = {};
@@ -25,10 +25,10 @@ class LaunchStoryboard
launchStoryboard.path = path;
launchStoryboard.template = template;
launchStoryboard.templateContext = ObjectTools.copyFields(templateContext, {});
return launchStoryboard;
}
public function merge(launchStoryboard:LaunchStoryboard):Void
{
if (launchStoryboard != null)
@@ -45,7 +45,7 @@ class LaunchStoryboard
class LaunchStoryboardAsset
{
public var type:String;
public function new(type:String)
{
this.type = type;
@@ -57,10 +57,10 @@ class ImageSet extends LaunchStoryboardAsset
public var name:String;
public var width = 0;
public var height = 0;
public function new(name:String)
{
super("imageset");
this.name = name;
}
}
}

View File

@@ -1365,13 +1365,13 @@ class ProjectXMLParser extends HXProject
}
splashScreens.push(splashScreen);
case "launchStoryboard":
if (launchStoryboard == null)
{
launchStoryboard = new LaunchStoryboard();
}
if (element.has.path)
{
launchStoryboard.path = Path.combine(extensionPath, substitute(element.att.path));
@@ -1388,7 +1388,7 @@ class ProjectXMLParser extends HXProject
for (attr in element.x.attributes())
{
if (attr == "assetsPath") continue;
var valueType = "String";
var valueName = attr;
@@ -1401,13 +1401,13 @@ class ProjectXMLParser extends HXProject
var stringValue = element.x.get(attr);
var value:Dynamic;
switch(valueType)
switch (valueType)
{
case "Int":
value = Std.parseInt(stringValue);
case "RGB":
var rgb:lime.math.ARGB = Std.parseInt(stringValue);
value = {r: rgb.r/255, g: rgb.g/255, b: rgb.b/255};
value = {r: rgb.r / 255, g: rgb.g / 255, b: rgb.b / 255};
case "String":
value = stringValue;
default:
@@ -1418,29 +1418,27 @@ class ProjectXMLParser extends HXProject
Reflect.setField(launchStoryboard.templateContext, valueName, value);
}
}
if (element.has.assetsPath)
{
launchStoryboard.assetsPath = Path.combine(extensionPath, substitute(element.att.assetsPath));
}
for (childElement in element.elements)
{
var isValid = isValidElement(childElement, "");
if (isValid)
{
switch(childElement.name)
switch (childElement.name)
{
case "imageset":
var name = substitute(childElement.att.name);
var imageset = new LaunchStoryboard.ImageSet(name);
if (childElement.has.width)
imageset.width = Std.parseInt(substitute(childElement.att.width));
if (childElement.has.height)
imageset.height = Std.parseInt(substitute(childElement.att.height));
if (childElement.has.width) imageset.width = Std.parseInt(substitute(childElement.att.width));
if (childElement.has.height) imageset.height = Std.parseInt(substitute(childElement.att.height));
launchStoryboard.assets.push(imageset);
}
}

View File

@@ -11,7 +11,11 @@ abstract ArrayBuffer(Bytes) from Bytes to Bytes
#end
{
public var byteLength(get, never):Int;
private inline function get_byteLength() { return this.length; }
private inline function get_byteLength()
{
return this.length;
}
public inline function new(byteLength:Int)
{

View File

@@ -479,7 +479,7 @@ class CommandLineTools
{
neko.Lib.load("lime", "lime_application_create", 0);
}
catch(e:Dynamic)
catch (e:Dynamic)
{
untyped $loader.path = $array(path + "Windows64/", $loader.path);
}

View File

@@ -56,15 +56,15 @@ class SVGExport
untyped $loader.path = $array(path + "Windows/", $loader.path);
// if (CFFI.enabled)
// {
try
{
neko.Lib.load("lime", "lime_application_create", 0);
}
catch(e:Dynamic)
{
untyped $loader.path = $array(path + "Windows64/", $loader.path);
}
// }
try
{
neko.Lib.load("lime", "lime_application_create", 0);
}
catch (e:Dynamic)
{
untyped $loader.path = $array(path + "Windows64/", $loader.path);
}
// }
case MAC:
untyped $loader.path = $array(path + "Mac/", $loader.path);

View File

@@ -242,14 +242,17 @@ class AndroidPlatform extends PlatformTarget
{
build = "release";
}
if (project.environment.exists("ANDROID_GRADLE_TASK"))
{
var task = project.environment.get("ANDROID_GRADLE_TASK");
if ( task == "assembleDebug" ) {
build = "debug";
} else {
build = "release";
if (task == "assembleDebug")
{
build = "debug";
}
else
{
build = "release";
}
}
@@ -257,11 +260,11 @@ class AndroidPlatform extends PlatformTarget
if (project.config.exists("android.gradle-build-directory"))
{
outputDirectory = Path.combine(project.config.getString("android.gradle-build-directory"), project.app.file + "/app/outputs/apk/"+build);
outputDirectory = Path.combine(project.config.getString("android.gradle-build-directory"), project.app.file + "/app/outputs/apk/" + build);
}
else
{
outputDirectory = Path.combine(FileSystem.fullPath(targetDirectory), "bin/app/build/outputs/apk/"+build);
outputDirectory = Path.combine(FileSystem.fullPath(targetDirectory), "bin/app/build/outputs/apk/" + build);
}
var apkPath = Path.combine(outputDirectory, project.app.file + "-" + build + ".apk");

View File

@@ -506,10 +506,10 @@ class IOSPlatform extends PlatformTarget
if (project.launchStoryboard != null)
{
var sb = project.launchStoryboard;
var assetsPath = sb.assetsPath;
var imagesets = [];
for (asset in sb.assets)
{
switch (asset.type)
@@ -517,22 +517,22 @@ class IOSPlatform extends PlatformTarget
case "imageset":
var imageset = cast(asset, ImageSet);
imagesets.push(imageset);
var imagesetPath = Path.combine(projectDirectory, "Images.xcassets/" + imageset.name + ".imageset");
System.mkdir(imagesetPath);
var baseImageName = Path.withoutExtension(imageset.name);
var imageScales = ["1x", "2x", "3x"];
var images = [];
for (scale in imageScales)
{
var filename = baseImageName + (scale == "1x" ? "" : "@"+scale) + ".png";
var filename = baseImageName + (scale == "1x" ? "" : "@" + scale) + ".png";
if (FileSystem.exists(Path.combine(assetsPath, filename)))
{
images.push({idiom: "universal", filename: filename, scale: scale});
System.copyFile(Path.combine(assetsPath, filename), Path.combine(imagesetPath, filename));
if (imageset.width == 0 || imageset.height == 0)
{
var dim = ImageHelper.readPNGImageSize(Path.combine(assetsPath, filename));
@@ -542,49 +542,53 @@ class IOSPlatform extends PlatformTarget
}
}
}
var contents = {
images: images,
info: {
version: "1",
author: "xcode"
}
};
var contents =
{
images: images,
info:
{
version: "1",
author: "xcode"
}
};
File.saveContent(Path.combine(imagesetPath, "Contents.json"), Json.stringify(contents));
default:
}
}
if (sb.template != null)
{
sb.templateContext.imagesets = [];
for (imageset in imagesets)
{
sb.templateContext.imagesets.push({
name: imageset.name,
width: imageset.width,
height: imageset.height,
});
sb.templateContext.imagesets.push(
{
name: imageset.name,
width: imageset.width,
height: imageset.height,
});
}
var deployment:String = context.DEPLOYMENT;
var parts = deployment.split(".");
var major = Std.parseInt(parts[0]);
var minor = parts.length >= 2 ? Std.parseInt(parts[1]) : 0;
var patch = parts.length >= 3 ? Std.parseInt(parts[2]) : 0;
Reflect.setField(sb.templateContext, "deploymentVersion", {
major: major,
minor: minor,
patch: patch,
code: Std.parseInt("0x" + major + minor + patch)
});
System.copyFileTemplate(project.templatePaths, "ios/storyboards/" + sb.template, projectDirectory + sb.template, sb.templateContext, true, true);
Reflect.setField(sb.templateContext, "deploymentVersion",
{
major: major,
minor: minor,
patch: patch,
code: Std.parseInt("0x" + major + minor + patch)
});
System.copyFileTemplate(project.templatePaths, "ios/storyboards/" + sb.template, projectDirectory + sb.template, sb.templateContext, true,
true);
context.IOS_LAUNCH_STORYBOARD = Path.withoutExtension(sb.template);
}
else
@@ -643,7 +647,7 @@ class IOSPlatform extends PlatformTarget
context.HAS_LAUNCH_IMAGE = true;
}
System.mkdir(projectDirectory + "/resources");
System.mkdir(projectDirectory + "/haxe/build");

View File

@@ -87,7 +87,8 @@ class WindowsPlatform extends PlatformTarget
if ((targetType == "cpp" || targetType == "winrt"))
{
is64 = true;
} else if (targetType == "neko")
}
else if (targetType == "neko")
{
try
{