Marko v3: Added codegen test for scoped variables

This commit is contained in:
Patrick Steele-Idem 2016-02-12 17:19:09 -07:00
parent a574a2be82
commit 214aa9bc07
2 changed files with 18 additions and 0 deletions

View File

@ -0,0 +1,5 @@
(function() {
var name = "string";
log(name);
}())

View File

@ -0,0 +1,13 @@
'use strict';
module.exports = function(builder) {
var declarations = [
{
id: builder.identifier('name'),
init: builder.literal('string')
}
];
var vars = builder.vars(declarations);
vars.appendChild(builder.functionCall(builder.identifier('log'), [ builder.identifier('name') ]));
return vars;
};