Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(78)

Side by Side Diff: runtime/vm/object_test.cc

Issue 2723643002: Properly handle instantiator when allocating or cloning closure instance. (Closed)
Patch Set: Created 3 years, 9 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
« no previous file with comments | « runtime/vm/object.cc ('k') | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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 "platform/globals.h" 5 #include "platform/globals.h"
6 6
7 #include "vm/assembler.h" 7 #include "vm/assembler.h"
8 #include "vm/class_finalizer.h" 8 #include "vm/class_finalizer.h"
9 #include "vm/dart_api_impl.h" 9 #include "vm/dart_api_impl.h"
10 #include "vm/dart_entry.h" 10 #include "vm/dart_entry.h"
(...skipping 2601 matching lines...) Expand 10 before | Expand all | Expand 10 after
2612 parent = 2612 parent =
2613 Function::New(parent_name, RawFunction::kRegularFunction, false, false, 2613 Function::New(parent_name, RawFunction::kRegularFunction, false, false,
2614 false, false, false, cls, TokenPosition::kMinSource); 2614 false, false, false, cls, TokenPosition::kMinSource);
2615 functions.SetAt(0, parent); 2615 functions.SetAt(0, parent);
2616 cls.SetFunctions(functions); 2616 cls.SetFunctions(functions);
2617 2617
2618 Function& function = Function::Handle(); 2618 Function& function = Function::Handle();
2619 const String& function_name = String::Handle(Symbols::New(thread, "foo")); 2619 const String& function_name = String::Handle(Symbols::New(thread, "foo"));
2620 function = Function::NewClosureFunction(function_name, parent, 2620 function = Function::NewClosureFunction(function_name, parent,
2621 TokenPosition::kMinSource); 2621 TokenPosition::kMinSource);
2622 const Closure& closure = Closure::Handle(Closure::New(function, context)); 2622 const Closure& closure =
2623 Closure::Handle(Closure::New(TypeArguments::Handle(), function, context));
2623 const Class& closure_class = Class::Handle(closure.clazz()); 2624 const Class& closure_class = Class::Handle(closure.clazz());
2624 EXPECT_EQ(closure_class.id(), kClosureCid); 2625 EXPECT_EQ(closure_class.id(), kClosureCid);
2625 const Function& closure_function = Function::Handle(closure.function()); 2626 const Function& closure_function = Function::Handle(closure.function());
2626 EXPECT_EQ(closure_function.raw(), function.raw()); 2627 EXPECT_EQ(closure_function.raw(), function.raw());
2627 const Context& closure_context = Context::Handle(closure.context()); 2628 const Context& closure_context = Context::Handle(closure.context());
2628 EXPECT_EQ(closure_context.raw(), context.raw()); 2629 EXPECT_EQ(closure_context.raw(), context.raw());
2629 } 2630 }
2630 2631
2631 2632
2632 ISOLATE_UNIT_TEST_CASE(ObjectPrinting) { 2633 ISOLATE_UNIT_TEST_CASE(ObjectPrinting) {
(...skipping 2072 matching lines...) Expand 10 before | Expand all | Expand 10 after
4705 // utf32->utf16 conversion. 4706 // utf32->utf16 conversion.
4706 int32_t char_codes[] = {0, 0x0a, 0x0d, 0x7f, 0xff, 4707 int32_t char_codes[] = {0, 0x0a, 0x0d, 0x7f, 0xff,
4707 0xffff, 0xd800, 0xdc00, 0xdbff, 0xdfff}; 4708 0xffff, 0xd800, 0xdc00, 0xdbff, 0xdfff};
4708 4709
4709 const String& str = 4710 const String& str =
4710 String::Handle(String::FromUTF32(char_codes, ARRAY_SIZE(char_codes))); 4711 String::Handle(String::FromUTF32(char_codes, ARRAY_SIZE(char_codes)));
4711 EXPECT(str.Equals(char_codes, ARRAY_SIZE(char_codes))); 4712 EXPECT(str.Equals(char_codes, ARRAY_SIZE(char_codes)));
4712 } 4713 }
4713 4714
4714 } // namespace dart 4715 } // namespace dart
OLDNEW
« no previous file with comments | « runtime/vm/object.cc ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698