| 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 2477 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2488 context.accept(visitor); | 2488 context.accept(visitor); |
| 2489 return visitor._potentiallyMutated; | 2489 return visitor._potentiallyMutated; |
| 2490 } | 2490 } |
| 2491 return true; | 2491 return true; |
| 2492 } | 2492 } |
| 2493 return false; | 2493 return false; |
| 2494 } | 2494 } |
| 2495 | 2495 |
| 2496 /// Adapted from VariableResolverVisitor. Finds an assignment to a given | 2496 /// Adapted from VariableResolverVisitor. Finds an assignment to a given |
| 2497 /// local variable. | 2497 /// local variable. |
| 2498 // TODO(jmesserly): change type annotation to not be *Impl once | |
| 2499 // isPotentiallyMutated is available on VariableElement. | |
| 2500 class _AssignmentFinder extends RecursiveAstVisitor { | 2498 class _AssignmentFinder extends RecursiveAstVisitor { |
| 2501 final VariableElement _variable; | 2499 final VariableElement _variable; |
| 2502 bool _potentiallyMutated = false; | 2500 bool _potentiallyMutated = false; |
| 2503 | 2501 |
| 2504 _AssignmentFinder(this._variable); | 2502 _AssignmentFinder(this._variable); |
| 2505 | 2503 |
| 2506 @override | 2504 @override |
| 2507 visitSimpleIdentifier(SimpleIdentifier node) { | 2505 visitSimpleIdentifier(SimpleIdentifier node) { |
| 2508 // Ignore if qualified. | 2506 // Ignore if qualified. |
| 2509 AstNode parent = node.parent; | 2507 AstNode parent = node.parent; |
| (...skipping 12 matching lines...) Expand all Loading... |
| 2522 } | 2520 } |
| 2523 } | 2521 } |
| 2524 | 2522 |
| 2525 // TODO(jmesserly): validate the library. See issue #135. | 2523 // TODO(jmesserly): validate the library. See issue #135. |
| 2526 bool _isJsNameAnnotation(DartObjectImpl value) => value.type.name == 'JsName'; | 2524 bool _isJsNameAnnotation(DartObjectImpl value) => value.type.name == 'JsName'; |
| 2527 | 2525 |
| 2528 // TODO(jacobr): we would like to do something like the following | 2526 // TODO(jacobr): we would like to do something like the following |
| 2529 // but we don't have summary support yet. | 2527 // but we don't have summary support yet. |
| 2530 // bool _supportJsExtensionMethod(AnnotatedNode node) => | 2528 // bool _supportJsExtensionMethod(AnnotatedNode node) => |
| 2531 // _getAnnotation(node, "SupportJsExtensionMethod") != null; | 2529 // _getAnnotation(node, "SupportJsExtensionMethod") != null; |
| OLD | NEW |