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

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

Issue 2014713002: Create lazy (Const)FieldElementImpl. (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 1516 matching lines...) Expand 10 before | Expand all | Expand 10 after
1527 /** 1527 /**
1528 * Initialize a newly created synthetic field element to have the given 1528 * Initialize a newly created synthetic field element to have the given
1529 * [name] and [offset]. 1529 * [name] and [offset].
1530 */ 1530 */
1531 ConstFieldElementImpl(String name, int offset) : super(name, offset); 1531 ConstFieldElementImpl(String name, int offset) : super(name, offset);
1532 1532
1533 /** 1533 /**
1534 * Initialize a newly created field element to have the given [name]. 1534 * Initialize a newly created field element to have the given [name].
1535 */ 1535 */
1536 ConstFieldElementImpl.forNode(Identifier name) : super.forNode(name); 1536 ConstFieldElementImpl.forNode(Identifier name) : super.forNode(name);
1537
1538 /**
1539 * Initialize using the given serialized information.
1540 */
1541 ConstFieldElementImpl.forSerialized(
1542 UnlinkedVariable unlinkedVariable, ElementImpl enclosingElement)
1543 : super.forSerialized(unlinkedVariable, enclosingElement);
1537 } 1544 }
1538 1545
1539 /** 1546 /**
1540 * A [LocalVariableElement] for a local 'const' variable that has an 1547 * A [LocalVariableElement] for a local 'const' variable that has an
1541 * initializer. 1548 * initializer.
1542 */ 1549 */
1543 class ConstLocalVariableElementImpl extends LocalVariableElementImpl 1550 class ConstLocalVariableElementImpl extends LocalVariableElementImpl
1544 with ConstVariableElement { 1551 with ConstVariableElement {
1545 /** 1552 /**
1546 * Initialize a newly created local variable element to have the given [name] 1553 * Initialize a newly created local variable element to have the given [name]
(...skipping 1731 matching lines...) Expand 10 before | Expand all | Expand 10 after
3278 * Initialize a newly created synthetic field element to have the given [name] 3285 * Initialize a newly created synthetic field element to have the given [name]
3279 * at the given [offset]. 3286 * at the given [offset].
3280 */ 3287 */
3281 FieldElementImpl(String name, int offset) : super(name, offset); 3288 FieldElementImpl(String name, int offset) : super(name, offset);
3282 3289
3283 /** 3290 /**
3284 * Initialize a newly created field element to have the given [name]. 3291 * Initialize a newly created field element to have the given [name].
3285 */ 3292 */
3286 FieldElementImpl.forNode(Identifier name) : super.forNode(name); 3293 FieldElementImpl.forNode(Identifier name) : super.forNode(name);
3287 3294
3295 /**
3296 * Initialize using the given serialized information.
3297 */
3298 FieldElementImpl.forSerialized(
3299 UnlinkedVariable unlinkedVariable, ElementImpl enclosingElement)
3300 : super.forSerialized(unlinkedVariable, enclosingElement);
3301
3288 @override 3302 @override
3289 ClassElement get enclosingElement => super.enclosingElement as ClassElement; 3303 ClassElement get enclosingElement => super.enclosingElement as ClassElement;
3290 3304
3291 @override 3305 @override
3292 bool get isEnumConstant => 3306 bool get isEnumConstant =>
3293 enclosingElement != null ? enclosingElement.isEnum : false; 3307 enclosingElement != null ? enclosingElement.isEnum : false;
3294 3308
3295 @override 3309 @override
3296 ElementKind get kind => ElementKind.FIELD; 3310 ElementKind get kind => ElementKind.FIELD;
3297 3311
(...skipping 3610 matching lines...) Expand 10 before | Expand all | Expand 10 after
6908 6922
6909 @override 6923 @override
6910 void visitElement(Element element) { 6924 void visitElement(Element element) {
6911 int offset = element.nameOffset; 6925 int offset = element.nameOffset;
6912 if (offset != -1) { 6926 if (offset != -1) {
6913 map[offset] = element; 6927 map[offset] = element;
6914 } 6928 }
6915 super.visitElement(element); 6929 super.visitElement(element);
6916 } 6930 }
6917 } 6931 }
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