OLD | NEW |
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 #include "lib/mirrors.h" | 5 #include "lib/mirrors.h" |
6 | 6 |
7 #include "lib/invocation_mirror.h" | 7 #include "lib/invocation_mirror.h" |
8 #include "vm/bootstrap_natives.h" | 8 #include "vm/bootstrap_natives.h" |
9 #include "vm/class_finalizer.h" | 9 #include "vm/class_finalizer.h" |
10 #include "vm/compiler.h" | 10 #include "vm/compiler.h" |
(...skipping 1464 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1475 // the equality test. | 1475 // the equality test. |
1476 function = function.parent_function(); | 1476 function = function.parent_function(); |
1477 } | 1477 } |
1478 | 1478 |
1479 Type& instantiator = Type::Handle(); | 1479 Type& instantiator = Type::Handle(); |
1480 if (closure.IsClosure()) { | 1480 if (closure.IsClosure()) { |
1481 const TypeArguments& arguments = | 1481 const TypeArguments& arguments = |
1482 TypeArguments::Handle(Closure::GetTypeArguments(closure)); | 1482 TypeArguments::Handle(Closure::GetTypeArguments(closure)); |
1483 const Class& cls = | 1483 const Class& cls = |
1484 Class::Handle(Isolate::Current()->object_store()->object_class()); | 1484 Class::Handle(Isolate::Current()->object_store()->object_class()); |
1485 instantiator = Type::New(cls, arguments, Scanner::kNoSourcePos); | 1485 instantiator = Type::New(cls, arguments, Token::kNoSourcePos); |
1486 instantiator.SetIsFinalized(); | 1486 instantiator.SetIsFinalized(); |
1487 } | 1487 } |
1488 return CreateMethodMirror(function, | 1488 return CreateMethodMirror(function, |
1489 Instance::null_instance(), | 1489 Instance::null_instance(), |
1490 instantiator); | 1490 instantiator); |
1491 } | 1491 } |
1492 return Instance::null(); | 1492 return Instance::null(); |
1493 } | 1493 } |
1494 | 1494 |
1495 | 1495 |
(...skipping 500 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1996 if (reflectee.IsMirrorReference()) { | 1996 if (reflectee.IsMirrorReference()) { |
1997 const MirrorReference& decl_ref = MirrorReference::Cast(reflectee); | 1997 const MirrorReference& decl_ref = MirrorReference::Cast(reflectee); |
1998 decl = decl_ref.referent(); | 1998 decl = decl_ref.referent(); |
1999 } else if (reflectee.IsTypeParameter()) { | 1999 } else if (reflectee.IsTypeParameter()) { |
2000 decl = reflectee.raw(); | 2000 decl = reflectee.raw(); |
2001 } else { | 2001 } else { |
2002 UNREACHABLE(); | 2002 UNREACHABLE(); |
2003 } | 2003 } |
2004 | 2004 |
2005 Script& script = Script::Handle(); | 2005 Script& script = Script::Handle(); |
2006 intptr_t token_pos = Scanner::kNoSourcePos; | 2006 intptr_t token_pos = Token::kNoSourcePos; |
2007 | 2007 |
2008 if (decl.IsFunction()) { | 2008 if (decl.IsFunction()) { |
2009 const Function& func = Function::Cast(decl); | 2009 const Function& func = Function::Cast(decl); |
2010 if (func.IsImplicitConstructor() || func.IsSignatureFunction()) { | 2010 if (func.IsImplicitConstructor() || func.IsSignatureFunction()) { |
2011 // These are synthetic methods; they have no source. | 2011 // These are synthetic methods; they have no source. |
2012 return Instance::null(); | 2012 return Instance::null(); |
2013 } | 2013 } |
2014 script = func.script(); | 2014 script = func.script(); |
2015 token_pos = func.token_pos(); | 2015 token_pos = func.token_pos(); |
2016 } else if (decl.IsClass()) { | 2016 } else if (decl.IsClass()) { |
(...skipping 34 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2051 const String& uri = String::Handle(script.url()); | 2051 const String& uri = String::Handle(script.url()); |
2052 return CreateSourceLocation(uri, 1, 1); | 2052 return CreateSourceLocation(uri, 1, 1); |
2053 } | 2053 } |
2054 const TokenStream& stream = TokenStream::Handle(script.tokens()); | 2054 const TokenStream& stream = TokenStream::Handle(script.tokens()); |
2055 TokenStream::Iterator tkit(stream, 0); | 2055 TokenStream::Iterator tkit(stream, 0); |
2056 if (tkit.CurrentTokenKind() == Token::kSCRIPTTAG) tkit.Advance(); | 2056 if (tkit.CurrentTokenKind() == Token::kSCRIPTTAG) tkit.Advance(); |
2057 token_pos = tkit.CurrentPosition(); | 2057 token_pos = tkit.CurrentPosition(); |
2058 } | 2058 } |
2059 | 2059 |
2060 ASSERT(!script.IsNull()); | 2060 ASSERT(!script.IsNull()); |
2061 ASSERT(token_pos != Scanner::kNoSourcePos); | 2061 ASSERT(token_pos != Token::kNoSourcePos); |
2062 | 2062 |
2063 const String& uri = String::Handle(script.url()); | 2063 const String& uri = String::Handle(script.url()); |
2064 intptr_t from_line = 0; | 2064 intptr_t from_line = 0; |
2065 intptr_t from_col = 0; | 2065 intptr_t from_col = 0; |
2066 if (script.HasSource()) { | 2066 if (script.HasSource()) { |
2067 script.GetTokenLocation(token_pos, &from_line, &from_col); | 2067 script.GetTokenLocation(token_pos, &from_line, &from_col); |
2068 } else { | 2068 } else { |
2069 // Avoid the slow path of printing the token stream when precise source | 2069 // Avoid the slow path of printing the token stream when precise source |
2070 // information is not available. | 2070 // information is not available. |
2071 script.GetTokenLocation(token_pos, &from_line, NULL); | 2071 script.GetTokenLocation(token_pos, &from_line, NULL); |
(...skipping 37 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2109 } | 2109 } |
2110 | 2110 |
2111 DEFINE_NATIVE_ENTRY(TypeMirror_subtypeTest, 2) { | 2111 DEFINE_NATIVE_ENTRY(TypeMirror_subtypeTest, 2) { |
2112 GET_NON_NULL_NATIVE_ARGUMENT(AbstractType, a, arguments->NativeArgAt(0)); | 2112 GET_NON_NULL_NATIVE_ARGUMENT(AbstractType, a, arguments->NativeArgAt(0)); |
2113 GET_NON_NULL_NATIVE_ARGUMENT(AbstractType, b, arguments->NativeArgAt(1)); | 2113 GET_NON_NULL_NATIVE_ARGUMENT(AbstractType, b, arguments->NativeArgAt(1)); |
2114 return Bool::Get(a.IsSubtypeOf(b, NULL)).raw(); | 2114 return Bool::Get(a.IsSubtypeOf(b, NULL)).raw(); |
2115 } | 2115 } |
2116 | 2116 |
2117 | 2117 |
2118 } // namespace dart | 2118 } // namespace dart |
OLD | NEW |