Starting from probably 0.2.0-beta.6 this code fails to compile:
import spasm.bindings;
import spasm.dom;
import spasm.types;
extern (C) export void _start()
{
import std.algorithm : move;
auto canvas = document.createElement("canvas").as!HTMLCanvasElement;
document.querySelector("body").front.appendChild(canvas);
auto context = canvas.getContext("2d").front.trustedGet!CanvasRenderingContext2D.move;
context.fillStyle("green"); // Causes error
context.fillText("Hello World!", 10, 10);
}
Compilation error:
source/app.d(13,19): Error: template spasm.bindings.html.CanvasRenderingContext2D.fillStyle cannot deduce function from argument types !()(string), candidates are:
/home/denis/.dub/packages/spasm-0.2.0-beta.7/spasm/source/spasm/bindings/html.d(552,8): fillStyle()(ref scope SumType!(string, CanvasGradient, CanvasPattern) fillStyle)
/home/denis/.dub/packages/spasm-0.2.0-beta.7/spasm/source/spasm/bindings/html.d(555,8): fillStyle()()
ldc2 failed with exit code 1.
This workaround is needed to call fillStyle and alike functions:
SumType!(string, CanvasGradient, CanvasPattern) color = "green";
context.fillStyle(color);
Starting from probably
0.2.0-beta.6this code fails to compile:Compilation error:
This workaround is needed to call
fillStyleand alike functions: