Skip to content

Instantly share code, notes, and snippets.

@ricokahler
Last active April 25, 2017 04:45
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save ricokahler/5bbed51756b8fd270e8f381471f7a58e to your computer and use it in GitHub Desktop.
Save ricokahler/5bbed51756b8fd270e8f381471f7a58e to your computer and use it in GitHub Desktop.
My Gist
// Generated by JSIL v0.8.2 build 13182. See http://jsil.org/ for more information.
'use strict';
var $asm00 = JSIL.GetAssembly("1dd27d7b, Version=0.0.0.0, Culture=neutral, PublicKeyToken=null");
var $asm01 = JSIL.GetAssembly("mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089");
var $asm02 = JSIL.GetAssembly("System.Core, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089");
/* Generated by JSIL v0.8.2 build 13182. See http://jsil.org/ for more information. */
'use strict';
var $asm00 = JSIL.DeclareAssembly("1dd27d7b, Version=0.0.0.0, Culture=neutral, PublicKeyToken=null");
JSIL.SetEntryPoint($asm00, $asm00.TypeRef("Program"), "Main", JSIL.MethodSignature.Void);
/* class Program */
(function Program$Members () {
var $, $thisType;
var $T00 = function () {
return ($T00 = JSIL.Memoize($asm00.Program_$lMain$gc__AnonStorey0)) ();
};
var $T01 = function () {
return ($T01 = JSIL.Memoize($asm01.System.Object)) ();
};
var $T02 = function () {
return ($T02 = JSIL.Memoize($asm01.System.Console)) ();
};
var $T03 = function () {
return ($T03 = JSIL.Memoize($asm01.System.Action)) ();
};
function Program_Main () {
var $lMain$gc__AnonStorey = new ($T00())();
var document = JSIL.GlobalNamespace.document;
var window = JSIL.GlobalNamespace.window;
var canvas = document.createElement("canvas");
var arg_E5_0 = $lMain$gc__AnonStorey;
arg_E5_0.ctx = canvas.getContext("2d");
var body = document.getElementsByTagName("body")[0];
$T02().WriteLine("Hello JSIL World!");
body.appendChild(canvas);
window.setInterval($T03().New($lMain$gc__AnonStorey, $T00().prototype.$l$gm__0, function () { return JSIL.GetMethodInfo($asm00.Program_$lMain$gc__AnonStorey0, "$l$gm__0", JSIL.MethodSignature.Void, false); }), 25);
};
function Program_Redraw (ctx) {
$thisType.x = ((($thisType.x | 0) + 2) | 0);
ctx.clearRect(0, 0, 300, 300);
ctx.fillStyle = "red";
ctx.fillRect($thisType.x, $thisType.y, 20, 20);
};
JSIL.MakeStaticClass("Program", true, [], function ($interfaceBuilder) {
$ = $interfaceBuilder;
$.Method({Static:true , Public:true }, "Main",
JSIL.MethodSignature.Void,
Program_Main
);
$.Method({Static:true , Public:true }, "Redraw",
JSIL.MethodSignature.Action($.Object),
Program_Redraw
)
.Parameter(0, "ctx", function (_) {
_.Attribute($asm02.TypeRef("System.Runtime.CompilerServices.DynamicAttribute"))
});
$.Field({Static:true , Public:true }, "x", $.Int32, 10);
$.Field({Static:true , Public:true }, "y", $.Int32, 20);
function Program__cctor () {
$thisType.x = 10;
$thisType.y = 20;
};
$.Method({Static:true , Public:false}, ".cctor",
JSIL.MethodSignature.Void,
Program__cctor
);
return function (newThisType) { $thisType = newThisType; };
});
})();
/* class Program+<Main>c__AnonStorey0 */
(function $lMain$gc__AnonStorey0$Members () {
var $, $thisType;
var $T00 = function () {
return ($T00 = JSIL.Memoize($asm00.Program)) ();
};
function $lMain$gc__AnonStorey0__ctor () {
};
function $lMain$gc__AnonStorey0_$l$gm__0 () {
$T00().Redraw(this.ctx);
};
JSIL.MakeType({
BaseType: $asm01.TypeRef("System.Object"),
Name: "Program+<Main>c__AnonStorey0",
IsPublic: false,
IsReferenceType: true,
MaximumConstructorArguments: 0,
}, function ($interfaceBuilder) {
$ = $interfaceBuilder;
$.Method({Static:false, Public:true }, ".ctor",
JSIL.MethodSignature.Void,
$lMain$gc__AnonStorey0__ctor
);
$.Method({Static:false, Public:false}, "$l$gm__0",
JSIL.MethodSignature.Void,
$lMain$gc__AnonStorey0_$l$gm__0
);
$.Field({Static:false, Public:false}, "ctx", $.Object)
.Attribute($asm02.TypeRef("System.Runtime.CompilerServices.DynamicAttribute"));
return function (newThisType) { $thisType = newThisType; };
})
.Attribute($asm01.TypeRef("System.Runtime.CompilerServices.CompilerGeneratedAttribute"));
})();
using System;
using JSIL;
using JSIL.Meta;
public static class Program {
public static int x = 10;
public static int y = 20;
public static void Main () {
dynamic document = Builtins.Global["document"];
dynamic window = Builtins.Global["window"];
var canvas = document.createElement("canvas");
var ctx = canvas.getContext("2d");
var body = document.getElementsByTagName("body")[0];
Console.WriteLine("Hello JSIL World!");
body.appendChild(canvas);
window.setInterval((Action)(() => {
Redraw(ctx);
}), 25);
}
public static void Redraw (dynamic ctx) {
x += 2;
ctx.clearRect(0, 0, 300, 300);
ctx.fillStyle = "red";
ctx.fillRect(x, y, 20, 20);
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment