Fix double toCSS calls in unusual situations causing an exception. Fixes #1830

This commit is contained in:
Luke Page
2014-02-08 16:45:36 +00:00
parent d82b39c2db
commit 6de8fc189f
2 changed files with 5 additions and 0 deletions

View File

@@ -18,6 +18,9 @@
},
visitMixinDefinition: function (mixinNode, visitArgs) {
// mixin definitions do not get eval'd - this means they keep state
// so we have to clear that state here so it isn't used if toCSS is called twice
mixinNode.frames = [];
return [];
},

View File

@@ -227,6 +227,8 @@ module.exports = function() {
} else {
try {
css = tree.toCSS(options);
var css2 = tree.toCSS(options); // integration test that 2nd call gets same output
if (css2 !== css) { throw new Error("css not equal to 2nd call"); }
callback(null, css);
} catch (e) {
callback(e);