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

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

Issue 2651683004: Fix resynthesizing field of FieldFormalParameterElement. (Closed)
Patch Set: Created 3 years, 10 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 | « no previous file | pkg/analyzer/test/generated/compile_time_error_code_driver_test.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.element.element; 5 library analyzer.src.dart.element.element;
6 6
7 import 'dart:collection'; 7 import 'dart:collection';
8 import 'dart:math' show min; 8 import 'dart:math' show min;
9 9
10 import 'package:analyzer/dart/ast/ast.dart'; 10 import 'package:analyzer/dart/ast/ast.dart';
(...skipping 4299 matching lines...) Expand 10 before | Expand all | Expand 10 after
4310 /** 4310 /**
4311 * Initialize using the given serialized information. 4311 * Initialize using the given serialized information.
4312 */ 4312 */
4313 FieldFormalParameterElementImpl.forSerialized( 4313 FieldFormalParameterElementImpl.forSerialized(
4314 UnlinkedParam unlinkedParam, ElementImpl enclosingElement) 4314 UnlinkedParam unlinkedParam, ElementImpl enclosingElement)
4315 : super.forSerialized(unlinkedParam, enclosingElement); 4315 : super.forSerialized(unlinkedParam, enclosingElement);
4316 4316
4317 @override 4317 @override
4318 FieldElement get field { 4318 FieldElement get field {
4319 if (_unlinkedParam != null && _field == null) { 4319 if (_unlinkedParam != null && _field == null) {
4320 Element enclosingClass = enclosingElement?.enclosingElement; 4320 Element enclosing = enclosingElement?.enclosingElement;
4321 if (enclosingClass is ClassElement) { 4321 while (enclosing != null) {
4322 _field = enclosingClass.getField(_unlinkedParam.name); 4322 if (enclosing is ClassElement) {
4323 _field = enclosing.getField(_unlinkedParam.name);
4324 break;
4325 } else {
4326 enclosing = enclosing.enclosingElement;
4327 }
4323 } 4328 }
4324 } 4329 }
4325 return _field; 4330 return _field;
4326 } 4331 }
4327 4332
4328 void set field(FieldElement field) { 4333 void set field(FieldElement field) {
4329 _assertNotResynthesized(_unlinkedParam); 4334 _assertNotResynthesized(_unlinkedParam);
4330 _field = field; 4335 _field = field;
4331 } 4336 }
4332 4337
(...skipping 4267 matching lines...) Expand 10 before | Expand all | Expand 10 after
8600 8605
8601 @override 8606 @override
8602 void visitElement(Element element) { 8607 void visitElement(Element element) {
8603 int offset = element.nameOffset; 8608 int offset = element.nameOffset;
8604 if (offset != -1) { 8609 if (offset != -1) {
8605 map[offset] = element; 8610 map[offset] = element;
8606 } 8611 }
8607 super.visitElement(element); 8612 super.visitElement(element);
8608 } 8613 }
8609 } 8614 }
OLDNEW
« no previous file with comments | « no previous file | pkg/analyzer/test/generated/compile_time_error_code_driver_test.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698