Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(194)

Side by Side Diff: pkg/analyzer/lib/src/dart/ast/ast.dart

Issue 1918923003: Remove unnecessary casts and general code clean-up (Closed) Base URL: https://github.com/dart-lang/sdk.git@master
Patch Set: clean-up Created 4 years, 8 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
« no previous file with comments | « pkg/analyzer/lib/src/context/context.dart ('k') | pkg/analyzer/lib/src/dart/ast/utilities.dart » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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 754 matching lines...) Expand 10 before | Expand all | Expand 10 after
765 ExecutableElement executableElement = null; 765 ExecutableElement executableElement = null;
766 if (propagatedElement != null) { 766 if (propagatedElement != null) {
767 executableElement = propagatedElement; 767 executableElement = propagatedElement;
768 } else { 768 } else {
769 if (_leftHandSide is Identifier) { 769 if (_leftHandSide is Identifier) {
770 Identifier identifier = _leftHandSide as Identifier; 770 Identifier identifier = _leftHandSide as Identifier;
771 Element leftElement = identifier.propagatedElement; 771 Element leftElement = identifier.propagatedElement;
772 if (leftElement is ExecutableElement) { 772 if (leftElement is ExecutableElement) {
773 executableElement = leftElement; 773 executableElement = leftElement;
774 } 774 }
775 } 775 } else if (_leftHandSide is PropertyAccess) {
776 if (_leftHandSide is PropertyAccess) {
777 SimpleIdentifier identifier = 776 SimpleIdentifier identifier =
778 (_leftHandSide as PropertyAccess).propertyName; 777 (_leftHandSide as PropertyAccess).propertyName;
779 Element leftElement = identifier.propagatedElement; 778 Element leftElement = identifier.propagatedElement;
780 if (leftElement is ExecutableElement) { 779 if (leftElement is ExecutableElement) {
781 executableElement = leftElement; 780 executableElement = leftElement;
782 } 781 }
783 } 782 }
784 } 783 }
785 if (executableElement == null) { 784 if (executableElement == null) {
786 return null; 785 return null;
(...skipping 14 matching lines...) Expand all
801 ParameterElement get _staticParameterElementForRightHandSide { 800 ParameterElement get _staticParameterElementForRightHandSide {
802 ExecutableElement executableElement = null; 801 ExecutableElement executableElement = null;
803 if (staticElement != null) { 802 if (staticElement != null) {
804 executableElement = staticElement; 803 executableElement = staticElement;
805 } else { 804 } else {
806 if (_leftHandSide is Identifier) { 805 if (_leftHandSide is Identifier) {
807 Element leftElement = (_leftHandSide as Identifier).staticElement; 806 Element leftElement = (_leftHandSide as Identifier).staticElement;
808 if (leftElement is ExecutableElement) { 807 if (leftElement is ExecutableElement) {
809 executableElement = leftElement; 808 executableElement = leftElement;
810 } 809 }
811 } 810 } else if (_leftHandSide is PropertyAccess) {
812 if (_leftHandSide is PropertyAccess) {
813 Element leftElement = 811 Element leftElement =
814 (_leftHandSide as PropertyAccess).propertyName.staticElement; 812 (_leftHandSide as PropertyAccess).propertyName.staticElement;
815 if (leftElement is ExecutableElement) { 813 if (leftElement is ExecutableElement) {
816 executableElement = leftElement; 814 executableElement = leftElement;
817 } 815 }
818 } 816 }
819 } 817 }
820 if (executableElement == null) { 818 if (executableElement == null) {
821 return null; 819 return null;
822 } 820 }
(...skipping 8084 matching lines...) Expand 10 before | Expand all | Expand 10 after
8907 Iterable get childEntities => new ChildEntities()..add(token); 8905 Iterable get childEntities => new ChildEntities()..add(token);
8908 8906
8909 @override 8907 @override
8910 Token get endToken => token; 8908 Token get endToken => token;
8911 8909
8912 @override 8910 @override
8913 bool get isQualified { 8911 bool get isQualified {
8914 AstNode parent = this.parent; 8912 AstNode parent = this.parent;
8915 if (parent is PrefixedIdentifier) { 8913 if (parent is PrefixedIdentifier) {
8916 return identical(parent.identifier, this); 8914 return identical(parent.identifier, this);
8917 } 8915 } else if (parent is PropertyAccess) {
8918 if (parent is PropertyAccess) {
8919 return identical(parent.propertyName, this); 8916 return identical(parent.propertyName, this);
8920 } 8917 } else if (parent is MethodInvocation) {
8921 if (parent is MethodInvocation) {
8922 MethodInvocation invocation = parent; 8918 MethodInvocation invocation = parent;
8923 return identical(invocation.methodName, this) && 8919 return identical(invocation.methodName, this) &&
8924 invocation.realTarget != null; 8920 invocation.realTarget != null;
8925 } 8921 }
8926 return false; 8922 return false;
8927 } 8923 }
8928 8924
8929 @override 8925 @override
8930 bool get isSynthetic => token.isSynthetic; 8926 bool get isSynthetic => token.isSynthetic;
8931 8927
(...skipping 1624 matching lines...) Expand 10 before | Expand all | Expand 10 after
10556 : super(null, null) { 10552 : super(null, null) {
10557 _name = _becomeParentOf(name); 10553 _name = _becomeParentOf(name);
10558 _initializer = _becomeParentOf(initializer); 10554 _initializer = _becomeParentOf(initializer);
10559 } 10555 }
10560 10556
10561 @override 10557 @override
10562 Iterable get childEntities => 10558 Iterable get childEntities =>
10563 super._childEntities..add(_name)..add(equals)..add(_initializer); 10559 super._childEntities..add(_name)..add(equals)..add(_initializer);
10564 10560
10565 /** 10561 /**
10566 * This overridden implementation of getDocumentationComment() looks in the 10562 * This overridden implementation of [documentationComment] looks in the
10567 * grandparent node for Dartdoc comments if no documentation is specifically 10563 * grandparent node for Dartdoc comments if no documentation is specifically
10568 * available on the node. 10564 * available on the node.
10569 */ 10565 */
10570 @override 10566 @override
10571 Comment get documentationComment { 10567 Comment get documentationComment {
10572 Comment comment = super.documentationComment; 10568 Comment comment = super.documentationComment;
10573 if (comment == null) { 10569 if (comment == null) {
10574 if (parent != null && parent.parent != null) { 10570 AstNode node = parent?.parent;
10575 AstNode node = parent.parent; 10571 if (node is AnnotatedNode) {
10576 if (node is AnnotatedNode) { 10572 return node.documentationComment;
10577 return node.documentationComment;
10578 }
10579 } 10573 }
10580 } 10574 }
10581 return comment; 10575 return comment;
10582 } 10576 }
10583 10577
10584 @override 10578 @override
10585 VariableElement get element => 10579 VariableElement get element =>
10586 _name != null ? (_name.staticElement as VariableElement) : null; 10580 _name != null ? (_name.staticElement as VariableElement) : null;
10587 10581
10588 @override 10582 @override
(...skipping 394 matching lines...) Expand 10 before | Expand all | Expand 10 after
10983 10977
10984 @override 10978 @override
10985 dynamic/*=E*/ accept/*<E>*/(AstVisitor/*<E>*/ visitor) => 10979 dynamic/*=E*/ accept/*<E>*/(AstVisitor/*<E>*/ visitor) =>
10986 visitor.visitYieldStatement(this); 10980 visitor.visitYieldStatement(this);
10987 10981
10988 @override 10982 @override
10989 void visitChildren(AstVisitor visitor) { 10983 void visitChildren(AstVisitor visitor) {
10990 _expression?.accept(visitor); 10984 _expression?.accept(visitor);
10991 } 10985 }
10992 } 10986 }
OLDNEW
« no previous file with comments | « pkg/analyzer/lib/src/context/context.dart ('k') | pkg/analyzer/lib/src/dart/ast/utilities.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698