diff --git a/hsp/rt.js b/hsp/rt.js index ea749ab..47d49cf 100644 --- a/hsp/rt.js +++ b/hsp/rt.js @@ -133,7 +133,7 @@ refresh.addTemplate = function (tpl) { */ exports.template = function (arg, contentFunction) { // closure variables - var ng = new NodeGenerator(null), args = [], sz = 0, hasController = false, Ctl = null; + var ng = new NodeGenerator(null), args = [], sz = 0, hasController = false, Ctl = null, fileScope; if (arg.constructor === Array) { sz = arg.length; for (var i = 0; sz > i; i++) { @@ -162,7 +162,7 @@ exports.template = function (arg, contentFunction) { } var f = function () { - var cw = null, cptInitArgs = null, fileScope; + var cw = null, cptInitArgs = null; if (!ng.nodedefs) { try { var r = contentFunction(nodes); diff --git a/test/rt/filescope.spec.hsp b/test/rt/filescope.spec.hsp new file mode 100644 index 0000000..9ecf6a2 --- /dev/null +++ b/test/rt/filescope.spec.hsp @@ -0,0 +1,52 @@ + +/* + * Copyright 2012 Amadeus s.a.s. + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +var hsp=require("hsp/rt"), + ht=require("hsp/utils/hashtester"); + + +function globalHelper() { + return true; +} + +{template test1} + {if (globalHelper())} +