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

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

Issue 2696783002: Properly resolve upper bounds of generic function's type parameters. (Closed)
Patch Set: Created 3 years, 10 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/class_finalizer.cc ('k') | runtime/vm/object.h » ('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) 2016, the Dart project authors. Please see the AUTHORS file 1 // Copyright (c) 2016, 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/kernel_reader.h" 5 #include "vm/kernel_reader.h"
6 6
7 #include <string.h> 7 #include <string.h>
8 8
9 #include "vm/dart_api_impl.h" 9 #include "vm/dart_api_impl.h"
10 #include "vm/longjump.h" 10 #include "vm/longjump.h"
(...skipping 209 matching lines...) Expand 10 before | Expand all | Expand 10 after
220 TypeArguments::Handle(Z, TypeArguments::null()); 220 TypeArguments::Handle(Z, TypeArguments::null());
221 intptr_t num_type_parameters = kernel_klass->type_parameters().length(); 221 intptr_t num_type_parameters = kernel_klass->type_parameters().length();
222 if (num_type_parameters > 0) { 222 if (num_type_parameters > 0) {
223 dart::TypeParameter& parameter = dart::TypeParameter::Handle(Z); 223 dart::TypeParameter& parameter = dart::TypeParameter::Handle(Z);
224 Type& null_bound = Type::Handle(Z, Type::null()); 224 Type& null_bound = Type::Handle(Z, Type::null());
225 225
226 // Step a) Create array of [TypeParameter] objects (without bound). 226 // Step a) Create array of [TypeParameter] objects (without bound).
227 type_parameters = TypeArguments::New(num_type_parameters); 227 type_parameters = TypeArguments::New(num_type_parameters);
228 for (intptr_t i = 0; i < num_type_parameters; i++) { 228 for (intptr_t i = 0; i < num_type_parameters; i++) {
229 parameter = dart::TypeParameter::New( 229 parameter = dart::TypeParameter::New(
230 *klass, Function::Handle(Z), i, 230 *klass, Function::Handle(Z), i, 0,
231 H.DartSymbol(kernel_klass->type_parameters()[i]->name()), null_bound, 231 H.DartSymbol(kernel_klass->type_parameters()[i]->name()), null_bound,
232 TokenPosition::kNoSource); 232 TokenPosition::kNoSource);
233 type_parameters.SetTypeAt(i, parameter); 233 type_parameters.SetTypeAt(i, parameter);
234 } 234 }
235 klass->set_type_parameters(type_parameters); 235 klass->set_type_parameters(type_parameters);
236 236
237 // Step b) Fill in the bounds of all [TypeParameter]s. 237 // Step b) Fill in the bounds of all [TypeParameter]s.
238 for (intptr_t i = 0; i < num_type_parameters; i++) { 238 for (intptr_t i = 0; i < num_type_parameters; i++) {
239 TypeParameter* kernel_parameter = kernel_klass->type_parameters()[i]; 239 TypeParameter* kernel_parameter = kernel_klass->type_parameters()[i];
240 // TODO(github.com/dart-lang/kernel/issues/42): This should be handled 240 // TODO(github.com/dart-lang/kernel/issues/42): This should be handled
(...skipping 548 matching lines...) Expand 10 before | Expand all | Expand 10 after
789 initializer_fun.set_is_debuggable(false); 789 initializer_fun.set_is_debuggable(false);
790 initializer_fun.set_is_reflectable(false); 790 initializer_fun.set_is_reflectable(false);
791 initializer_fun.set_is_inlinable(false); 791 initializer_fun.set_is_inlinable(false);
792 return new (zone) ParsedFunction(thread, initializer_fun); 792 return new (zone) ParsedFunction(thread, initializer_fun);
793 } 793 }
794 794
795 795
796 } // namespace kernel 796 } // namespace kernel
797 } // namespace dart 797 } // namespace dart
798 #endif // !defined(DART_PRECOMPILED_RUNTIME) 798 #endif // !defined(DART_PRECOMPILED_RUNTIME)
OLDNEW
« no previous file with comments | « runtime/vm/class_finalizer.cc ('k') | runtime/vm/object.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698