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

Side by Side Diff: reflectable/lib/mirrors.dart

Issue 1473073009: Added `dynamicReflected..Type`, corrected type expressions. (Closed) Base URL: https://github.com/dart-lang/reflectable.git@master
Patch Set: Created 5 years 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 | reflectable/lib/src/reflectable_mirror_based.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) 2015, the Dart Team. All rights reserved. Use of this 1 // Copyright (c) 2015, the Dart Team. All rights reserved. Use of this
2 // source code is governed by a BSD-style license that can be found in 2 // source code is governed by a BSD-style license that can be found in
3 // the LICENSE file. 3 // the LICENSE file.
4 4
5 // This file defines the same types as sdk/lib/mirrors/mirrors.dart, in 5 // This file defines the same types as sdk/lib/mirrors/mirrors.dart, in
6 // order to enable code using [dart:mirrors] to switch to using 6 // order to enable code using [dart:mirrors] to switch to using
7 // [Reflectable] based mirrors with the smallest possible change. 7 // [Reflectable] based mirrors with the smallest possible change.
8 // The changes are discussed below, under headings on the form 8 // The changes are discussed below, under headings on the form
9 // 'API Change: ..'. 9 // 'API Change: ..'.
10 10
(...skipping 291 matching lines...) Expand 10 before | Expand all | Expand 10 after
302 } 302 }
303 303
304 abstract class CombinatorMirror implements Mirror { 304 abstract class CombinatorMirror implements Mirror {
305 List<String> get identifiers; 305 List<String> get identifiers;
306 bool get isShow; 306 bool get isShow;
307 bool get isHide; 307 bool get isHide;
308 } 308 }
309 309
310 abstract class TypeMirror implements DeclarationMirror { 310 abstract class TypeMirror implements DeclarationMirror {
311 bool get hasReflectedType; 311 bool get hasReflectedType;
312 Type get reflectedType; 312 Type get reflectedType;
sigurdm 2015/11/26 10:18:03 Document conditions for availability.
eernst 2015/11/26 11:24:00 Done.
313 List<TypeVariableMirror> get typeVariables; 313 List<TypeVariableMirror> get typeVariables;
314 List<TypeMirror> get typeArguments; 314 List<TypeMirror> get typeArguments;
315 bool get isOriginalDeclaration; 315 bool get isOriginalDeclaration;
316 TypeMirror get originalDeclaration; 316 TypeMirror get originalDeclaration;
317 317
318 // Possible ARG: Type. 318 // Possible ARG: Type.
319 // Input from Gilad on this issue: 319 // Input from Gilad on this issue:
320 // I think we could consider using Type objects as arguments, because that is 320 // I think we could consider using Type objects as arguments, because that is
321 // actually more uniform; in general, the mirror API takes in base level 321 // actually more uniform; in general, the mirror API takes in base level
322 // objects and produces meta-level objects. As a practical matter, I'd say we 322 // objects and produces meta-level objects. As a practical matter, I'd say we
(...skipping 12 matching lines...) Expand all
335 bool get isAbstract; 335 bool get isAbstract;
336 bool get isEnum; 336 bool get isEnum;
337 337
338 // The non-abstract members declared in this class. 338 // The non-abstract members declared in this class.
339 Map<String, DeclarationMirror> get declarations; 339 Map<String, DeclarationMirror> get declarations;
340 Map<String, MethodMirror> get instanceMembers; 340 Map<String, MethodMirror> get instanceMembers;
341 Map<String, MethodMirror> get staticMembers; 341 Map<String, MethodMirror> get staticMembers;
342 342
343 ClassMirror get mixin; 343 ClassMirror get mixin;
344 344
345 /// Return true iff this class mirror is capable of delivering its
sigurdm 2015/11/26 10:18:03 Returns
eernst 2015/11/26 11:23:59 Done, fixed 10 occurrences of `/// [verb-not-in-pr
346 /// [dynamicReflectedType].
sigurdm 2015/11/26 10:18:03 Explain when this is/is not the case.
eernst 2015/11/26 11:24:00 Done.
347 bool get hasDynamicReflectedType;
348
349 /// Return the [Type] object representing the fully dynamic instantiation of
sigurdm 2015/11/26 10:18:03 Returns ...
eernst 2015/11/26 11:24:00 Done.
350 /// this class if it is generic, and return the [Type] object representing
351 /// this class if it is not generic. The fully dynamic instantiation of a
352 /// generic class `C` is the application of `C` to a type argument list of
353 /// the appropriate length where every argument is `dynamic`. For instance,
354 /// the fully dynamic instantiation of `List` and `Map` is `List<dynamic>`
355 /// respectively `Map<dynamic, dynamic>`.
sigurdm 2015/11/26 10:18:03 Write about the relation to hasDynamicReflectedTyp
eernst 2015/11/26 11:24:00 Done.
356 Type get dynamicReflectedType;
357
345 /** 358 /**
346 * Invokes the named constructor and returns the result. 359 * Invokes the named constructor and returns the result.
347 * 360 *
348 * Let *c* be the class reflected by this mirror 361 * Let *c* be the class reflected by this mirror
349 * let *a1, ..., an* be the elements of [positionalArguments] 362 * let *a1, ..., an* be the elements of [positionalArguments]
350 * let *k1, ..., km* be the identifiers denoted by the elements of 363 * let *k1, ..., km* be the identifiers denoted by the elements of
351 * [namedArguments.keys] 364 * [namedArguments.keys]
352 * and let *v1, ..., vm* be the elements of [namedArguments.values]. 365 * and let *v1, ..., vm* be the elements of [namedArguments.values].
353 * If [constructorName] was created from the empty string 366 * If [constructorName] was created from the empty string
354 * Then this method will execute the instance creation expression 367 * Then this method will execute the instance creation expression
(...skipping 87 matching lines...) Expand 10 before | Expand all | Expand 10 after
442 } 455 }
443 456
444 abstract class TypedefMirror implements TypeMirror { 457 abstract class TypedefMirror implements TypeMirror {
445 FunctionTypeMirror get referent; 458 FunctionTypeMirror get referent;
446 } 459 }
447 460
448 abstract class MethodMirror implements DeclarationMirror { 461 abstract class MethodMirror implements DeclarationMirror {
449 TypeMirror get returnType; // Possible RET: Type 462 TypeMirror get returnType; // Possible RET: Type
450 bool get hasReflectedReturnType; 463 bool get hasReflectedReturnType;
451 Type get reflectedReturnType; 464 Type get reflectedReturnType;
465 bool get hasDynamicReflectedReturnType;
466 Type get dynamicReflectedReturnType;
452 String get source; 467 String get source;
453 List<ParameterMirror> get parameters; 468 List<ParameterMirror> get parameters;
454 bool get isStatic; 469 bool get isStatic;
455 bool get isAbstract; 470 bool get isAbstract;
456 bool get isSynthetic; 471 bool get isSynthetic;
457 bool get isRegularMethod; 472 bool get isRegularMethod;
458 bool get isOperator; 473 bool get isOperator;
459 bool get isGetter; 474 bool get isGetter;
460 bool get isSetter; 475 bool get isSetter;
461 bool get isConstructor; 476 bool get isConstructor;
462 String get constructorName; 477 String get constructorName;
463 bool get isConstConstructor; 478 bool get isConstConstructor;
464 bool get isGenerativeConstructor; 479 bool get isGenerativeConstructor;
465 bool get isRedirectingConstructor; 480 bool get isRedirectingConstructor;
466 bool get isFactoryConstructor; 481 bool get isFactoryConstructor;
467 bool operator ==(other); 482 bool operator ==(other);
468 } 483 }
469 484
470 abstract class VariableMirror implements DeclarationMirror { 485 abstract class VariableMirror implements DeclarationMirror {
471 TypeMirror get type; // Possible RET: Type 486 TypeMirror get type; // Possible RET: Type
472 bool get hasReflectedType; 487 bool get hasReflectedType;
473 Type get reflectedType; 488 Type get reflectedType;
489 bool get hasDynamicReflectedType;
490 Type get dynamicReflectedType;
474 bool get isStatic; 491 bool get isStatic;
475 bool get isFinal; 492 bool get isFinal;
476 bool get isConst; 493 bool get isConst;
477 bool operator ==(other); 494 bool operator ==(other);
478 } 495 }
479 496
480 abstract class ParameterMirror implements VariableMirror { 497 abstract class ParameterMirror implements VariableMirror {
481 TypeMirror get type; // Possible RET: Type
482 bool get hasReflectedType;
483 Type get reflectedType;
484 bool get isOptional; 498 bool get isOptional;
485 bool get isNamed; 499 bool get isNamed;
486 bool get hasDefaultValue; 500 bool get hasDefaultValue;
487 Object get defaultValue; // RET: InstanceMirror 501 Object get defaultValue; // RET: InstanceMirror
488 } 502 }
489 503
490 abstract class SourceLocation { 504 abstract class SourceLocation {
491 int get line; 505 int get line;
492 int get column; 506 int get column;
493 Uri get sourceUri; 507 Uri get sourceUri;
494 } 508 }
495 509
496 class Comment { 510 class Comment {
497 final String text; 511 final String text;
498 final String trimmedText; 512 final String trimmedText;
499 final bool isDocComment; 513 final bool isDocComment;
500 const Comment(this.text, this.trimmedText, this.isDocComment); 514 const Comment(this.text, this.trimmedText, this.isDocComment);
501 } 515 }
516
517 class TypeValue<E> {
518 const TypeValue();
519 Type get type => E;
520 }
OLDNEW
« no previous file with comments | « no previous file | reflectable/lib/src/reflectable_mirror_based.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698