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 "vm/class_finalizer.h" | 5 #include "vm/class_finalizer.h" |
6 | 6 |
7 #include "vm/flags.h" | 7 #include "vm/flags.h" |
8 #include "vm/heap.h" | 8 #include "vm/heap.h" |
9 #include "vm/isolate.h" | 9 #include "vm/isolate.h" |
10 #include "vm/longjump.h" | 10 #include "vm/longjump.h" |
(...skipping 336 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
347 ResolveType(cls, type, kCanonicalize); | 347 ResolveType(cls, type, kCanonicalize); |
348 type ^= FinalizeType(cls, type, kCanonicalize); | 348 type ^= FinalizeType(cls, type, kCanonicalize); |
349 factory.SetRedirectionType(type); | 349 factory.SetRedirectionType(type); |
350 if (type.IsMalformed()) { | 350 if (type.IsMalformed()) { |
351 ASSERT(factory.RedirectionTarget() == Function::null()); | 351 ASSERT(factory.RedirectionTarget() == Function::null()); |
352 return; | 352 return; |
353 } | 353 } |
354 const Class& target_class = Class::Handle(type.type_class()); | 354 const Class& target_class = Class::Handle(type.type_class()); |
355 String& target_class_name = String::Handle(target_class.Name()); | 355 String& target_class_name = String::Handle(target_class.Name()); |
356 String& target_name = String::Handle( | 356 String& target_name = String::Handle( |
357 String::Concat(target_class_name, Symbols::DotHandle())); | 357 String::Concat(target_class_name, Symbols::Dot())); |
358 const String& identifier = String::Handle(factory.RedirectionIdentifier()); | 358 const String& identifier = String::Handle(factory.RedirectionIdentifier()); |
359 if (!identifier.IsNull()) { | 359 if (!identifier.IsNull()) { |
360 target_name = String::Concat(target_name, identifier); | 360 target_name = String::Concat(target_name, identifier); |
361 } | 361 } |
362 | 362 |
363 // Verify that the target constructor of the redirection exists. | 363 // Verify that the target constructor of the redirection exists. |
364 target = target_class.LookupConstructor(target_name); | 364 target = target_class.LookupConstructor(target_name); |
365 if (target.IsNull()) { | 365 if (target.IsNull()) { |
366 target = target_class.LookupFactory(target_name); | 366 target = target_class.LookupFactory(target_name); |
367 } | 367 } |
(...skipping 1155 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1523 | 1523 |
1524 | 1524 |
1525 RawType* ClassFinalizer::NewFinalizedMalformedType( | 1525 RawType* ClassFinalizer::NewFinalizedMalformedType( |
1526 const Error& prev_error, | 1526 const Error& prev_error, |
1527 const Class& cls, | 1527 const Class& cls, |
1528 intptr_t type_pos, | 1528 intptr_t type_pos, |
1529 FinalizationKind finalization, | 1529 FinalizationKind finalization, |
1530 const char* format, ...) { | 1530 const char* format, ...) { |
1531 va_list args; | 1531 va_list args; |
1532 va_start(args, format); | 1532 va_start(args, format); |
1533 const String& no_name = String::Handle(Symbols::Empty()); | |
1534 const UnresolvedClass& unresolved_class = UnresolvedClass::Handle( | 1533 const UnresolvedClass& unresolved_class = UnresolvedClass::Handle( |
1535 UnresolvedClass::New(LibraryPrefix::Handle(), no_name, type_pos)); | 1534 UnresolvedClass::New(LibraryPrefix::Handle(), |
| 1535 Symbols::Empty(), |
| 1536 type_pos)); |
1536 const Type& type = Type::Handle( | 1537 const Type& type = Type::Handle( |
1537 Type::New(unresolved_class, TypeArguments::Handle(), type_pos)); | 1538 Type::New(unresolved_class, TypeArguments::Handle(), type_pos)); |
1538 ReportMalformedType(prev_error, cls, type, finalization, format, args); | 1539 ReportMalformedType(prev_error, cls, type, finalization, format, args); |
1539 va_end(args); | 1540 va_end(args); |
1540 ASSERT(type.IsMalformed()); | 1541 ASSERT(type.IsMalformed()); |
1541 return type.raw(); | 1542 return type.raw(); |
1542 } | 1543 } |
1543 | 1544 |
1544 | 1545 |
1545 void ClassFinalizer::FinalizeMalformedType(const Error& prev_error, | 1546 void ClassFinalizer::FinalizeMalformedType(const Error& prev_error, |
(...skipping 29 matching lines...) Expand all Loading... |
1575 void ClassFinalizer::ReportError(const char* format, ...) { | 1576 void ClassFinalizer::ReportError(const char* format, ...) { |
1576 va_list args; | 1577 va_list args; |
1577 va_start(args, format); | 1578 va_start(args, format); |
1578 const Error& error = Error::Handle( | 1579 const Error& error = Error::Handle( |
1579 Parser::FormatError(Script::Handle(), -1, "Error", format, args)); | 1580 Parser::FormatError(Script::Handle(), -1, "Error", format, args)); |
1580 va_end(args); | 1581 va_end(args); |
1581 ReportError(error); | 1582 ReportError(error); |
1582 } | 1583 } |
1583 | 1584 |
1584 } // namespace dart | 1585 } // namespace dart |
OLD | NEW |