Fix incorrect stack pop when replacing literals
This commit is contained in:
@@ -687,7 +687,8 @@ JavaScriptCompiler.prototype = {
|
|||||||
replaceStack: function(callback) {
|
replaceStack: function(callback) {
|
||||||
var prefix = '',
|
var prefix = '',
|
||||||
inline = this.isInline(),
|
inline = this.isInline(),
|
||||||
stack;
|
stack,
|
||||||
|
usedLiteral;
|
||||||
|
|
||||||
// If we are currently inline then we want to merge the inline statement into the
|
// If we are currently inline then we want to merge the inline statement into the
|
||||||
// replacement statement via ','
|
// replacement statement via ','
|
||||||
@@ -697,6 +698,7 @@ JavaScriptCompiler.prototype = {
|
|||||||
if (top instanceof Literal) {
|
if (top instanceof Literal) {
|
||||||
// Literals do not need to be inlined
|
// Literals do not need to be inlined
|
||||||
stack = top.value;
|
stack = top.value;
|
||||||
|
usedLiteral = true;
|
||||||
} else {
|
} else {
|
||||||
// Get or create the current stack name for use by the inline
|
// Get or create the current stack name for use by the inline
|
||||||
var name = this.stackSlot ? this.topStackName() : this.incrStack();
|
var name = this.stackSlot ? this.topStackName() : this.incrStack();
|
||||||
@@ -711,7 +713,7 @@ JavaScriptCompiler.prototype = {
|
|||||||
var item = callback.call(this, stack);
|
var item = callback.call(this, stack);
|
||||||
|
|
||||||
if (inline) {
|
if (inline) {
|
||||||
if (this.inlineStack.length || this.compileStack.length) {
|
if (!usedLiteral) {
|
||||||
this.popStack();
|
this.popStack();
|
||||||
}
|
}
|
||||||
this.push('(' + prefix + item + ')');
|
this.push('(' + prefix + item + ')');
|
||||||
|
|||||||
Reference in New Issue
Block a user