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

Unified Diff: scripts/abprewrite.js

Issue 4935066966818816: Issue 1772 - [JSHydra] Convert const to var for Chrome (Closed)
Patch Set: Created Jan. 10, 2015, 12:03 a.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
« no previous file with comments | « autotest/test_abprewrite_module.js.expected ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: scripts/abprewrite.js
===================================================================
--- a/scripts/abprewrite.js
+++ b/scripts/abprewrite.js
@@ -207,22 +207,24 @@ function modifyExpressionStatement(ast)
block.body.push(Assignment(vars[i], Member(tempVar, i, true)));
return block;
}
return ast;
}
function modifyVariableDeclaration(ast)
{
- // Convert let variables:
+ // Convert let and const variables:
// let foo = bar;
+ // const bas = 4;
//
// Change into:
// var foo = bar;
- if (ast.kind == "let")
+ // var bas = 4;
+ if (ast.kind == "let" || ast.kind == "const")
ast.kind = "var";
if (ast.declarations.length == 1 && ast.declarations[0].type == "VariableDeclarator")
{
let declarator = ast.declarations[0];
// Remove timeline requires:
// let {Timeline} = require("timeline");
« no previous file with comments | « autotest/test_abprewrite_module.js.expected ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld