fixes
This commit is contained in:
parent
9a72bc48d0
commit
a91ec70cfa
File diff suppressed because one or more lines are too long
|
|
@ -74,6 +74,9 @@ Cola.AST_Toplevel.prototype.toJavaScript = function(options){
|
|||
|
||||
*/
|
||||
if(options.main_binding && parent instanceof Cola.AST_Toplevel && node instanceof Cola.AST_Defun && node.name instanceof Cola.AST_SymbolDefun && node.name.name == "main"){
|
||||
node.name = new Cola.AST_SymbolLambda(node.name);
|
||||
node = new Cola.AST_Function(node);
|
||||
|
||||
props = {
|
||||
args : [new Cola.AST_String({ value : options.main_event }), node, new Cola.AST_False()],
|
||||
expression : new Cola.AST_Dot({
|
||||
|
|
@ -1780,7 +1783,7 @@ Cola.AST_Toplevel.prototype.toJavaScript = function(options){
|
|||
options.parser.is_js = /\.js$/.test(file);
|
||||
options.parser.filename = file;
|
||||
|
||||
var tl = Cola.parse(Cola.getSource(options.path_prefix + file), options.parser);
|
||||
var tl = Cola.parse(Cola.getSource(options.path_prefix + file, options.path_prefix != ""), options.parser);
|
||||
if (options.parser.is_js) tl = tl.toJavaScript({
|
||||
main_binding : options.main_binding,
|
||||
main_event : options.main_event,
|
||||
|
|
@ -1803,7 +1806,7 @@ Cola.AST_Toplevel.prototype.toJavaScript = function(options){
|
|||
options.parser.is_js = /\.js$/.test(file);
|
||||
options.parser.filename = file;
|
||||
|
||||
var tl = Cola.parse(Cola.getSource(options.path_prefix + file), options.parser);
|
||||
var tl = Cola.parse(Cola.getSource(options.path_prefix + file, options.path_prefix != ""), options.parser);
|
||||
if (options.parser.is_js) tl = tl.toJavaScript({
|
||||
main_binding : options.main_binding,
|
||||
main_event : options.main_event,
|
||||
|
|
|
|||
|
|
@ -3,7 +3,7 @@
|
|||
"description": "ColaScript translator / parser / mangler / compressor / beautifier toolkit",
|
||||
"homepage": "https://github.com/TrigenSoftware/ColaScript",
|
||||
"main": "tools/node.js",
|
||||
"version": "0.5.0",
|
||||
"version": "0.5.4",
|
||||
"engines": { "node" : ">=0.4.0" },
|
||||
"maintainers": [{
|
||||
"name": "Dan Onoshko (dangreen)",
|
||||
|
|
|
|||
|
|
@ -40,8 +40,8 @@ Cola.AST_Node.warn_function = function(txt) {
|
|||
sys.error("WARN: " + txt);
|
||||
};
|
||||
|
||||
Cola.getSource = function(file) {
|
||||
return fs.readFileSync(path.join(process.cwd(), file), "utf8");
|
||||
Cola.getSource = function(file, not_cwd) {
|
||||
return fs.readFileSync(not_cwd ? file : path.join(process.cwd(), file), "utf8");
|
||||
};
|
||||
|
||||
// XXX: perhaps we shouldn't export everything but heck, I'm lazy.
|
||||
|
|
@ -63,7 +63,8 @@ exports.translate = function(files, options) {
|
|||
output : null,
|
||||
compress : {},
|
||||
is_js : false,
|
||||
main_binding : true
|
||||
main_binding : true,
|
||||
path_prefix : ""
|
||||
});
|
||||
Cola.base54.reset();
|
||||
|
||||
|
|
@ -89,6 +90,7 @@ exports.translate = function(files, options) {
|
|||
|
||||
if (!options.is_js) toplevel = toplevel.toJavaScript({
|
||||
main_binding: options.main_binding,
|
||||
path_prefix : options.path_prefix,
|
||||
parser: {
|
||||
filename: options.fromString ? "?" : file,
|
||||
is_js : options.is_js
|
||||
|
|
|
|||
Loading…
Reference in New Issue
Block a user