Skip to content

Commit

Permalink
Fixes #349 - Inline Marko template compilation support
Browse files Browse the repository at this point in the history
Also changed how JavaScript code is generated
  • Loading branch information
patrick-steele-idem committed Aug 19, 2016
1 parent 78a73e5 commit c386da8
Show file tree
Hide file tree
Showing 164 changed files with 1,793 additions and 1,370 deletions.
13 changes: 7 additions & 6 deletions compiler/Builder.js
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,6 @@ var Text = require('./ast/Text');
var ForEach = require('./ast/ForEach');
var ForEachProp = require('./ast/ForEachProp');
var ForRange = require('./ast/ForRange');
var Slot = require('./ast/Slot');
var HtmlComment = require('./ast/HtmlComment');
var SelfInvokingFunction = require('./ast/SelfInvokingFunction');
var ForStatement = require('./ast/ForStatement');
Expand Down Expand Up @@ -72,6 +71,7 @@ var literalUndefined = new Literal({value: undefined});
var literalTrue = new Literal({value: true});
var literalFalse = new Literal({value: false});
var identifierOut = new Identifier({name: 'out'});
var identifierRequire = new Identifier({name: 'require'});

class Builder {
arrayExpression(elements) {
Expand Down Expand Up @@ -266,6 +266,11 @@ class Builder {
}
}

htmlLiteral(htmlCode) {
var argument = new Literal({value: htmlCode});
return new Html({argument});
}

identifier(name) {
ok(typeof name === 'string', '"name" should be a string');

Expand Down Expand Up @@ -425,7 +430,7 @@ class Builder {
require(path) {
path = makeNode(path);

let callee = 'require';
let callee = identifierRequire;
let args = [ path ];
return new FunctionCall({callee, args});
}
Expand Down Expand Up @@ -462,10 +467,6 @@ class Builder {
return new SelfInvokingFunction({params, args, body});
}

slot(onDone) {
return new Slot({onDone});
}

strictEquality(left, right) {
left = makeNode(left);
right = makeNode(right);
Expand Down
Loading

0 comments on commit c386da8

Please sign in to comment.