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

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

Issue 10797031: Add missing type finalization for function literals not assigned to a function (Closed) Base URL: http://dart.googlecode.com/svn/branches/bleeding_edge/dart/
Patch Set: Created 8 years, 5 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 | Annotate | Revision Log
« no previous file with comments | « runtime/vm/intermediate_language.cc ('k') | runtime/vm/parser.cc » ('j') | 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 "vm/object.h" 5 #include "vm/object.h"
6 6
7 #include "platform/assert.h" 7 #include "platform/assert.h"
8 #include "vm/assembler.h" 8 #include "vm/assembler.h"
9 #include "vm/bigint_operations.h" 9 #include "vm/bigint_operations.h"
10 #include "vm/bootstrap.h" 10 #include "vm/bootstrap.h"
(...skipping 1112 matching lines...) Expand 10 before | Expand all | Expand 10 after
1123 ASSERT(IsSignatureClass()); 1123 ASSERT(IsSignatureClass());
1124 const Function& function = Function::Handle(signature_function()); 1124 const Function& function = Function::Handle(signature_function());
1125 ASSERT(!function.IsNull()); 1125 ASSERT(!function.IsNull());
1126 if (function.signature_class() != raw()) { 1126 if (function.signature_class() != raw()) {
1127 // This class is a function type alias. Return the canonical signature type. 1127 // This class is a function type alias. Return the canonical signature type.
1128 const Class& canonical_class = Class::Handle(function.signature_class()); 1128 const Class& canonical_class = Class::Handle(function.signature_class());
1129 return canonical_class.SignatureType(); 1129 return canonical_class.SignatureType();
1130 } 1130 }
1131 // Return the first canonical signature type if already computed. 1131 // Return the first canonical signature type if already computed.
1132 const Array& signature_types = Array::Handle(canonical_types()); 1132 const Array& signature_types = Array::Handle(canonical_types());
1133 // The canonical_types array is initialized to the empty array.
1134 ASSERT(!signature_types.IsNull());
1133 if (signature_types.Length() > 0) { 1135 if (signature_types.Length() > 0) {
1136 // At most one signature type per signature class.
1137 ASSERT(signature_types.Length() == 1);
1134 Type& signature_type = Type::Handle(); 1138 Type& signature_type = Type::Handle();
1135 signature_type ^= signature_types.At(0); 1139 signature_type ^= signature_types.At(0);
1136 if (!signature_type.IsNull()) { 1140 ASSERT(!signature_type.IsNull());
1137 return signature_type.raw(); 1141 return signature_type.raw();
1138 }
1139 } 1142 }
1140 // A signature class extends class Instance and is parameterized in the same 1143 // A signature class extends class Instance and is parameterized in the same
1141 // way as the owner class of its non-static signature function. 1144 // way as the owner class of its non-static signature function.
1142 // It is not type parameterized if its signature function is static. 1145 // It is not type parameterized if its signature function is static.
1143 // See Class::NewSignatureClass() for the setup of its type parameters. 1146 // See Class::NewSignatureClass() for the setup of its type parameters.
1144 // During type finalization, the type arguments of the super class of the 1147 // During type finalization, the type arguments of the super class of the
1145 // owner class of its signature function will be prepended to the type 1148 // owner class of its signature function will be prepended to the type
1146 // argument vector. Therefore, we only need to set the type arguments 1149 // argument vector. Therefore, we only need to set the type arguments
1147 // matching the type parameters here. 1150 // matching the type parameters here.
1148 const TypeArguments& signature_type_arguments = 1151 const TypeArguments& signature_type_arguments =
(...skipping 9723 matching lines...) Expand 10 before | Expand all | Expand 10 after
10872 const String& str = String::Handle(pattern()); 10875 const String& str = String::Handle(pattern());
10873 const char* format = "JSRegExp: pattern=%s flags=%s"; 10876 const char* format = "JSRegExp: pattern=%s flags=%s";
10874 intptr_t len = OS::SNPrint(NULL, 0, format, str.ToCString(), Flags()); 10877 intptr_t len = OS::SNPrint(NULL, 0, format, str.ToCString(), Flags());
10875 char* chars = reinterpret_cast<char*>( 10878 char* chars = reinterpret_cast<char*>(
10876 Isolate::Current()->current_zone()->Allocate(len + 1)); 10879 Isolate::Current()->current_zone()->Allocate(len + 1));
10877 OS::SNPrint(chars, (len + 1), format, str.ToCString(), Flags()); 10880 OS::SNPrint(chars, (len + 1), format, str.ToCString(), Flags());
10878 return chars; 10881 return chars;
10879 } 10882 }
10880 10883
10881 } // namespace dart 10884 } // namespace dart
OLDNEW
« no previous file with comments | « runtime/vm/intermediate_language.cc ('k') | runtime/vm/parser.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698