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

Side by Side Diff: pkg/docgen/lib/src/models/model_helpers.dart

Issue 1115183002: Add ConstantConstructor to ConstantExpression system. (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: Updated cf. comments. Created 5 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 | Annotate | Revision Log
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 docgen.model_helpers; 5 library docgen.model_helpers;
6 6
7 import 'dart:collection'; 7 import 'dart:collection';
8 8
9 import 'package:compiler/src/constants/expressions.dart'; 9 import 'package:compiler/src/constants/expressions.dart';
10 10
(...skipping 61 matching lines...) Expand 10 before | Expand all | Expand 10 after
72 } 72 }
73 73
74 class AnnotationInfo { 74 class AnnotationInfo {
75 final Mirror mirror; 75 final Mirror mirror;
76 final Library owningLibrary; 76 final Library owningLibrary;
77 77
78 AnnotationInfo(this.mirror, this.owningLibrary); 78 AnnotationInfo(this.mirror, this.owningLibrary);
79 } 79 }
80 80
81 class AnnotationCreator 81 class AnnotationCreator
82 extends ConstantExpressionVisitor<AnnotationInfo, Annotation> { 82 extends ConstantExpressionVisitor<Annotation, AnnotationInfo> {
83 83
84 const AnnotationCreator(); 84 const AnnotationCreator();
85 85
86 Annotation createAnnotation(var element, 86 Annotation createAnnotation(var element,
87 AnnotationInfo context, 87 AnnotationInfo context,
88 [List<String> parameters = const <String>[]]) { 88 [List<String> parameters = const <String>[]]) {
89 var mirror = 89 var mirror =
90 dart2js_mirrors.BackDoor.getMirrorFromElement(context.mirror, element); 90 dart2js_mirrors.BackDoor.getMirrorFromElement(context.mirror, element);
91 if (mirror != null) { 91 if (mirror != null) {
92 return new Annotation(context.owningLibrary, mirror, parameters); 92 return new Annotation(context.owningLibrary, mirror, parameters);
(...skipping 44 matching lines...) Expand 10 before | Expand all | Expand 10 after
137 return null; 137 return null;
138 } 138 }
139 139
140 @override 140 @override
141 Annotation visitMap(MapConstantExpression exp, 141 Annotation visitMap(MapConstantExpression exp,
142 AnnotationInfo context) { 142 AnnotationInfo context) {
143 return null; 143 return null;
144 } 144 }
145 145
146 @override 146 @override
147 Annotation visitPrimitive(PrimitiveConstantExpression exp,
148 AnnotationInfo context) {
149 return null;
150 }
151
152 @override
153 Annotation visitSymbol(SymbolConstantExpression exp, 147 Annotation visitSymbol(SymbolConstantExpression exp,
154 AnnotationInfo context) { 148 AnnotationInfo context) {
155 return null; 149 return null;
156 } 150 }
157 151
158 @override 152 @override
159 Annotation visitType(TypeConstantExpression exp, 153 Annotation visitType(TypeConstantExpression exp,
160 AnnotationInfo context) { 154 AnnotationInfo context) {
161 return null; 155 return null;
162 } 156 }
163 157
164 @override 158 @override
165 Annotation visitUnary(UnaryConstantExpression exp, 159 Annotation visitUnary(UnaryConstantExpression exp,
166 AnnotationInfo context) { 160 AnnotationInfo context) {
167 return null; 161 return null;
168 } 162 }
169 163
170 @override 164 @override
171 Annotation visitVariable(VariableConstantExpression exp, 165 Annotation visitVariable(VariableConstantExpression exp,
172 AnnotationInfo context) { 166 AnnotationInfo context) {
173 return createAnnotation(exp.element, context); 167 return createAnnotation(exp.element, context);
174 } 168 }
169
170 @override
171 Annotation visitBool(BoolConstantExpression exp,
172 AnnotationInfo context) {
173 return null;
174 }
175
176 @override
177 Annotation visitBoolFromEnvironment(BoolFromEnvironmentConstantExpression exp,
178 AnnotationInfo context) {
179 return null;
180 }
181
182 @override
183 Annotation visitDouble(DoubleConstantExpression exp,
184 AnnotationInfo context) {
185 return null;
186 }
187
188 @override
189 Annotation visitInt(IntConstantExpression exp,
190 AnnotationInfo context) {
191 return null;
192 }
193
194 @override
195 Annotation visitIntFromEnvironment(IntFromEnvironmentConstantExpression exp,
196 AnnotationInfo context) {
197 return null;
198 }
199
200 @override
201 Annotation visitNamed(NamedArgumentReference exp,
202 AnnotationInfo context) {
203 return null;
204 }
205
206 @override
207 Annotation visitNull(NullConstantExpression exp,
208 AnnotationInfo context) {
209 return null;
210 }
211
212 @override
213 Annotation visitPositional(PositionalArgumentReference exp,
214 AnnotationInfo context) {
215 return null;
216 }
217
218 @override
219 Annotation visitString(StringConstantExpression exp,
220 AnnotationInfo context) {
221 return null;
222 }
223
224 @override
225 Annotation visitStringFromEnvironment(
226 StringFromEnvironmentConstantExpression exp,
227 AnnotationInfo context) {
228 return null;
229 }
175 } 230 }
176 231
177 /// A declaration is private if itself is private, or the owner is private. 232 /// A declaration is private if itself is private, or the owner is private.
178 bool isHidden(DeclarationSourceMirror mirror) { 233 bool isHidden(DeclarationSourceMirror mirror) {
179 if (mirror is LibraryMirror) { 234 if (mirror is LibraryMirror) {
180 return _isLibraryPrivate(mirror); 235 return _isLibraryPrivate(mirror);
181 } else if (mirror.owner is LibraryMirror) { 236 } else if (mirror.owner is LibraryMirror) {
182 return (mirror.isPrivate || _isLibraryPrivate(mirror.owner) || 237 return (mirror.isPrivate || _isLibraryPrivate(mirror.owner) ||
183 mirror.isNameSynthetic); 238 mirror.isNameSynthetic);
184 } else { 239 } else {
(...skipping 182 matching lines...) Expand 10 before | Expand all | Expand 10 after
367 // the time. 422 // the time.
368 var sdkLibrary = LIBRARIES[dart2js_util.nameOf(mirror)]; 423 var sdkLibrary = LIBRARIES[dart2js_util.nameOf(mirror)];
369 if (sdkLibrary != null) { 424 if (sdkLibrary != null) {
370 return !sdkLibrary.documented; 425 return !sdkLibrary.documented;
371 } else if (dart2js_util.nameOf(mirror).startsWith('_') || dart2js_util.nameOf( 426 } else if (dart2js_util.nameOf(mirror).startsWith('_') || dart2js_util.nameOf(
372 mirror).contains('._')) { 427 mirror).contains('._')) {
373 return true; 428 return true;
374 } 429 }
375 return false; 430 return false;
376 } 431 }
OLDNEW
« no previous file with comments | « pkg/compiler/lib/src/use_unused_api.dart ('k') | tests/compiler/dart2js/constant_expression_test.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698