Skip to content

Instantly share code, notes, and snippets.

@kg
Created May 6, 2011 07:13
Show Gist options
  • Save kg/958550 to your computer and use it in GitHub Desktop.
Save kg/958550 to your computer and use it in GitHub Desktop.
JSIL metaprogramming test case
using System;
using JSIL;
public static class Program {
public static void Main (string[] args) {
const string pri = "pri";
string nt = "nt";
var p = Builtins.Global[pri + nt];
if (p != null)
p("printed");
if (Builtins.Local["p"] != null)
Builtins.Local["p"]("printed again");
var q = Builtins.Global["quit"];
if (q != null)
q();
Console.WriteLine("test");
}
}
// l3k4qh1i, Version=0.0.0.0, Culture=neutral, PublicKeyToken=null
JSIL.DeclareNamespace(this, "Program");
Program.Main = function (args) {
var nt = null, p = null, q = null;
nt = "nt";
p = JSIL.GlobalNamespace[System.String.Concat("pri", nt)];
if (!!(p !== null)) {
p("printed");
}
if (!!(p !== null)) {
p("printed again");
}
q = JSIL.GlobalNamespace.quit;
if (!!(q !== null)) {
q();
}
System.Console.WriteLine("test");
}
timeout(30); Program.Main([]);
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment