krl-compiler
Advanced tools
Comparing version 0.5.0 to 0.5.1
{ | ||
"name": "krl-compiler", | ||
"version": "0.5.0", | ||
"version": "0.5.1", | ||
"description": "KRL compiler", | ||
@@ -5,0 +5,0 @@ "main": "src/index.js", |
@@ -43,3 +43,3 @@ var _ = require('lodash'); | ||
//TODO where: null | ||
//TODO ast.where | ||
@@ -46,0 +46,0 @@ _.each(ast.setting, function(s){ |
@@ -15,7 +15,3 @@ var _ = require('lodash'); | ||
'Identifier': function(ast, comp, e){ | ||
if(ast.value === 'my_name'){//TODO remove this hack | ||
//TODO remove this hack | ||
return e('call', e('id', 'ctx.scope.get'), [e('str', ast.value)]); | ||
} | ||
return e('id', toId(ast.value)); | ||
return e('call', e('id', 'ctx.scope.get'), [e('str', ast.value)]); | ||
}, | ||
@@ -74,4 +70,4 @@ 'Chevron': function(ast, comp, e){ | ||
var loc = param.loc; | ||
return e('var', | ||
comp(param), | ||
return e(';', e('call', e('id', 'ctx.scope.set', loc), [ | ||
e('str', param.value, loc), | ||
e('get', | ||
@@ -81,5 +77,4 @@ e('id', 'ctx.args', loc), | ||
loc | ||
), | ||
loc | ||
); | ||
) | ||
], loc), loc); | ||
}); | ||
@@ -99,8 +94,2 @@ _.each(ast.body, function(part, i){ | ||
if(ast.op === '='){ | ||
if(ast.left.value === 'msg'){//TODO remove this hack | ||
return e('var', | ||
e('id', ast.left.value, ast.left.loc), | ||
comp(ast.right) | ||
); | ||
} | ||
return e(';', e('call', e('id', 'ctx.scope.set'), [ | ||
@@ -107,0 +96,0 @@ e('str', ast.left.value, ast.left.loc), |
16292
455