| 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 5077 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 5088 | 5088 |
| 5089 @override | 5089 @override |
| 5090 visitNode(AstNode node) { | 5090 visitNode(AstNode node) { |
| 5091 // TODO(jmesserly): verify this is unreachable. | 5091 // TODO(jmesserly): verify this is unreachable. |
| 5092 throw 'Unimplemented ${node.runtimeType}: $node'; | 5092 throw 'Unimplemented ${node.runtimeType}: $node'; |
| 5093 } | 5093 } |
| 5094 | 5094 |
| 5095 _visit(AstNode node) { | 5095 _visit(AstNode node) { |
| 5096 if (node == null) return null; | 5096 if (node == null) return null; |
| 5097 var result = node.accept(this); | 5097 var result = node.accept(this); |
| 5098 if (result is JS.Node) result = annotate(result, node); | 5098 return result is JS.Node ? annotate(result, node) : result; |
| 5099 return result; | |
| 5100 } | 5099 } |
| 5101 | 5100 |
| 5102 List/*<T>*/ _visitList/*<T extends AstNode>*/(Iterable/*<T>*/ nodes) { | 5101 List/*<T>*/ _visitList/*<T extends AstNode>*/(Iterable/*<T>*/ nodes) { |
| 5103 if (nodes == null) return null; | 5102 if (nodes == null) return null; |
| 5104 var result = /*<T>*/ []; | 5103 var result = /*<T>*/ []; |
| 5105 for (var node in nodes) result.add(_visit(node) as dynamic/*=T*/); | 5104 for (var node in nodes) result.add(_visit(node) as dynamic/*=T*/); |
| 5106 return result; | 5105 return result; |
| 5107 } | 5106 } |
| 5108 | 5107 |
| 5109 /// Visits a list of expressions, creating a comma expression if needed in JS. | 5108 /// Visits a list of expressions, creating a comma expression if needed in JS. |
| (...skipping 342 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 5452 } | 5451 } |
| 5453 | 5452 |
| 5454 bool isLibraryPrefix(Expression node) => | 5453 bool isLibraryPrefix(Expression node) => |
| 5455 node is SimpleIdentifier && node.staticElement is PrefixElement; | 5454 node is SimpleIdentifier && node.staticElement is PrefixElement; |
| 5456 | 5455 |
| 5457 LibraryElement _getLibrary(AnalysisContext c, String uri) => | 5456 LibraryElement _getLibrary(AnalysisContext c, String uri) => |
| 5458 c.computeLibraryElement(c.sourceFactory.forUri(uri)); | 5457 c.computeLibraryElement(c.sourceFactory.forUri(uri)); |
| 5459 | 5458 |
| 5460 bool _isDartRuntime(LibraryElement l) => | 5459 bool _isDartRuntime(LibraryElement l) => |
| 5461 l.isInSdk && l.source.uri.toString() == 'dart:_runtime'; | 5460 l.isInSdk && l.source.uri.toString() == 'dart:_runtime'; |
| OLD | NEW |