Skip to content

Instantly share code, notes, and snippets.

@ibilon
Last active August 25, 2018 14:29
Show Gist options
  • Save ibilon/a94efad43a8079281bd8fe16cfc5a3d4 to your computer and use it in GitHub Desktop.
Save ibilon/a94efad43a8079281bd8fe16cfc5a3d4 to your computer and use it in GitHub Desktop.
using Test;
class Test {
var A (default, never): Int = 1;
public function new() {
}
public function set(value:Int) {
trace(value);
}
public static inline function add(t:Test, other:Int) {
t.set(t.A + other); // create temp variable
}
public static inline function add2(t:Test, other:Int) {
t.set(other); // doesn't
}
static var t : Test;
static function main() {
t = new Test();
t.add(2);
t.add2(2);
}
}
// Generated by Haxe 4.0.0-preview.4+e926671
(function () { "use strict";
var $hxEnums = $hxEnums || {};
var Test = function() {
this.A = 1;
};
Test.add = function(t,other) {
t.set(t.A + other);
};
Test.add2 = function(t,other) {
t.set(other);
};
Test.main = function() {
Test.t = new Test();
var t = Test.t;
t.set(t.A + 2);
Test.t.set(2);
};
Test.prototype = {
set: function(value) {
console.log("Test.hx:10:",value);
}
};
Test.main();
})();
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment