Compiling the following code (using try-haxe.mrcdk.com) on Haxe 3.2.1 works as expected.
import promhx.Deferred;
import promhx.Stream;
class Test {
static function main() {
var ds1 = new Deferred<Int>();
var ds2 = new Deferred<Int>();
var s1 = ds1.stream();
var s2 = ds2.stream();
Stream.whenever(s1,s2).then(function(x,y) trace(x+y));
ds1.resolve(2);
ds2.resolve(3);
}
}
However, trying to compile using Haxe 3.3.0-RC1 I get the following error on both JavaScript, Flash and Neko targets:
/opt/haxelib/promhx/1,1,0/src/main/promhx/Stream.hx:56: characters 57-70 :
Cannot use Void as value
makes the code run as expected on the Flash and Neko targets. The JavaScript target throws a SyntaxError: Uncaught SyntaxError: In strict mode code, functions can only be declared at top level or inside a block.. The generated JavaScript code looks like this:
Test.main = function() {
var ds1 = new promhx_Deferred();
var ds2 = new promhx_Deferred();
var s1 = ds1.stream();
var s2 = ds2.stream();
{ then : function(f) {
// ...
Compiling the following code (using try-haxe.mrcdk.com) on Haxe 3.2.1 works as expected.
However, trying to compile using Haxe 3.3.0-RC1 I get the following error on both JavaScript, Flash and Neko targets:
This is probably related to https://github.com/jdonaldson/promhx/issues/81. So changing the offending line to
makes the code run as expected on the Flash and Neko targets. The JavaScript target throws a SyntaxError:
Uncaught SyntaxError: In strict mode code, functions can only be declared at top level or inside a block.
. The generated JavaScript code looks like this: