OLD | NEW |
1 // Copyright (c) 2015, the Dart project authors. Please see the AUTHORS file | 1 // Copyright (c) 2015, 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 library dev_compiler.src.codegen.js_codegen; | 5 library dev_compiler.src.codegen.js_codegen; |
6 | 6 |
7 import 'dart:collection' show HashSet, HashMap; | 7 import 'dart:collection' show HashSet, HashMap; |
8 import 'dart:io' show Directory, File; | 8 import 'dart:io' show Directory, File; |
9 | 9 |
10 import 'package:analyzer/analyzer.dart' hide ConstantEvaluator; | 10 import 'package:analyzer/analyzer.dart' hide ConstantEvaluator; |
(...skipping 1502 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1513 | 1513 |
1514 // Increment and write | 1514 // Increment and write |
1515 var one = AstBuilder.integerLiteral(1); | 1515 var one = AstBuilder.integerLiteral(1); |
1516 one.staticType = rules.provider.intType; | 1516 one.staticType = rules.provider.intType; |
1517 var increment = AstBuilder.binaryExpression(tmp, op.lexeme[0], one); | 1517 var increment = AstBuilder.binaryExpression(tmp, op.lexeme[0], one); |
1518 increment.staticType = type; | 1518 increment.staticType = type; |
1519 var write = _emitAssignment(expr, increment); | 1519 var write = _emitAssignment(expr, increment); |
1520 | 1520 |
1521 var bindThis = _maybeBindThis(expr); | 1521 var bindThis = _maybeBindThis(expr); |
1522 return js.call("((#) => (#, #))$bindThis(#)", [ | 1522 return js.call("((#) => (#, #))$bindThis(#)", [ |
1523 tmp.name, | 1523 _visit(tmp), |
1524 write, | 1524 write, |
1525 _visit(tmp), | 1525 _visit(tmp), |
1526 _visit(expr) | 1526 _visit(expr) |
1527 ]); | 1527 ]); |
1528 } | 1528 } |
1529 | 1529 |
1530 @override | 1530 @override |
1531 JS.Expression visitPostfixExpression(PostfixExpression node) { | 1531 JS.Expression visitPostfixExpression(PostfixExpression node) { |
1532 var op = node.operator; | 1532 var op = node.operator; |
1533 var expr = node.operand; | 1533 var expr = node.operand; |
(...skipping 795 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2329 | 2329 |
2330 // TODO(jmesserly): in many cases marking the end will be unncessary. | 2330 // TODO(jmesserly): in many cases marking the end will be unncessary. |
2331 printer.mark(_location(node.end)); | 2331 printer.mark(_location(node.end)); |
2332 } | 2332 } |
2333 | 2333 |
2334 String _getIdentifier(AstNode node) { | 2334 String _getIdentifier(AstNode node) { |
2335 if (node is SimpleIdentifier) return node.name; | 2335 if (node is SimpleIdentifier) return node.name; |
2336 return null; | 2336 return null; |
2337 } | 2337 } |
2338 } | 2338 } |
OLD | NEW |