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

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

Issue 2043783002: Resynthesize enums lazily. (Closed) Base URL: git@github.com:dart-lang/sdk.git@master
Patch Set: Created 4 years, 6 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/lib/src/summary/resynthesize.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 1305 matching lines...) Expand 10 before | Expand all | Expand 10 after
1316 1316
1317 /** 1317 /**
1318 * A list containing all of the top-level accessors (getters and setters) 1318 * A list containing all of the top-level accessors (getters and setters)
1319 * contained in this compilation unit. 1319 * contained in this compilation unit.
1320 */ 1320 */
1321 List<PropertyAccessorElement> _accessors; 1321 List<PropertyAccessorElement> _accessors;
1322 1322
1323 /** 1323 /**
1324 * A list containing all of the enums contained in this compilation unit. 1324 * A list containing all of the enums contained in this compilation unit.
1325 */ 1325 */
1326 List<ClassElement> _enums = ClassElement.EMPTY_LIST; 1326 List<ClassElement> _enums;
1327 1327
1328 /** 1328 /**
1329 * A list containing all of the top-level functions contained in this 1329 * A list containing all of the top-level functions contained in this
1330 * compilation unit. 1330 * compilation unit.
1331 */ 1331 */
1332 List<FunctionElement> _functions; 1332 List<FunctionElement> _functions;
1333 1333
1334 /** 1334 /**
1335 * A list containing all of the function type aliases contained in this 1335 * A list containing all of the function type aliases contained in this
1336 * compilation unit. 1336 * compilation unit.
(...skipping 106 matching lines...) Expand 10 before | Expand all | Expand 10 after
1443 @override 1443 @override
1444 LibraryElement get enclosingElement => 1444 LibraryElement get enclosingElement =>
1445 super.enclosingElement as LibraryElement; 1445 super.enclosingElement as LibraryElement;
1446 1446
1447 @override 1447 @override
1448 CompilationUnitElementImpl get enclosingUnit { 1448 CompilationUnitElementImpl get enclosingUnit {
1449 return this; 1449 return this;
1450 } 1450 }
1451 1451
1452 @override 1452 @override
1453 List<ClassElement> get enums => _enums; 1453 List<ClassElement> get enums {
1454 if (_unlinkedUnit != null) {
1455 _enums ??= _unlinkedUnit.enums
1456 .map((e) => new EnumElementImpl.forSerialized(e, this))
1457 .toList(growable: false);
1458 }
1459 return _enums ?? const <ClassElement>[];
1460 }
1454 1461
1455 /** 1462 /**
1456 * Set the enums contained in this compilation unit to the given [enums]. 1463 * Set the enums contained in this compilation unit to the given [enums].
1457 */ 1464 */
1458 void set enums(List<ClassElement> enums) { 1465 void set enums(List<ClassElement> enums) {
1466 assert(_unlinkedUnit == null);
1459 for (ClassElement enumDeclaration in enums) { 1467 for (ClassElement enumDeclaration in enums) {
1460 (enumDeclaration as EnumElementImpl).enclosingElement = this; 1468 (enumDeclaration as EnumElementImpl).enclosingElement = this;
1461 } 1469 }
1462 this._enums = enums; 1470 this._enums = enums;
1463 } 1471 }
1464 1472
1465 @override 1473 @override
1466 List<FunctionElement> get functions { 1474 List<FunctionElement> get functions {
1467 if (_unlinkedUnit != null) { 1475 if (_unlinkedUnit != null) {
1468 _functions ??= _unlinkedUnit.executables 1476 _functions ??= _unlinkedUnit.executables
(...skipping 6971 matching lines...) Expand 10 before | Expand all | Expand 10 after
8440 8448
8441 @override 8449 @override
8442 void visitElement(Element element) { 8450 void visitElement(Element element) {
8443 int offset = element.nameOffset; 8451 int offset = element.nameOffset;
8444 if (offset != -1) { 8452 if (offset != -1) {
8445 map[offset] = element; 8453 map[offset] = element;
8446 } 8454 }
8447 super.visitElement(element); 8455 super.visitElement(element);
8448 } 8456 }
8449 } 8457 }
OLDNEW
« no previous file with comments | « no previous file | pkg/analyzer/lib/src/summary/resynthesize.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698