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

Side by Side Diff: lib/src/js/printer.dart

Issue 1133593004: fixes #131, use before define from variables to classes (Closed) Base URL: git@github.com:dart-lang/dev_compiler.git@master
Patch Set: Created 5 years, 7 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 unified diff | Download patch
« no previous file with comments | « lib/src/js/nodes.dart ('k') | lib/src/utils.dart » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright (c) 2012, the Dart project authors. Please see the AUTHORS file 1 // Copyright (c) 2012, the Dart project authors. Please see the AUTHORS file
2 // for details. All rights reserved. Use of this source code is governed by a 2 // for details. All rights reserved. Use of this source code is governed by a
3 // BSD-style license that can be found in the LICENSE file. 3 // BSD-style license that can be found in the LICENSE file.
4 4
5 part of js_ast; 5 part of js_ast;
6 6
7 7
8 class JavaScriptPrintingOptions { 8 class JavaScriptPrintingOptions {
9 final bool shouldCompressOutput; 9 final bool shouldCompressOutput;
10 final bool minifyLocalVariables; 10 final bool minifyLocalVariables;
(...skipping 1030 matching lines...) Expand 10 before | Expand all | Expand 10 after
1041 void propertyNameOut(Expression node, {bool inMethod: false, 1041 void propertyNameOut(Expression node, {bool inMethod: false,
1042 bool inAccess: false}) { 1042 bool inAccess: false}) {
1043 1043
1044 if (node is LiteralNumber) { 1044 if (node is LiteralNumber) {
1045 LiteralNumber nameNumber = node; 1045 LiteralNumber nameNumber = node;
1046 if (inAccess) out('['); 1046 if (inAccess) out('[');
1047 out(nameNumber.value); 1047 out(nameNumber.value);
1048 if (inAccess) out(']'); 1048 if (inAccess) out(']');
1049 } else { 1049 } else {
1050 if (node is LiteralString) { 1050 if (node is LiteralString) {
1051 var quotedName = node.value; 1051 if (isValidJavaScriptId(node.value)) {
1052 if (isValidJavaScriptId(quotedName)) {
1053 if (inAccess) out('.'); 1052 if (inAccess) out('.');
1054 out(quotedName.substring(1, quotedName.length - 1)); 1053 out(node.valueWithoutQuotes);
1055 } else { 1054 } else {
1056 if (inMethod || inAccess) out("["); 1055 if (inMethod || inAccess) out("[");
1057 out(quotedName); 1056 out(node.value);
1058 if (inMethod || inAccess) out("]"); 1057 if (inMethod || inAccess) out("]");
1059 } 1058 }
1060 } else { 1059 } else {
1061 // ComputedPropertyName 1060 // ComputedPropertyName
1062 out("["); 1061 out("[");
1063 visitNestedExpression(node, EXPRESSION, 1062 visitNestedExpression(node, EXPRESSION,
1064 newInForInit: false, newAtStatementBegin: false); 1063 newInForInit: false, newAtStatementBegin: false);
1065 out("]"); 1064 out("]");
1066 } 1065 }
1067 } 1066 }
(...skipping 367 matching lines...) Expand 10 before | Expand all | Expand 10 after
1435 declare(node.name); 1434 declare(node.name);
1436 node.function.accept(this); 1435 node.function.accept(this);
1437 } 1436 }
1438 1437
1439 visitClassExpression(ClassExpression node) { 1438 visitClassExpression(ClassExpression node) {
1440 declare(node.name); 1439 declare(node.name);
1441 if (node.heritage != null) node.heritage.accept(this); 1440 if (node.heritage != null) node.heritage.accept(this);
1442 for (Method element in node.methods) element.accept(this); 1441 for (Method element in node.methods) element.accept(this);
1443 } 1442 }
1444 } 1443 }
OLDNEW
« no previous file with comments | « lib/src/js/nodes.dart ('k') | lib/src/utils.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698