Commit Graph

89 Commits

Author SHA1 Message Date
mlippautz@google.com 1cf1806f29 Remove unreachable code in mirrors.
The only case where we do not set the name in the constructor is for anonymous
mixin applications.

BUG=
R=asiva@google.com, rmacnak@google.com

Review URL: https://codereview.chromium.org//23531037

git-svn-id: https://dart.googlecode.com/svn/branches/bleeding_edge/dart@27390 260f80e4-7a28-3924-810f-c04153c831b5
2013-09-11 16:10:43 +00:00
hausner@google.com fd57843900 Update handling of ambiguous name references
Update VM to latest spec. Referencing a name that is imported
from more than one library is no longer a compile-time error.
If one of the sources of an ambiguous reference is a dart library,
the dart library declaration is automatically hidden.

Also fixes a bug where looking up a getter name in a library
found the getter even though the name is filtered out in the
'hide' combinator.

Long-term we should fix the need for repeatedly convert between
the mangled getter and setter names and the untangled name.

Fixes 12915, 12913, 12724.

R=regis@google.com

Review URL: https://codereview.chromium.org//23484020

git-svn-id: https://dart.googlecode.com/svn/branches/bleeding_edge/dart@27312 260f80e4-7a28-3924-810f-c04153c831b5
2013-09-09 21:52:40 +00:00
regis@google.com 765aac1496 Keep track of the application of a mixin type to a mixin application class,
which includes setting up its type parameters (fix issue 12871).

R=asiva@google.com

Review URL: https://codereview.chromium.org//23453024

git-svn-id: https://dart.googlecode.com/svn/branches/bleeding_edge/dart@27157 260f80e4-7a28-3924-810f-c04153c831b5
2013-09-04 22:21:36 +00:00
srdjan@google.com 7fb4b62586 Fix build breakage.
R=rmacnak@google.com

Review URL: https://codereview.chromium.org//23658019

git-svn-id: https://dart.googlecode.com/svn/branches/bleeding_edge/dart@27135 260f80e4-7a28-3924-810f-c04153c831b5
2013-09-04 17:46:53 +00:00
rmacnak@google.com d7d3588a55 Support named and optional positional arguments in reflective invocation.
R=ahe@google.com, regis@google.com

Review URL: https://codereview.chromium.org//23604003

git-svn-id: https://dart.googlecode.com/svn/branches/bleeding_edge/dart@27134 260f80e4-7a28-3924-810f-c04153c831b5
2013-09-04 17:12:28 +00:00
rmacnak@google.com 865ef54309 Implement ParameterMirror.metadata.
BUG=http://dartbug.com/10906
BUG=http://dartbug.com/11418
R=asiva@google.com

Review URL: https://codereview.chromium.org//23224016

git-svn-id: https://dart.googlecode.com/svn/branches/bleeding_edge/dart@27082 260f80e4-7a28-3924-810f-c04153c831b5
2013-09-03 22:50:15 +00:00
rmacnak@google.com 64fd5a5079 Implement InstanceMirror.== in dart2js and InstanceMirror.hashCode in the VM and dart2js.
BUG=http://dartbug.com/12909
BUG=http://dartbug.com/12919
R=ahe@google.com, asiva@google.com

Review URL: https://codereview.chromium.org//23460013

git-svn-id: https://dart.googlecode.com/svn/branches/bleeding_edge/dart@27075 260f80e4-7a28-3924-810f-c04153c831b5
2013-09-03 20:11:11 +00:00
rmacnak@google.com 919eae46a1 Ensure class mirrors on non-generic classes always have their runtime type set. Add a test for class mirror equality.
BUG=http://dartbug.com/12800
R=ahe@google.com, asiva@google.com

Review URL: https://codereview.chromium.org//23657002

git-svn-id: https://dart.googlecode.com/svn/branches/bleeding_edge/dart@26951 260f80e4-7a28-3924-810f-c04153c831b5
2013-08-30 21:51:31 +00:00
rmacnak@google.com ac705b02a7 More reflection of mixin applications in the VM.
*Provide ClassMirror.mixin
*Hide extra class on the inheritance chain introduced in mixin typedefs
*Give mixin applications a simpleName that matches the source language syntax
*Update mixin_test to distinguish between members and constructors
*Update mixin_test for the mixin application naming scheme

BUG=http://dartbug.com/12464
R=ahe@google.com, asiva@google.com

Review URL: https://codereview.chromium.org//23190003

