Rietveld Code Review Tool
Help | Bug tracker | Discussion group | Source code

Unified Diff: scripts/astDecompile.js

Issue 5417063522762752: Issue 427 - Desugar arrow functions to normal or bound functions (Closed)
Patch Set: Created May 10, 2014, 12:46 p.m.
Use n/p to move between diff chunks; N/P to move between comments.
Jump to:
View side-by-side diff with in-line comments
Download patch
« scripts/abprewrite.js ('K') | « scripts/abprewrite.js ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: scripts/astDecompile.js
===================================================================
--- a/scripts/astDecompile.js
+++ b/scripts/astDecompile.js
@@ -244,16 +244,22 @@ function decompileObjectExpression(ast)
}
return "{\n" + props.join(",\n") + "}";
}
function decompileFunctionExpression(ast) {
return decompileFunctionDeclaration(ast);
}
+function decompileArrowExpression(ast) {
+ str = "(" + ast.params.map(decompileAST).join(",") + ")";
Wladimir Palant 2014/05/15 06:53:44 Declare this variable? Also a nit: .join(", ") fo
+ str += " => " + decompileAST(ast.body);
+ return str;
+}
+
function decompileSequenceExpression(ast) {
return "(" + [decompileExpr(e, ast) for each (e in ast.expressions)].join(", ") + ")";
}
function decompileUnaryExpression(ast) {
if (ast.prefix)
return ast.operator + " " + decompileExpr(ast.argument, ast);
throw "ER, wtf?";
« scripts/abprewrite.js ('K') | « scripts/abprewrite.js ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld