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

Side by Side Diff: lib/compiler/implementation/elements/elements.dart

Issue 10701091: Dartdoc and Apidoc updated to use dart2js through the mirror system. (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: Fixed cf. rnystrom's comments. Created 8 years, 5 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 | Annotate | Revision Log
OLDNEW
1 // Copyright (c) 2012, the Dart project authors. Please see the AUTHORS file 1 // Copyright (c) 2012, 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('elements'); 5 #library('elements');
6 6
7 #import('../tree/tree.dart'); 7 #import('../tree/tree.dart');
8 #import('../scanner/scannerlib.dart'); 8 #import('../scanner/scannerlib.dart');
9 #import('../leg.dart'); // TODO(karlklose): we only need type. 9 #import('../leg.dart'); // TODO(karlklose): we only need type.
10 #import('../util/util.dart'); 10 #import('../util/util.dart');
(...skipping 127 matching lines...) Expand 10 before | Expand all | Expand 10 after
138 bool isTypedef() => kind === ElementKind.TYPEDEF; 138 bool isTypedef() => kind === ElementKind.TYPEDEF;
139 bool isTypeVariable() => kind === ElementKind.TYPE_VARIABLE; 139 bool isTypeVariable() => kind === ElementKind.TYPE_VARIABLE;
140 bool isField() => kind === ElementKind.FIELD; 140 bool isField() => kind === ElementKind.FIELD;
141 bool isGetter() => kind === ElementKind.GETTER; 141 bool isGetter() => kind === ElementKind.GETTER;
142 bool isSetter() => kind === ElementKind.SETTER; 142 bool isSetter() => kind === ElementKind.SETTER;
143 bool isAccessor() => isGetter() || isSetter(); 143 bool isAccessor() => isGetter() || isSetter();
144 bool isForeign() => kind === ElementKind.FOREIGN; 144 bool isForeign() => kind === ElementKind.FOREIGN;
145 bool impliesType() => (kind.category & ElementCategory.IMPLIES_TYPE) != 0; 145 bool impliesType() => (kind.category & ElementCategory.IMPLIES_TYPE) != 0;
146 bool isExtendable() => (kind.category & ElementCategory.IS_EXTENDABLE) != 0; 146 bool isExtendable() => (kind.category & ElementCategory.IS_EXTENDABLE) != 0;
147 147
148 // TODO(johnniwinther): This breaks for libraries (for which enclosing
149 // elements are null) and is invalid for top level variable declarations for
150 // which the enclosing element is a VariableDeclarations and not a compilation
151 // unit.
148 bool isTopLevel() => enclosingElement.isCompilationUnit(); 152 bool isTopLevel() => enclosingElement.isCompilationUnit();
149 153
150 bool isAssignable() { 154 bool isAssignable() {
151 if (modifiers != null && modifiers.isFinal()) return false; 155 if (modifiers != null && modifiers.isFinal()) return false;
152 if (isFunction() || isGenerativeConstructor()) return false; 156 if (isFunction() || isGenerativeConstructor()) return false;
153 return true; 157 return true;
154 } 158 }
155 159
156 Token position() => null; 160 Token position() => null;
157 161
(...skipping 48 matching lines...) Expand 10 before | Expand all | Expand 10 after
206 if (e.isMember() || e.isTopLevel()) { 210 if (e.isMember() || e.isTopLevel()) {
207 return e; 211 return e;
208 } 212 }
209 } 213 }
210 return null; 214 return null;
211 } 215 }
212 216
213 String toString() { 217 String toString() {
214 // TODO(johnniwinther): Test for nullness of name, or make non-nullness an 218 // TODO(johnniwinther): Test for nullness of name, or make non-nullness an
215 // invariant for all element types. 219 // invariant for all element types.
216 if (!isTopLevel()) { 220 if (enclosingElement !== null && !isTopLevel()) {
217 String holderName = enclosingElement.name.slowToString(); 221 String holderName = enclosingElement.name.slowToString();
218 return '$kind($holderName#${name.slowToString()})'; 222 return '$kind($holderName#${name.slowToString()})';
219 } else { 223 } else {
220 return '$kind(${name.slowToString()})'; 224 return '$kind(${name.slowToString()})';
221 } 225 }
222 } 226 }
223 227
224 bool _isNative = false; 228 bool _isNative = false;
225 void setNative() { _isNative = true; } 229 void setNative() { _isNative = true; }
226 bool isNative() => _isNative; 230 bool isNative() => _isNative;
(...skipping 920 matching lines...) Expand 10 before | Expand all | Expand 10 after
1147 final Node node; 1151 final Node node;
1148 Type bound; 1152 Type bound;
1149 Type type; 1153 Type type;
1150 TypeVariableElement(name, Element enclosing, this.node, this.type, 1154 TypeVariableElement(name, Element enclosing, this.node, this.type,
1151 [this.bound]) 1155 [this.bound])
1152 : super(name, ElementKind.TYPE_VARIABLE, enclosing); 1156 : super(name, ElementKind.TYPE_VARIABLE, enclosing);
1153 Type computeType(compiler) => type; 1157 Type computeType(compiler) => type;
1154 Node parseNode(compiler) => node; 1158 Node parseNode(compiler) => node;
1155 toString() => "${enclosingElement.toString()}.${name.slowToString()}"; 1159 toString() => "${enclosingElement.toString()}.${name.slowToString()}";
1156 } 1160 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698