krl-compiler
Advanced tools
Comparing version 0.11.0 to 0.12.0
{ | ||
"name": "krl-compiler", | ||
"version": "0.11.0", | ||
"version": "0.12.0", | ||
"description": "KRL compiler", | ||
@@ -5,0 +5,0 @@ "main": "src/index.js", |
@@ -254,9 +254,19 @@ var _ = require("lodash"); | ||
var fn_body = []; | ||
fn_body.push(e("return", e("obj", { | ||
type: e("str", "directive"), | ||
name: e("str", ast.args[0].value), | ||
options: e("obj", _.fromPairs(_.map(ast["with"], function(dec){ | ||
return [dec.left.value, comp(dec.right)]; | ||
}))) | ||
}))); | ||
if(ast.action | ||
&& ast.action.type === "Identifier" | ||
&& ast.action.value === "send_directive"){ | ||
fn_body.push(e("return", e("obj", { | ||
type: e("str", "directive"), | ||
name: e("str", ast.args[0].value), | ||
options: e("obj", _.fromPairs(_.map(ast["with"], function(dec){ | ||
return [dec.left.value, comp(dec.right)]; | ||
}))) | ||
}))); | ||
}else if(ast.action | ||
&& ast.action.type === "Identifier" | ||
&& ast.action.value === "noop"){ | ||
fn_body.push(e("return", e("void", e("number", 0)))); | ||
}else{ | ||
throw new Error("Unsuported RuleAction.action"); | ||
} | ||
return e("fn", ["ctx"], fn_body); | ||
@@ -263,0 +273,0 @@ }, |
18938
526