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/class_finalizer.h" | 5 #include "vm/class_finalizer.h" |
6 | 6 |
7 #include "vm/code_generator.h" | 7 #include "vm/code_generator.h" |
8 #include "vm/flags.h" | 8 #include "vm/flags.h" |
9 #include "vm/heap.h" | 9 #include "vm/heap.h" |
10 #include "vm/isolate.h" | 10 #include "vm/isolate.h" |
(...skipping 1624 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1635 // level. As a consequence, if this mixin application is used itself as a | 1635 // level. As a consequence, if this mixin application is used itself as a |
1636 // mixin in another mixin application, the bounds will be ignored, which | 1636 // mixin in another mixin application, the bounds will be ignored, which |
1637 // is correct, because the other mixin application does not inherit from | 1637 // is correct, because the other mixin application does not inherit from |
1638 // the super class of its mixin. Note also that the other mixin | 1638 // the super class of its mixin. Note also that the other mixin |
1639 // application will only mixin the last mixin type listed in the first | 1639 // application will only mixin the last mixin type listed in the first |
1640 // mixin application it is mixing in. | 1640 // mixin application it is mixing in. |
1641 param_bound = isolate->object_store()->object_type(); | 1641 param_bound = isolate->object_store()->object_type(); |
1642 for (intptr_t i = 0; i < num_super_type_params; i++) { | 1642 for (intptr_t i = 0; i < num_super_type_params; i++) { |
1643 param ^= super_type_params.TypeAt(i); | 1643 param ^= super_type_params.TypeAt(i); |
1644 param_name = param.name(); | 1644 param_name = param.name(); |
1645 param_name = String::Concat(param_name, Symbols::Backtick()); | 1645 param_name = Symbols::FromConcat(param_name, Symbols::Backtick()); |
1646 param_name = Symbols::New(param_name); | |
1647 cloned_param = TypeParameter::New(mixin_app_class, | 1646 cloned_param = TypeParameter::New(mixin_app_class, |
1648 cloned_index, | 1647 cloned_index, |
1649 param_name, | 1648 param_name, |
1650 param_bound, | 1649 param_bound, |
1651 param.token_pos()); | 1650 param.token_pos()); |
1652 cloned_type_params.SetTypeAt(cloned_index, cloned_param); | 1651 cloned_type_params.SetTypeAt(cloned_index, cloned_param); |
1653 // Change the type arguments of the super type to refer to the | 1652 // Change the type arguments of the super type to refer to the |
1654 // cloned type parameters of the mixin application class. | 1653 // cloned type parameters of the mixin application class. |
1655 super_type_args.SetTypeAt(cloned_index, cloned_param); | 1654 super_type_args.SetTypeAt(cloned_index, cloned_param); |
1656 cloned_index++; | 1655 cloned_index++; |
(...skipping 440 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2097 const intptr_t num_functions = functions.Length(); | 2096 const intptr_t num_functions = functions.Length(); |
2098 Function& func = Function::Handle(); | 2097 Function& func = Function::Handle(); |
2099 for (intptr_t i = 0; i < num_functions; i++) { | 2098 for (intptr_t i = 0; i < num_functions; i++) { |
2100 func ^= functions.At(i); | 2099 func ^= functions.At(i); |
2101 if (func.IsGenerativeConstructor()) { | 2100 if (func.IsGenerativeConstructor()) { |
2102 // Build constructor name from mixin application class name | 2101 // Build constructor name from mixin application class name |
2103 // and name of cloned super class constructor. | 2102 // and name of cloned super class constructor. |
2104 const String& ctor_name = String::Handle(func.name()); | 2103 const String& ctor_name = String::Handle(func.name()); |
2105 String& clone_name = String::Handle( | 2104 String& clone_name = String::Handle( |
2106 String::SubString(ctor_name, super_name.Length())); | 2105 String::SubString(ctor_name, super_name.Length())); |
2107 clone_name = String::Concat(mixin_name, clone_name); | 2106 clone_name = Symbols::FromConcat(mixin_name, clone_name); |
2108 clone_name = Symbols::New(clone_name); | |
2109 | 2107 |
2110 if (FLAG_trace_class_finalization) { | 2108 if (FLAG_trace_class_finalization) { |
2111 ISL_Print("Cloning constructor '%s' as '%s'\n", | 2109 ISL_Print("Cloning constructor '%s' as '%s'\n", |
2112 ctor_name.ToCString(), | 2110 ctor_name.ToCString(), |
2113 clone_name.ToCString()); | 2111 clone_name.ToCString()); |
2114 } | 2112 } |
2115 const Function& clone = Function::Handle( | 2113 const Function& clone = Function::Handle( |
2116 Function::New(clone_name, | 2114 Function::New(clone_name, |
2117 func.kind(), | 2115 func.kind(), |
2118 func.is_static(), | 2116 func.is_static(), |
(...skipping 1101 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
3220 ASSERT(fields_array.Length() == ByteBuffer::NumberOfFields()); | 3218 ASSERT(fields_array.Length() == ByteBuffer::NumberOfFields()); |
3221 field ^= fields_array.At(0); | 3219 field ^= fields_array.At(0); |
3222 ASSERT(field.Offset() == ByteBuffer::data_offset()); | 3220 ASSERT(field.Offset() == ByteBuffer::data_offset()); |
3223 name ^= field.name(); | 3221 name ^= field.name(); |
3224 expected_name ^= String::New("_data"); | 3222 expected_name ^= String::New("_data"); |
3225 ASSERT(String::EqualsIgnoringPrivateKey(name, expected_name)); | 3223 ASSERT(String::EqualsIgnoringPrivateKey(name, expected_name)); |
3226 #endif | 3224 #endif |
3227 } | 3225 } |
3228 | 3226 |
3229 } // namespace dart | 3227 } // namespace dart |
OLD | NEW |