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

Side by Side Diff: pkg/analyzer/lib/src/generated/element_resolver.dart

Issue 2199323002: Initial implementation for lazy compound assignment operators (Closed) Base URL: https://github.com/dart-lang/sdk.git@master
Patch Set: Created 4 years, 4 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
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.generated.element_resolver; 5 library analyzer.src.generated.element_resolver;
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 138 matching lines...) Expand 10 before | Expand all | Expand 10 after
149 if (function is ConstructorElement) { 149 if (function is ConstructorElement) {
150 return function.isConst; 150 return function.isConst;
151 } 151 }
152 return false; 152 return false;
153 } 153 }
154 154
155 @override 155 @override
156 Object visitAssignmentExpression(AssignmentExpression node) { 156 Object visitAssignmentExpression(AssignmentExpression node) {
157 Token operator = node.operator; 157 Token operator = node.operator;
158 TokenType operatorType = operator.type; 158 TokenType operatorType = operator.type;
159 if (operatorType != TokenType.EQ && 159 if (operatorType != TokenType.AMPERSAND_AMPERSAND_EQ &&
160 operatorType != TokenType.BAR_BAR_EQ &&
scheglov 2016/08/02 15:25:03 Should we resolve &&= and ||= to corresponding & a
scheglov 2016/08/02 15:33:22 Actually, never-mind. Operators && and || are not
161 operatorType != TokenType.EQ &&
160 operatorType != TokenType.QUESTION_QUESTION_EQ) { 162 operatorType != TokenType.QUESTION_QUESTION_EQ) {
161 operatorType = _operatorFromCompoundAssignment(operatorType); 163 operatorType = _operatorFromCompoundAssignment(operatorType);
162 Expression leftHandSide = node.leftHandSide; 164 Expression leftHandSide = node.leftHandSide;
163 if (leftHandSide != null) { 165 if (leftHandSide != null) {
164 String methodName = operatorType.lexeme; 166 String methodName = operatorType.lexeme;
165 DartType staticType = _getStaticType(leftHandSide); 167 DartType staticType = _getStaticType(leftHandSide);
166 MethodElement staticMethod = 168 MethodElement staticMethod =
167 _lookUpMethod(leftHandSide, staticType, methodName); 169 _lookUpMethod(leftHandSide, staticType, methodName);
168 node.staticElement = staticMethod; 170 node.staticElement = staticMethod;
169 DartType propagatedType = _getPropagatedType(leftHandSide); 171 DartType propagatedType = _getPropagatedType(leftHandSide);
(...skipping 2420 matching lines...) Expand 10 before | Expand all | Expand 10 after
2590 2592
2591 @override 2593 @override
2592 Element get staticElement => null; 2594 Element get staticElement => null;
2593 2595
2594 @override 2596 @override
2595 dynamic/*=E*/ accept/*<E>*/(AstVisitor/*<E>*/ visitor) => null; 2597 dynamic/*=E*/ accept/*<E>*/(AstVisitor/*<E>*/ visitor) => null;
2596 2598
2597 @override 2599 @override
2598 void visitChildren(AstVisitor visitor) {} 2600 void visitChildren(AstVisitor visitor) {}
2599 } 2601 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698