OLD | NEW |
1 // Copyright (c) 2013, the Dart project authors. Please see the AUTHORS file | 1 // Copyright (c) 2013, 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/code_generator.h" | 5 #include "vm/code_generator.h" |
6 | 6 |
7 #include "vm/assembler.h" | 7 #include "vm/assembler.h" |
8 #include "vm/ast.h" | 8 #include "vm/ast.h" |
9 #include "vm/bigint_operations.h" | 9 #include "vm/bigint_operations.h" |
10 #include "vm/code_patcher.h" | 10 #include "vm/code_patcher.h" |
(...skipping 655 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
666 DEFINE_RUNTIME_ENTRY(BadTypeError, 3) { | 666 DEFINE_RUNTIME_ENTRY(BadTypeError, 3) { |
667 const intptr_t location = GetCallerLocation(); | 667 const intptr_t location = GetCallerLocation(); |
668 const Instance& src_value = Instance::CheckedHandle(arguments.ArgAt(0)); | 668 const Instance& src_value = Instance::CheckedHandle(arguments.ArgAt(0)); |
669 const String& dst_name = String::CheckedHandle(arguments.ArgAt(1)); | 669 const String& dst_name = String::CheckedHandle(arguments.ArgAt(1)); |
670 const AbstractType& dst_type = | 670 const AbstractType& dst_type = |
671 AbstractType::CheckedHandle(arguments.ArgAt(2)); | 671 AbstractType::CheckedHandle(arguments.ArgAt(2)); |
672 const AbstractType& src_type = AbstractType::Handle(src_value.GetType()); | 672 const AbstractType& src_type = AbstractType::Handle(src_value.GetType()); |
673 const String& src_type_name = String::Handle(src_type.UserVisibleName()); | 673 const String& src_type_name = String::Handle(src_type.UserVisibleName()); |
674 | 674 |
675 String& dst_type_name = String::Handle(); | 675 String& dst_type_name = String::Handle(); |
676 Error& error = Error::Handle(); | 676 LanguageError& error = LanguageError::Handle(dst_type.error()); |
677 if (dst_type.IsMalformed()) { | 677 ASSERT(!error.IsNull()); |
678 error = dst_type.malformed_error(); | 678 if (error.kind() == LanguageError::kMalformedType) { |
679 dst_type_name = Symbols::Malformed().raw(); | 679 dst_type_name = Symbols::Malformed().raw(); |
680 } else { | 680 } else { |
681 const bool is_malbounded = dst_type.IsMalboundedWithError(&error); | 681 ASSERT(error.kind() == LanguageError::kMalboundedType); |
682 dst_type_name = Symbols::Malbounded().raw(); | 682 dst_type_name = Symbols::Malbounded().raw(); |
683 ASSERT(is_malbounded); | |
684 } | 683 } |
685 const String& error_message = String::ZoneHandle( | 684 const String& error_message = String::ZoneHandle( |
686 Symbols::New(error.ToErrorCString())); | 685 Symbols::New(error.ToErrorCString())); |
687 Exceptions::CreateAndThrowTypeError( | 686 Exceptions::CreateAndThrowTypeError( |
688 location, src_type_name, dst_type_name, dst_name, error_message); | 687 location, src_type_name, dst_type_name, dst_name, error_message); |
689 UNREACHABLE(); | 688 UNREACHABLE(); |
690 } | 689 } |
691 | 690 |
692 | 691 |
693 DEFINE_RUNTIME_ENTRY(Throw, 1) { | 692 DEFINE_RUNTIME_ENTRY(Throw, 1) { |
(...skipping 1005 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1699 // of the given value. | 1698 // of the given value. |
1700 // Arg0: Field object; | 1699 // Arg0: Field object; |
1701 // Arg1: Value that is being stored. | 1700 // Arg1: Value that is being stored. |
1702 DEFINE_RUNTIME_ENTRY(UpdateFieldCid, 2) { | 1701 DEFINE_RUNTIME_ENTRY(UpdateFieldCid, 2) { |
1703 const Field& field = Field::CheckedHandle(arguments.ArgAt(0)); | 1702 const Field& field = Field::CheckedHandle(arguments.ArgAt(0)); |
1704 const Object& value = Object::Handle(arguments.ArgAt(1)); | 1703 const Object& value = Object::Handle(arguments.ArgAt(1)); |
1705 field.UpdateGuardedCidAndLength(value); | 1704 field.UpdateGuardedCidAndLength(value); |
1706 } | 1705 } |
1707 | 1706 |
1708 } // namespace dart | 1707 } // namespace dart |
OLD | NEW |