Skip to content

Commit

Permalink
compiler, interpreter: Implement coerce_o
Browse files Browse the repository at this point in the history
  • Loading branch information
magcius committed Jun 8, 2012
1 parent 6446513 commit bf767da
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 1 deletion.
5 changes: 4 additions & 1 deletion src/avm2/compiler.js
Original file line number Diff line number Diff line change
Expand Up @@ -1214,7 +1214,10 @@ var Compiler = (function () {
case OP_coerce_s: pushValue("coerceString" + argumentList(state.stack.pop())); break;
case OP_astype: notImplemented(); break;
case OP_astypelate: notImplemented(); break;
case OP_coerce_o: notImplemented(); break;
case OP_coerce_o:
obj = state.stack.pop();
pushValue("(" + obj + " == undefined ? null : " + obj + ")");
break;
case OP_negate: expression(Operator.NEG); break;
case OP_increment:
pushValue(new Constant(1));
Expand Down
3 changes: 3 additions & 0 deletions src/avm2/interpreter.js
Original file line number Diff line number Diff line change
Expand Up @@ -441,6 +441,9 @@ var Interpreter = (function () {
break;
case OP_astype: notImplemented(); break;
case OP_astypelate: notImplemented(); break;
case OP_coerce_o:
obj = stack.pop();
stack.push(obj == undefined ? null : obj);
case OP_negate:
evaluateUnary(Operator.NEG);
break;
Expand Down

0 comments on commit bf767da

Please sign in to comment.