Permalink
Browse files

tiny tweak to runtime

  • Loading branch information...
1 parent e8d3a6e commit 3592f7f4bd47380f1f3624a4cb70d660a846be0e @jlongster committed Nov 2, 2012
Showing with 8 additions and 9 deletions.
  1. +2 −2 src/compiler.js
  2. +6 −4 src/runtime.js
  3. +0 −3 tests/compiler.js
View
@@ -152,7 +152,7 @@ var Compiler = Object.extend({
this.emit(v);
}
else {
- this.emit('runtime.silenceUndefined(' +
+ this.emit('runtime.suppressValue(' +
'runtime.contextOrFrameLookup(' +
'context, frame, "' + name + '"))');
}
@@ -237,7 +237,7 @@ var Compiler = Object.extend({
},
compileLookupVal: function(node, frame) {
- this.emit('runtime.silenceUndefined(((');
+ this.emit('runtime.suppressValue(((');
this._compileExpression(node.target, frame);
this.emit(')||{})');
this.emit('[');
View
@@ -109,20 +109,22 @@ function numArgs(args) {
}
}
-function silenceUndefined(val) {
- return (val !== undefined) ? val : "";
+function suppressValue(val) {
+ return (val !== undefined && val !== null) ? val : "";
}
function contextOrFrameLookup(context, frame, name) {
var val = context.lookup(name);
- return val !== undefined ? val : frame.lookup(name);
+ return (val !== undefined && val !== null) ?
+ val :
+ frame.lookup(name);
}
module.exports = {
Frame: Frame,
makeMacro: makeMacro,
makeKeywordArgs: makeKeywordArgs,
numArgs: numArgs,
- silenceUndefined: silenceUndefined,
+ suppressValue: suppressValue,
contextOrFrameLookup: contextOrFrameLookup
};
View
@@ -50,9 +50,6 @@ describe('compiler', function() {
var s = render('{{ foo }}', {foo: false});
s.should.equal('false');
-
- var s = render('{{ foo }}', {foo: null});
- s.should.equal('null');
});
it('should compile function calls', function() {

0 comments on commit 3592f7f

Please sign in to comment.