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

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

Issue 1712583003: Serialize and resynthesize labels. (Closed) Base URL: git@github.com:dart-lang/sdk.git@master
Patch Set: Created 4 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
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 2912 matching lines...) Expand 10 before | Expand all | Expand 10 after
2923 */ 2923 */
2924 // TODO(brianwilkerson) Make this a modifier. 2924 // TODO(brianwilkerson) Make this a modifier.
2925 final bool _onSwitchMember; 2925 final bool _onSwitchMember;
2926 2926
2927 /** 2927 /**
2928 * Initialize a newly created label element to have the given [name]. 2928 * Initialize a newly created label element to have the given [name].
2929 * [onSwitchStatement] should be `true` if this label is associated with a 2929 * [onSwitchStatement] should be `true` if this label is associated with a
2930 * `switch` statement and [onSwitchMember] should be `true` if this label is 2930 * `switch` statement and [onSwitchMember] should be `true` if this label is
2931 * associated with a `switch` member. 2931 * associated with a `switch` member.
2932 */ 2932 */
2933 LabelElementImpl( 2933 LabelElementImpl(String name, int nameOffset, this._onSwitchStatement,
2934 this._onSwitchMember)
2935 : super(name, nameOffset);
2936
2937 /**
2938 * Initialize a newly created label element to have the given [name].
2939 * [onSwitchStatement] should be `true` if this label is associated with a
2940 * `switch` statement and [onSwitchMember] should be `true` if this label is
2941 * associated with a `switch` member.
2942 */
2943 LabelElementImpl.forNode(
2934 Identifier name, this._onSwitchStatement, this._onSwitchMember) 2944 Identifier name, this._onSwitchStatement, this._onSwitchMember)
2935 : super.forNode(name); 2945 : super.forNode(name);
2936 2946
2937 @override 2947 @override
2938 ExecutableElement get enclosingElement => 2948 ExecutableElement get enclosingElement =>
2939 super.enclosingElement as ExecutableElement; 2949 super.enclosingElement as ExecutableElement;
2940 2950
2941 /** 2951 /**
2942 * Return `true` if this label is associated with a `switch` member (`case` or 2952 * Return `true` if this label is associated with a `switch` member (`case` or
2943 * `default`). 2953 * `default`).
(...skipping 1596 matching lines...) Expand 10 before | Expand all | Expand 10 after
4540 */ 4550 */
4541 DartType bound; 4551 DartType bound;
4542 4552
4543 /** 4553 /**
4544 * Initialize a newly created method element to have the given [name] and 4554 * Initialize a newly created method element to have the given [name] and
4545 * [offset]. 4555 * [offset].
4546 */ 4556 */
4547 TypeParameterElementImpl(String name, int offset) : super(name, offset); 4557 TypeParameterElementImpl(String name, int offset) : super(name, offset);
4548 4558
4549 /** 4559 /**
4560 * Initialize a newly created type parameter element to have the given [name].
4561 */
4562 TypeParameterElementImpl.forNode(Identifier name) : super.forNode(name);
4563
4564 /**
4550 * Initialize a newly created synthetic type parameter element to have the 4565 * Initialize a newly created synthetic type parameter element to have the
4551 * given [name], and with [synthetic] set to true. 4566 * given [name], and with [synthetic] set to true.
4552 */ 4567 */
4553 TypeParameterElementImpl.synthetic(String name) : super(name, -1) { 4568 TypeParameterElementImpl.synthetic(String name) : super(name, -1) {
4554 synthetic = true; 4569 synthetic = true;
4555 } 4570 }
4556 4571
4557 /**
4558 * Initialize a newly created type parameter element to have the given [name].
4559 */
4560 TypeParameterElementImpl.forNode(Identifier name) : super.forNode(name);
4561
4562 @override 4572 @override
4563 ElementKind get kind => ElementKind.TYPE_PARAMETER; 4573 ElementKind get kind => ElementKind.TYPE_PARAMETER;
4564 4574
4565 @override 4575 @override
4566 accept(ElementVisitor visitor) => visitor.visitTypeParameterElement(this); 4576 accept(ElementVisitor visitor) => visitor.visitTypeParameterElement(this);
4567 4577
4568 @override 4578 @override
4569 void appendTo(StringBuffer buffer) { 4579 void appendTo(StringBuffer buffer) {
4570 buffer.write(displayName); 4580 buffer.write(displayName);
4571 if (bound != null) { 4581 if (bound != null) {
(...skipping 166 matching lines...) Expand 10 before | Expand all | Expand 10 after
4738 4748
4739 @override 4749 @override
4740 void visitElement(Element element) { 4750 void visitElement(Element element) {
4741 int offset = element.nameOffset; 4751 int offset = element.nameOffset;
4742 if (offset != -1) { 4752 if (offset != -1) {
4743 map[offset] = element; 4753 map[offset] = element;
4744 } 4754 }
4745 super.visitElement(element); 4755 super.visitElement(element);
4746 } 4756 }
4747 } 4757 }
OLDNEW
« no previous file with comments | « pkg/analyzer/lib/src/dart/element/builder.dart ('k') | pkg/analyzer/lib/src/summary/format.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698