git-svn-id: https://dart.googlecode.com/svn/branches/bleeding_edge/dart@26824 260f80e4-7a28-3924-810f-c04153c831b5
2013-08-28 22:55:53 +00:00
kmillikin@google.com 4f80ef09df Change Bool::Get to return a handle instead of a pointer to a raw object.
Replace occurrences of 'expr ? Bool::True() : Bool::False()' with simply
'Bool::Get(expr)' and analogously for its negation.  The pointer to the raw
object can still be extracted with 'Bool::Get(expr).raw()'.

R=iposva@google.com, srdjan@google.com

Review URL: https://codereview.chromium.org//23480005

git-svn-id: https://dart.googlecode.com/svn/branches/bleeding_edge/dart@26770 260f80e4-7a28-3924-810f-c04153c831b5
2013-08-28 08:38:56 +00:00
mlippautz@google.com 817a6fff3a Implement ParameterMirror.{isFinal,hasDefaultValue,defaultValue}.
Fixes issue 12196 and partially addresses issue 12430.

BUG=
R=ahe@google.com, asiva@google.com, gbracha@google.com

Review URL: https://codereview.chromium.org//23020025

git-svn-id: https://dart.googlecode.com/svn/branches/bleeding_edge/dart@26730 260f80e4-7a28-3924-810f-c04153c831b5
2013-08-27 17:31:09 +00:00
mlippautz@google.com b708a455d1 Fix Function.end_token_pos() and implement MethodMirror.source getter.
Move .source getter from ClosureMirror to MethodMirror (as the TODO already suggested) and provide an implementation.

BUG=
R=asiva@google.com, hausner@google.com

Review URL: https://codereview.chromium.org//23038010

git-svn-id: https://dart.googlecode.com/svn/branches/bleeding_edge/dart@26659 260f80e4-7a28-3924-810f-c04153c831b5
2013-08-26 17:14:07 +00:00
rmacnak@google.com 7ed3644358 Make reflectClass(dynamic) throw an illegal argument exception.
BUG=
R=gbracha@google.com, iposva@google.com

Review URL: https://codereview.chromium.org//22633005

git-svn-id: https://dart.googlecode.com/svn/branches/bleeding_edge/dart@26550 260f80e4-7a28-3924-810f-c04153c831b5
2013-08-22 20:05:51 +00:00
rmacnak@google.com 2f192be945 Provide a way to get a Type back from a ClassMirror.
BUG= http://dartbug.com/6433
R=asiva@google.com

Review URL: https://codereview.chromium.org//22849015

git-svn-id: https://dart.googlecode.com/svn/branches/bleeding_edge/dart@26407 260f80e4-7a28-3924-810f-c04153c831b5
2013-08-20 23:05:31 +00:00
mlippautz@google.com 187ec3d4fc Fix ClassMirror.typeArguments handling for dynamic only type arguments.
Addresses an issue where we did not return the appropriate type arguments for instances with all dynamic type arguments.

Example:
Class <E> {}

main() {
  var cm = reflectClass(new C()).type;
  print(cm.typeArguments);
  // now prints: {Symbol("E"): TypeMirror on 'dynamic'}
  // previously: crashed
}

BUG=
R=asiva@google.com

Review URL: https://codereview.chromium.org//23133003

git-svn-id: https://dart.googlecode.com/svn/branches/bleeding_edge/dart@26135 260f80e4-7a28-3924-810f-c04153c831b5
2013-08-14 18:41:30 +00:00
rmacnak@google.com 0d665249d7 Hide methods marked as not-visible from reflective member lists and invocation.
R=srdjan@google.com

Review URL: https://codereview.chromium.org//22961004

git-svn-id: https://dart.googlecode.com/svn/branches/bleeding_edge/dart@26093 260f80e4-7a28-3924-810f-c04153c831b5
2013-08-13 23:17:44 +00:00
mlippautz@google.com c79874a413 ParameterMirror: Implement some missing getters.
Fixes issue 11334 and issue 11684 and issue 11567.

R=asiva@google.com

Review URL: https://codereview.chromium.org//21624006

git-svn-id: https://dart.googlecode.com/svn/branches/bleeding_edge/dart@26086 260f80e4-7a28-3924-810f-c04153c831b5
2013-08-13 21:38:36 +00:00
rmacnak@google.com 1edde1e0bf Ensure the classes void and dynamic have empty arrays for fields, functions, etc. Move their Types to the VM isolate, and as a side-effect they are now canonicalized.
BUG=http://dartbug.com/12071
BUG=http://dartbug.com/12246
R=asiva@google.com, iposva@google.com, regis@google.com

Review URL: https://codereview.chromium.org//22902002

git-svn-id: https://dart.googlecode.com/svn/branches/bleeding_edge/dart@26043 260f80e4-7a28-3924-810f-c04153c831b5
2013-08-13 00:11:42 +00:00
rmacnak@google.com 5c63370d25 Make ClosureMirror handle instances of user-defined classes that implement call.
R=asiva@google.com

Review URL: https://codereview.chromium.org//22625003

git-svn-id: https://dart.googlecode.com/svn/branches/bleeding_edge/dart@25944 260f80e4-7a28-3924-810f-c04153c831b5
2013-08-08 20:25:46 +00:00
rmacnak@google.com fe85bf84bb Reflection on generics.
BUG=
R=ahe@google.com, regis@google.com

Review URL: https://codereview.chromium.org//22292002

git-svn-id: https://dart.googlecode.com/svn/branches/bleeding_edge/dart@25942 260f80e4-7a28-3924-810f-c04153c831b5
2013-08-08 20:06:56 +00:00
rmacnak@google.com ce55909b63 Deal with "classes" that don't belong to any library. Addresses issue 12231.
Review URL: https://codereview.chromium.org/22043005/



git-svn-id: https://dart.googlecode.com/svn/branches/bleeding_edge/dart@25785 260f80e4-7a28-3924-810f-c04153c831b5
2013-08-05 18:54:01 +00:00
rmacnak@google.com 6ab88ae6d5 Implement metadata for libraries. Partially addresses issue 10906.
git-svn-id: https://dart.googlecode.com/svn/branches/bleeding_edge/dart@25721 260f80e4-7a28-3924-810f-c04153c831b5
2013-08-01 20:45:49 +00:00
mlippautz@google.com f1dcf02f75 Inline CreateClassMirror and remove dead code.
(Almost) no more embedding API, yay!

Fixes issue 12135.

R=asiva@google.com

Review URL: https://codereview.chromium.org//21440002

git-svn-id: https://dart.googlecode.com/svn/branches/bleeding_edge/dart@25717 260f80e4-7a28-3924-810f-c04153c831b5
2013-08-01 18:27:32 +00:00
rmacnak@google.com 409f02d3f9 Implement mirror equality on the VM. Resolves issue 12026.
R=asiva@google.com

Review URL: https://codereview.chromium.org//21381002

git-svn-id: https://dart.googlecode.com/svn/branches/bleeding_edge/dart@25711 260f80e4-7a28-3924-810f-c04153c831b5
2013-08-01 16:40:10 +00:00
rmacnak@google.com 8ee3299833 Allow InstanceMirror.invoke to find private members. Resolves issue 11771.
R=asiva@google.com

Review URL: https://codereview.chromium.org//21430002

git-svn-id: https://dart.googlecode.com/svn/branches/bleeding_edge/dart@25690 260f80e4-7a28-3924-810f-c04153c831b5
2013-07-31 23:45:12 +00:00
mlippautz@google.com 9f602cfa83 Also fixes issue 11897.
R=asiva@google.com

Review URL: https://codereview.chromium.org//21124011

git-svn-id: https://dart.googlecode.com/svn/branches/bleeding_edge/dart@25689 260f80e4-7a28-3924-810f-c04153c831b5
2013-07-31 23:31:14 +00:00
mlippautz@google.com c5c6df3548 BUG=
R=asiva@google.com, rmacnak@google.com

Review URL: https://codereview.chromium.org//20216002

git-svn-id: https://dart.googlecode.com/svn/branches/bleeding_edge/dart@25651 260f80e4-7a28-3924-810f-c04153c831b5
2013-07-30 22:57:59 +00:00
mlippautz@google.com 58beb194dc Hoist .simpleName and .qualifiedName up to _LocalDeclarationMirrorImpl.
Current tests already cover this change.

BUG=
R=asiva@google.com

Review URL: https://codereview.chromium.org//21281002

git-svn-id: https://dart.googlecode.com/svn/branches/bleeding_edge/dart@25647 260f80e4-7a28-3924-810f-c04153c831b5
2013-07-30 22:22:17 +00:00
mlippautz@google.com 8bfc72b1b9 Inline CreateLibraryMirror.
BUG=
R=asiva@google.com, rmacnak@google.com

Review URL: https://codereview.chromium.org//21092004

git-svn-id: https://dart.googlecode.com/svn/branches/bleeding_edge/dart@25640 260f80e4-7a28-3924-810f-c04153c831b5
2013-07-30 20:52:44 +00:00
rmacnak@google.com b68bc10c6c Create the local MirrorSystem with internal code.
R=asiva@google.com

Review URL: https://codereview.chromium.org//20851002

