Created
February 11, 2011 14:44
-
-
Save DmitrySoshnikov/822437 to your computer and use it in GitHub Desktop.
Quick test on Windows of Harmony Modules from Narcissus
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
var exports = this; | |
function require(module) { | |
load("lib/" + module.substr(2) + ".js"); | |
} | |
require("./definitions"); | |
require("./lexer"); | |
require("./parser"); | |
require("./decompiler"); | |
require("./jsresolve"); | |
require("./jsexec"); | |
var parsed = Narcissus.parser.parse("var x = 10;"); | |
//console.log(parsed); | |
var res = Narcissus.interpreter.evaluate("var x = 10; (function () { return x + x;})()"); | |
console.log(res); | |
Narcissus.options.version = "harmony"; | |
var code = " \ | |
module M { \ | |
export function toString() { \ | |
return '<#module M>' \ | |
} \ | |
} \ | |
"; | |
var res = Narcissus.interpreter.evaluate(code); | |
console.log(res); // <#module M> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment