Created
June 7, 2011 08:23
-
-
Save kg/1011892 to your computer and use it in GitHub Desktop.
JSIL Code Sample: Verbatim JavaScript
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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] as dynamic; | |
if (p != null) | |
p("printed"); | |
if (Builtins.Local["p"] != null) | |
(Builtins.Local["p"] as dynamic)("printed again"); | |
var q = Builtins.Global["quit"] as dynamic; | |
if (q != null) | |
q(); | |
Console.WriteLine("test"); | |
} | |
} |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
JSIL.MakeStaticClass("Program", true, [], function ($) { | |
$.Method({Static:true , Public:true }, "Main", | |
$sig.get(1, null, [$jsilcore.TypeRef("System.Array", [$.String])], []), | |
function Main (args) { | |
var p = JSIL.GlobalNamespace[("pri" + "nt")]; | |
if (p !== null) { | |
p("printed"); | |
} | |
if (p !== null) { | |
p("printed again"); | |
} | |
var q = JSIL.GlobalNamespace.quit; | |
if (q !== null) { | |
q(); | |
} | |
$asm01.System.Console.WriteLine("test"); | |
} | |
); | |
}); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment