Skip to content

Commit

Permalink
Make sure to never wipe out the type of already used expression such …
Browse files Browse the repository at this point in the history
…as the stack pointer.
  • Loading branch information
mbebenita committed Aug 20, 2012
1 parent 990f92b commit 6d07130
Showing 1 changed file with 8 additions and 0 deletions.
8 changes: 8 additions & 0 deletions src/util.js
Expand Up @@ -12,6 +12,7 @@
const BinaryExpression = T.BinaryExpression;
const Literal = T.Literal;
const MemberExpression = T.MemberExpression;
const SequenceExpression = T.SequenceExpression;


function realign(expr, lalign) {
Expand Down Expand Up @@ -49,6 +50,7 @@

function dereference(address, byteOffset, ty, scope, loc) {
assert(scope);
address = copy(address, address.ty);
address = alignAddress(address, byteOffset, ty);
var expr;
if (ty instanceof Types.ArrayType) {
Expand Down Expand Up @@ -136,6 +138,12 @@
return node;
}

function copy(node, ty) {
node = new SequenceExpression([node], node.loc);
node.ty = ty;
return node;
}

var OptParser = (function () {
function OptParser(flatspec) {
// ['a', 'arg', default, 'help string']
Expand Down

0 comments on commit 6d07130

Please sign in to comment.