Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(1)

Unified Diff: lib/src/js/printer.dart

Issue 1643523008: fix #43, remove => workaround (Closed) Base URL: git@github.com:dart-lang/dev_compiler.git@master
Patch Set: Created 4 years, 11 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « lib/src/js/nodes.dart ('k') | lib/src/options.dart » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: lib/src/js/printer.dart
diff --git a/lib/src/js/printer.dart b/lib/src/js/printer.dart
index e0e2c14c40219ca94d5000c450d11facf2d31c51..bd8de3b40aa49c9bae41dc8051df78f5f84e9465 100644
--- a/lib/src/js/printer.dart
+++ b/lib/src/js/printer.dart
@@ -15,16 +15,12 @@ class JavaScriptPrintingOptions {
/// Modern JS engines support this.
final bool allowKeywordsInProperties;
- /// Workaround if `this` is not bound in arrow functions.
- final bool arrowFnBindThisWorkaround;
-
JavaScriptPrintingOptions(
{this.shouldCompressOutput: false,
this.minifyLocalVariables: false,
this.preferSemicolonToNewlineInMinifiedOutput: false,
this.allowKeywordsInProperties: false,
- this.allowSingleLineIfStatements: false,
- this.arrowFnBindThisWorkaround: false});
+ this.allowSingleLineIfStatements: false});
}
@@ -578,11 +574,6 @@ class Printer implements NodeVisitor {
visitNestedExpression(Expression node, int requiredPrecedence,
{bool newInForInit, bool newAtStatementBegin}) {
int nodePrecedence = node.precedenceLevel;
- if (options.arrowFnBindThisWorkaround) {
- if (node is ArrowFun && node.closesOverThis) {
- nodePrecedence = CALL;
- }
- }
bool needsParentheses =
// a - (b + c).
(requiredPrecedence != EXPRESSION &&
@@ -929,10 +920,6 @@ class Printer implements NodeVisitor {
}
visitArrowFun(ArrowFun fun) {
- bool bindThis = options.arrowFnBindThisWorkaround && fun.closesOverThis;
- if (bindThis) {
- out("(");
- }
localNamer.enterScope(fun);
if (fun.params.length == 1) {
visitNestedExpression(fun.params.single, SPREAD,
@@ -959,9 +946,6 @@ class Printer implements NodeVisitor {
blockBody(fun.body, needsSeparation: false, needsNewline: false);
}
localNamer.leaveScope();
- if (bindThis) {
- out(").bind(this)");
- }
}
visitLiteralBool(LiteralBool node) {
« no previous file with comments | « lib/src/js/nodes.dart ('k') | lib/src/options.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698