git-svn-id: https://dart.googlecode.com/svn/branches/bleeding_edge/dart@25601 260f80e4-7a28-3924-810f-c04153c831b5
2013-07-30 01:09:05 +00:00
rmacnak@google.com 47f7d23626 Ensure FunctionTypeMirrors have a proper reflectee and implement ClassMirror.superinterfaces with internal code. Remove some unnecessary fields and constructor arguments.
R=asiva@google.com

Review URL: https://codereview.chromium.org//21010005

git-svn-id: https://dart.googlecode.com/svn/branches/bleeding_edge/dart@25599 260f80e4-7a28-3924-810f-c04153c831b5
2013-07-30 00:29:52 +00:00
rmacnak@google.com 844a406c8a Implement reflect() with Dart code, InstanceMirror.type and ClosureMirror.function with internal code.
R=asiva@google.com

Review URL: https://codereview.chromium.org//21119002

git-svn-id: https://dart.googlecode.com/svn/branches/bleeding_edge/dart@25594 260f80e4-7a28-3924-810f-c04153c831b5
2013-07-29 23:57:31 +00:00
mlippautz@google.com 5f4e6e6000 Remove dead code from native mirrors library.
BUG=
R=rmacnak@google.com

Review URL: https://codereview.chromium.org//21047005

git-svn-id: https://dart.googlecode.com/svn/branches/bleeding_edge/dart@25576 260f80e4-7a28-3924-810f-c04153c831b5
2013-07-29 17:49:04 +00:00
rmacnak@google.com bd07e14c9a Make ClassMirror.constructors an internal native and lazy.
R=asiva@google.com

Review URL: https://codereview.chromium.org//20564002

git-svn-id: https://dart.googlecode.com/svn/branches/bleeding_edge/dart@25533 260f80e4-7a28-3924-810f-c04153c831b5
2013-07-26 18:29:38 +00:00
rmacnak@google.com b0cd678f0c Implement ClassMirror.superclass with internal code for ordinary (but not function type) classes. Resolves issue 5794 and issue 9434.
R=asiva@google.com

Review URL: https://codereview.chromium.org//20465002

git-svn-id: https://dart.googlecode.com/svn/branches/bleeding_edge/dart@25508 260f80e4-7a28-3924-810f-c04153c831b5
2013-07-25 22:45:07 +00:00
mlippautz@google.com 4415c965d1 BUG=
R=asiva@google.com

Review URL: https://codereview.chromium.org//20208002

git-svn-id: https://dart.googlecode.com/svn/branches/bleeding_edge/dart@25499 260f80e4-7a28-3924-810f-c04153c831b5
2013-07-25 21:10:09 +00:00
rmacnak@google.com 670a0345ca Wrap lazy compilation errors when parsing metadata. Addresses the poor error reporting in issue 12027.
R=asiva@google.com

Review URL: https://codereview.chromium.org//20458002

git-svn-id: https://dart.googlecode.com/svn/branches/bleeding_edge/dart@25498 260f80e4-7a28-3924-810f-c04153c831b5
2013-07-25 20:49:59 +00:00
rmacnak@google.com 4a98a91696 Change the return value of setField to be in line with non-reflective assignments. Complete unwrapping of exceptions for the InstanceMirror invokes. Resolves issue 11219 and issue 11943.
R=asiva@google.com

Review URL: https://codereview.chromium.org//20066004

git-svn-id: https://dart.googlecode.com/svn/branches/bleeding_edge/dart@25457 260f80e4-7a28-3924-810f-c04153c831b5
2013-07-25 00:18:42 +00:00
rmacnak@google.com 8ebdd7f9d8 Make LibraryMirror.members an internal native and lazy.
R=asiva@google.com

Review URL: https://codereview.chromium.org//20119002

git-svn-id: https://dart.googlecode.com/svn/branches/bleeding_edge/dart@25451 260f80e4-7a28-3924-810f-c04153c831b5
2013-07-24 23:51:15 +00:00
mlippautz@google.com db8354cd4b Inline CreateParameterMirrorList() functionality.
BUG=
R=asiva@google.com

Review URL: https://codereview.chromium.org//19856003

git-svn-id: https://dart.googlecode.com/svn/branches/bleeding_edge/dart@25450 260f80e4-7a28-3924-810f-c04153c831b5
2013-07-24 23:35:15 +00:00
rmacnak@google.com 1a0b3c7871 Make reflective invocations raise NoSuchMethodErrors in the cases where non-reflective invocations do so. Resolves issues 11187 and 11957.
R=asiva@google.com

Review URL: https://codereview.chromium.org//19819003

git-svn-id: https://dart.googlecode.com/svn/branches/bleeding_edge/dart@25387 260f80e4-7a28-3924-810f-c04153c831b5
2013-07-24 00:29:17 +00:00
rmacnak@google.com c745da73af Make ClassMirror.members internal-native and lazy.
R=asiva@google.com

