| 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 import 'dart:collection' show HashMap, HashSet; | 5 import 'dart:collection' show HashMap, HashSet; |
| 6 import 'dart:math' show min, max; | 6 import 'dart:math' show min, max; |
| 7 | 7 |
| 8 import 'package:analyzer/analyzer.dart' hide ConstantEvaluator; | 8 import 'package:analyzer/analyzer.dart' hide ConstantEvaluator; |
| 9 import 'package:analyzer/dart/ast/ast.dart'; | 9 import 'package:analyzer/dart/ast/ast.dart'; |
| 10 import 'package:analyzer/dart/ast/token.dart' show Token, TokenType; | 10 import 'package:analyzer/dart/ast/token.dart' show Token, TokenType; |
| (...skipping 4170 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 4181 | 4181 |
| 4182 @override | 4182 @override |
| 4183 JS.LiteralString visitSimpleStringLiteral(SimpleStringLiteral node) => | 4183 JS.LiteralString visitSimpleStringLiteral(SimpleStringLiteral node) => |
| 4184 js.escapedString(node.value, node.isSingleQuoted ? "'" : '"'); | 4184 js.escapedString(node.value, node.isSingleQuoted ? "'" : '"'); |
| 4185 | 4185 |
| 4186 @override | 4186 @override |
| 4187 JS.Expression visitAdjacentStrings(AdjacentStrings node) => | 4187 JS.Expression visitAdjacentStrings(AdjacentStrings node) => |
| 4188 _visitListToBinary(node.strings, '+'); | 4188 _visitListToBinary(node.strings, '+'); |
| 4189 | 4189 |
| 4190 @override | 4190 @override |
| 4191 JS.TemplateString visitStringInterpolation(StringInterpolation node) { | 4191 JS.Expression visitStringInterpolation(StringInterpolation node) { |
| 4192 // Assuming we implement toString() on our objects, we can avoid calling it | 4192 return new JS.TaggedTemplate( |
| 4193 // in most cases. Builtin types may differ though. We could handle this with | 4193 js.call('dart.str'), new JS.TemplateString(_visitList(node.elements))); |
| 4194 // a tagged template. | |
| 4195 return new JS.TemplateString(_visitList(node.elements)); | |
| 4196 } | 4194 } |
| 4197 | 4195 |
| 4198 @override | 4196 @override |
| 4199 String visitInterpolationString(InterpolationString node) { | 4197 String visitInterpolationString(InterpolationString node) { |
| 4200 // TODO(jmesserly): this call adds quotes, and then we strip them off. | 4198 // TODO(jmesserly): this call adds quotes, and then we strip them off. |
| 4201 var str = js.escapedString(node.value, '`').value; | 4199 var str = js.escapedString(node.value, '`').value; |
| 4202 return str.substring(1, str.length - 1); | 4200 return str.substring(1, str.length - 1); |
| 4203 } | 4201 } |
| 4204 | 4202 |
| 4205 @override | 4203 @override |
| (...skipping 288 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 4494 } | 4492 } |
| 4495 | 4493 |
| 4496 bool isLibraryPrefix(Expression node) => | 4494 bool isLibraryPrefix(Expression node) => |
| 4497 node is SimpleIdentifier && node.staticElement is PrefixElement; | 4495 node is SimpleIdentifier && node.staticElement is PrefixElement; |
| 4498 | 4496 |
| 4499 LibraryElement _getLibrary(AnalysisContext c, String uri) => | 4497 LibraryElement _getLibrary(AnalysisContext c, String uri) => |
| 4500 c.computeLibraryElement(c.sourceFactory.forUri(uri)); | 4498 c.computeLibraryElement(c.sourceFactory.forUri(uri)); |
| 4501 | 4499 |
| 4502 bool _isDartRuntime(LibraryElement l) => | 4500 bool _isDartRuntime(LibraryElement l) => |
| 4503 l.isInSdk && l.source.uri.toString() == 'dart:_runtime'; | 4501 l.isInSdk && l.source.uri.toString() == 'dart:_runtime'; |
| OLD | NEW |