Skip to content

Commit

Permalink
support for-in statement cps conversion
Browse files Browse the repository at this point in the history
  • Loading branch information
nyuichi committed May 14, 2014
1 parent 4b99bdf commit 1ec4c36
Showing 1 changed file with 11 additions and 3 deletions.
14 changes: 11 additions & 3 deletions src/instruments.jsx
Expand Up @@ -1425,6 +1425,10 @@ class _ForInStatementTransformer extends _LabellableStatementTransformer {
return this._statement;
}

override function replaceControlStructuresWithGotos () : void {
this._transformer._emit(this._statement);
}

override function _replaceControlStructuresWithGotos () : void {
throw new Error("logic flaw");
}
Expand Down Expand Up @@ -2118,8 +2122,6 @@ class CPSTransformCommand extends FunctionTransformCommand {
if (funcDef.getNameToken() != null && funcDef.name() == "constructor")
return false;
return funcDef.forEachStatement(function onStatement (statement) {
if (statement instanceof ForInStatement)
return false;
return statement.forEachExpression(function onExpr (expr) {
if (! this._transformYield && expr instanceof YieldExpression)
return false;
Expand All @@ -2129,11 +2131,17 @@ class CPSTransformCommand extends FunctionTransformCommand {
}

override function transformFunction (funcDef : MemberFunctionDefinition) : void {
var cmd : StatementTransformCommand;

if (! this._functionIsTransformable(funcDef))
return;

// depends on normalize-try transform command
var cmd = new NormalizeTryStatementTransformCommand(this._compiler);
cmd = new NormalizeTryStatementTransformCommand(this._compiler);
cmd.setup([]);
cmd.transformFunction(funcDef);

cmd = new ForInStatementTransformCommand(this._compiler);
cmd.setup([]);
cmd.transformFunction(funcDef);

Expand Down

0 comments on commit 1ec4c36

Please sign in to comment.