Review URL: https://codereview.chromium.org//19496003

git-svn-id: https://dart.googlecode.com/svn/branches/bleeding_edge/dart@25384 260f80e4-7a28-3924-810f-c04153c831b5
2013-07-23 23:54:16 +00:00
mlippautz@google.com 9d367d788d Local change to make the type getter lazy.
This change adds the last piece missing to inline functionality of CreateMethodMirror and its parameters. (Separate CL.)

BUG=
R=asiva@google.com

Review URL: https://codereview.chromium.org//19983003

git-svn-id: https://dart.googlecode.com/svn/branches/bleeding_edge/dart@25325 260f80e4-7a28-3924-810f-c04153c831b5
2013-07-23 00:39:28 +00:00
regis@google.com 9581071936 Refactor resolution code in the vm to properly handle ambiguity errors.
Add test.

R=asiva@google.com

Review URL: https://codereview.chromium.org//19662003

git-svn-id: https://dart.googlecode.com/svn/branches/bleeding_edge/dart@25324 260f80e4-7a28-3924-810f-c04153c831b5
2013-07-23 00:19:39 +00:00
rmacnak@google.com 9c4fef756b Implement VariableMirror creation with non-API code. To break circular initialization, have them find their type lazily.
R=asiva@google.com

Review URL: https://codereview.chromium.org//19512003

git-svn-id: https://dart.googlecode.com/svn/branches/bleeding_edge/dart@25317 260f80e4-7a28-3924-810f-c04153c831b5
2013-07-22 23:05:54 +00:00
mlippautz@google.com b58e38269b This change introduces nothing new. It only fixes the native entrypoints to use the right macros.
BUG=
R=asiva@google.com

Review URL: https://codereview.chromium.org//19500016

git-svn-id: https://dart.googlecode.com/svn/branches/bleeding_edge/dart@25315 260f80e4-7a28-3924-810f-c04153c831b5
2013-07-22 22:49:08 +00:00
mlippautz@google.com b3cb27a829 Since returnType is represented by a mirror, we make it lazy. We do not use a lazy mirror anymore, but instead create a type mirror upon first access.
CreateTypeMirror is already factored out of MethodMirror_return_type since it is needed by others mirrors (future CLs). Also introduces CreateMirror() which will be used in future CLs.

BUG=
R=asiva@google.com

Review URL: https://codereview.chromium.org//19780002

git-svn-id: https://dart.googlecode.com/svn/branches/bleeding_edge/dart@25252 260f80e4-7a28-3924-810f-c04153c831b5
2013-07-19 23:17:47 +00:00
rmacnak@google.com 448dbb1017 Make the ClassMirrors created through reflectClass() find their owners (libraries) lazily.
Remove an unused parameter that was threaded through a number of mirror creation functions.

R=asiva@google.com

Review URL: https://codereview.chromium.org//19188004

git-svn-id: https://dart.googlecode.com/svn/branches/bleeding_edge/dart@25193 260f80e4-7a28-3924-810f-c04153c831b5
2013-07-19 00:44:36 +00:00
rmacnak@google.com 08e322a197 Introduce an abstract DeclarationMirror in the implementation hierarchy; add a MirrorReference reflectee to TypedefMirror and TypeVariableMirror.
R=asiva@google.com

Review URL: https://codereview.chromium.org//19604004

git-svn-id: https://dart.googlecode.com/svn/branches/bleeding_edge/dart@25187 260f80e4-7a28-3924-810f-c04153c831b5
2013-07-18 22:13:55 +00:00
mlippautz@google.com 61bae883ed If we have the owner mirror at creation time (which right now is a lazy mirror), we will use it. Eventually lazy mirrors will go away and we will not have to resolve() in dart code anymore.
If we don't have it, for example for a nested closure, we set it null and construct it lazily at access time.

Example:

outer() {
  inner() {}
  var closureMirror = reflect(inner);
  print(closureMirror.function.owner);  // Should be a MethodMirror on outer, that is constructed lazily.
}

Since we need to be able to construct the chain of owners (back up to library), we need to handle all cases in the lazy creation.

The CL also adds wrappers that can be called with native objects. At some point these wrapper will create the mirrors without referring to the ones using embedded API.

BUG=
R=asiva@google.com

Review URL: https://codereview.chromium.org//19579006

git-svn-id: https://dart.googlecode.com/svn/branches/bleeding_edge/dart@25186 260f80e4-7a28-3924-810f-c04153c831b5
2013-07-18 22:04:57 +00:00