| OLD | NEW |
| 1 // Copyright (c) 2014, the Dart project authors. Please see the AUTHORS file | 1 // Copyright (c) 2014, 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 analyzer.src.dart.ast.ast; | 5 library analyzer.src.dart.ast.ast; |
| 6 | 6 |
| 7 import 'dart:collection'; | 7 import 'dart:collection'; |
| 8 | 8 |
| 9 import 'package:analyzer/dart/ast/ast.dart'; | 9 import 'package:analyzer/dart/ast/ast.dart'; |
| 10 import 'package:analyzer/dart/ast/token.dart'; | 10 import 'package:analyzer/dart/ast/token.dart'; |
| (...skipping 877 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 888 AstNode root = this; | 888 AstNode root = this; |
| 889 AstNode parent = this.parent; | 889 AstNode parent = this.parent; |
| 890 while (parent != null) { | 890 while (parent != null) { |
| 891 root = parent; | 891 root = parent; |
| 892 parent = root.parent; | 892 parent = root.parent; |
| 893 } | 893 } |
| 894 return root; | 894 return root; |
| 895 } | 895 } |
| 896 | 896 |
| 897 @override | 897 @override |
| 898 AstNode getAncestor(Predicate<AstNode> predicate) { | 898 AstNode/*=E*/ getAncestor/*<E extends AstNode>*/( |
| 899 Predicate<AstNode> predicate) { |
| 899 // TODO(brianwilkerson) It is a bug that this method can return `this`. | 900 // TODO(brianwilkerson) It is a bug that this method can return `this`. |
| 900 AstNode node = this; | 901 AstNode node = this; |
| 901 while (node != null && !predicate(node)) { | 902 while (node != null && !predicate(node)) { |
| 902 node = node.parent; | 903 node = node.parent; |
| 903 } | 904 } |
| 904 return node; | 905 return node as AstNode/*=E*/; |
| 905 } | 906 } |
| 906 | 907 |
| 907 @override | 908 @override |
| 908 Object getProperty(String name) { | 909 Object/*=E*/ getProperty/*<E>*/(String name) { |
| 909 if (_propertyMap == null) { | 910 if (_propertyMap == null) { |
| 910 return null; | 911 return null; |
| 911 } | 912 } |
| 912 return _propertyMap[name]; | 913 return _propertyMap[name] as Object/*=E*/; |
| 913 } | 914 } |
| 914 | 915 |
| 915 @override | 916 @override |
| 916 void setProperty(String name, Object value) { | 917 void setProperty(String name, Object value) { |
| 917 if (value == null) { | 918 if (value == null) { |
| 918 if (_propertyMap != null) { | 919 if (_propertyMap != null) { |
| 919 _propertyMap.remove(name); | 920 _propertyMap.remove(name); |
| 920 if (_propertyMap.isEmpty) { | 921 if (_propertyMap.isEmpty) { |
| 921 _propertyMap = null; | 922 _propertyMap = null; |
| 922 } | 923 } |
| (...skipping 10109 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 11032 | 11033 |
| 11033 @override | 11034 @override |
| 11034 dynamic/*=E*/ accept/*<E>*/(AstVisitor/*<E>*/ visitor) => | 11035 dynamic/*=E*/ accept/*<E>*/(AstVisitor/*<E>*/ visitor) => |
| 11035 visitor.visitYieldStatement(this); | 11036 visitor.visitYieldStatement(this); |
| 11036 | 11037 |
| 11037 @override | 11038 @override |
| 11038 void visitChildren(AstVisitor visitor) { | 11039 void visitChildren(AstVisitor visitor) { |
| 11039 _expression?.accept(visitor); | 11040 _expression?.accept(visitor); |
| 11040 } | 11041 } |
| 11041 } | 11042 } |
| OLD | NEW |