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

Side by Side Diff: pkg/compiler/lib/src/elements/names.dart

Issue 2860753005: Make elements/names.dart its own library (Closed)
Patch Set: Created 3 years, 7 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 | « pkg/compiler/lib/src/elements/modelx.dart ('k') | pkg/compiler/lib/src/elements/operators.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 part of elements; 5 library dart2js.elements.names;
6
7 import 'package:front_end/src/fasta/scanner/characters.dart' show $_;
8 import 'entities.dart' show LibraryEntity;
6 9
7 /// A [Name] represents the abstraction of a Dart identifier which takes privacy 10 /// A [Name] represents the abstraction of a Dart identifier which takes privacy
8 /// and setter into account. 11 /// and setter into account.
9 // TODO(johnniwinther): Try to share logic with [Selector]. 12 // TODO(johnniwinther): Try to share logic with [Selector].
10 abstract class Name { 13 abstract class Name {
11 /// Create a [Name] for an identifier [text]. If [text] begins with '_' a 14 /// Create a [Name] for an identifier [text]. If [text] begins with '_' a
12 /// private name with respect to [library] is created. If [isSetter] is `true` 15 /// private name with respect to [library] is created. If [isSetter] is `true`
13 /// the created name represents the setter name 'text='. 16 /// the created name represents the setter name 'text='.
14 factory Name(String text, LibraryEntity library, {bool isSetter: false}) { 17 factory Name(String text, LibraryEntity library, {bool isSetter: false}) {
15 if (isPrivateName(text)) { 18 if (isPrivateName(text)) {
(...skipping 75 matching lines...) Expand 10 before | Expand all | Expand 10 after
91 94
92 PrivateName(String text, this.library, {bool isSetter: false}) 95 PrivateName(String text, this.library, {bool isSetter: false})
93 : super(text, isSetter: isSetter); 96 : super(text, isSetter: isSetter);
94 97
95 Name get getter => isSetter ? new PrivateName(text, library) : this; 98 Name get getter => isSetter ? new PrivateName(text, library) : this;
96 99
97 Name get setter { 100 Name get setter {
98 return isSetter ? this : new PrivateName(text, library, isSetter: true); 101 return isSetter ? this : new PrivateName(text, library, isSetter: true);
99 } 102 }
100 103
101 bool isAccessibleFrom(LibraryElement element) => library == element; 104 bool isAccessibleFrom(LibraryEntity element) => library == element;
102 105
103 bool get isPrivate => true; 106 bool get isPrivate => true;
104 107
105 int get hashCode => super.hashCode + 13 * library.hashCode; 108 int get hashCode => super.hashCode + 13 * library.hashCode;
106 109
107 bool operator ==(other) { 110 bool operator ==(other) {
108 if (other is! PrivateName) return false; 111 if (other is! PrivateName) return false;
109 return super == (other) && library == other.library; 112 return super == (other) && library == other.library;
110 } 113 }
111 114
112 String toString() => '${library.name}#${super.toString()}'; 115 String toString() => '${library.name}#${super.toString()}';
113 } 116 }
OLDNEW
« no previous file with comments | « pkg/compiler/lib/src/elements/modelx.dart ('k') | pkg/compiler/lib/src/elements/operators.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698