Skip to content

Instantly share code, notes, and snippets.

@mrcdk
Created December 17, 2015 20:54
Show Gist options
  • Save mrcdk/0c196ae7c6c00374e385 to your computer and use it in GitHub Desktop.
Save mrcdk/0c196ae7c6c00374e385 to your computer and use it in GitHub Desktop.
[haxe] Java and C# inline problems
-main Main
--each
--next
-cmd echo C#
-cs bin
-cmd mono bin/bin/Main.exe
--next
-cmd echo JS
-js bin/main.js
-cmd node bin/main.js
#pragma warning disable 109, 114, 219, 429, 168, 162
public class EntryPoint__Main {
public static void Main() {
global::cs.Boot.init();
global::Main.main();
}
}
public class Main : global::haxe.lang.HxObject {
public Main(global::haxe.lang.EmptyObject empty) {
}
public Main() {
global::Main.__hx_ctor__Main(this);
}
public static void __hx_ctor__Main(global::Main __temp_me7) {
}
public static void main() {
unchecked {
string raw = "Hello world !!!";
int cursor = 0;
int __temp_stmt1 = default(int);
{
cursor = global::haxe.lang.StringExt.indexOf(raw, " ", default(global::haxe.lang.Null<int>));
__temp_stmt1 = cursor = ( (( (( cursor > -1 )) ? (cursor) : (raw.Length) )) + " ".Length );
}
string hello = global::haxe.lang.StringExt.substring(raw, 0, new global::haxe.lang.Null<int>(__temp_stmt1, true));
int __temp_stmt2 = default(int);
{
cursor = global::haxe.lang.StringExt.indexOf(raw, " ", new global::haxe.lang.Null<int>(cursor, true));
__temp_stmt2 = cursor = ( (( (( cursor > -1 )) ? (cursor) : (raw.Length) )) + " ".Length );
}
string world = global::haxe.lang.StringExt.substring(raw, cursor, new global::haxe.lang.Null<int>(__temp_stmt2, true));
global::haxe.Log.trace.__hx_invoke2_o(default(double), hello, default(double), new global::haxe.lang.DynamicObject(new int[]{302979532, 1547539107, 1648581351}, new object[]{"main", "Main", "Main.hx"}, new int[]{1981972957}, new double[]{((double) (16) )}));
global::haxe.Log.trace.__hx_invoke2_o(default(double), world, default(double), new global::haxe.lang.DynamicObject(new int[]{302979532, 1547539107, 1648581351}, new object[]{"main", "Main", "Main.hx"}, new int[]{1981972957}, new double[]{((double) (17) )}));
}
}
public static new object __hx_createEmpty() {
return new global::Main(global::haxe.lang.EmptyObject.EMPTY);
}
public static new object __hx_create(global::Array arr) {
return new global::Main();
}
}
class Main {
public static function main() {
var raw = "Hello world !!!";
var cursor:Int = 0;
inline function adv(char:String = " ", ?start:Int) {
cursor = raw.indexOf(char, start);
return cursor = (cursor > -1 ? cursor : raw.length) + char.length;
}
var hello = raw.substring(0, adv());
var world = raw.substring(cursor, adv(cursor));
trace(hello);
trace(world);
}
}
(function (console) { "use strict";
var Main = function() { };
Main.main = function() {
var raw = "Hello world !!!";
var cursor = 0;
var hello = raw.substring(0,(function($this) {
var $r;
cursor = raw.indexOf(" ",null);
$r = cursor = (cursor > -1?cursor:raw.length) + " ".length;
return $r;
}(this)));
var world = raw.substring(cursor,(function($this) {
var $r;
cursor = raw.indexOf(" ",cursor);
$r = cursor = (cursor > -1?cursor:raw.length) + " ".length;
return $r;
}(this)));
console.log(hello);
console.log(world);
};
Main.main();
})(typeof console != "undefined" ? console : {log:function(){}});
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment