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

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

Issue 2606993002: Second try: Fix resolution and canonicalization of typedefs and function types (Closed)
Patch Set: Created 3 years, 11 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
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 <map> 5 #include <map>
6 #include <set> 6 #include <set>
7 #include <string> 7 #include <string>
8 8
9 #include "vm/kernel_to_il.h" 9 #include "vm/kernel_to_il.h"
10 10
(...skipping 3935 matching lines...) Expand 10 before | Expand all | Expand 10 after
3946 void DartTypeTranslator::VisitFunctionType(FunctionType* node) { 3946 void DartTypeTranslator::VisitFunctionType(FunctionType* node) {
3947 // The spec describes in section "19.1 Static Types": 3947 // The spec describes in section "19.1 Static Types":
3948 // 3948 //
3949 // Any use of a malformed type gives rise to a static warning. A 3949 // Any use of a malformed type gives rise to a static warning. A
3950 // malformed type is then interpreted as dynamic by the static type 3950 // malformed type is then interpreted as dynamic by the static type
3951 // checker and the runtime unless explicitly specified otherwise. 3951 // checker and the runtime unless explicitly specified otherwise.
3952 // 3952 //
3953 // So we convert malformed return/parameter types to `dynamic`. 3953 // So we convert malformed return/parameter types to `dynamic`.
3954 TypeParameterScope scope(this, &node->type_parameters()); 3954 TypeParameterScope scope(this, &node->type_parameters());
3955 3955
3956 const Function& signature_function = Function::ZoneHandle( 3956 Function& signature_function = Function::ZoneHandle(
3957 Z, Function::NewSignatureFunction(*active_class_->klass, 3957 Z, Function::NewSignatureFunction(*active_class_->klass,
3958 TokenPosition::kNoSource)); 3958 TokenPosition::kNoSource));
3959 3959
3960 node->return_type()->AcceptDartTypeVisitor(this); 3960 node->return_type()->AcceptDartTypeVisitor(this);
3961 if (result_.IsMalformed()) { 3961 if (result_.IsMalformed()) {
3962 result_ = AbstractType::dynamic_type().raw(); 3962 result_ = AbstractType::dynamic_type().raw();
3963 } 3963 }
3964 signature_function.set_result_type(result_); 3964 signature_function.set_result_type(result_);
3965 3965
3966 const intptr_t positional_count = node->positional_parameters().length(); 3966 const intptr_t positional_count = node->positional_parameters().length();
(...skipping 34 matching lines...) Expand 10 before | Expand all | Expand 10 after
4001 parameter_types.SetAt(pos, result_); 4001 parameter_types.SetAt(pos, result_);
4002 parameter_names.SetAt(pos, H.DartSymbol(tuple->first())); 4002 parameter_names.SetAt(pos, H.DartSymbol(tuple->first()));
4003 } 4003 }
4004 4004
4005 Type& signature_type = 4005 Type& signature_type =
4006 Type::ZoneHandle(Z, signature_function.SignatureType()); 4006 Type::ZoneHandle(Z, signature_function.SignatureType());
4007 4007
4008 if (finalize_) { 4008 if (finalize_) {
4009 signature_type ^= ClassFinalizer::FinalizeType( 4009 signature_type ^= ClassFinalizer::FinalizeType(
4010 *active_class_->klass, signature_type, ClassFinalizer::kCanonicalize); 4010 *active_class_->klass, signature_type, ClassFinalizer::kCanonicalize);
4011 // Do not refer to signature_function anymore, since it may have been
4012 // replaced during canonicalization.
4013 signature_function = Function::null();
4011 } 4014 }
4012 signature_function.SetSignatureType(signature_type);
regis 2016/12/28 22:12:18 This statement was setting the signature type on t
4013 4015
4014 result_ = signature_type.raw(); 4016 result_ = signature_type.raw();
4015 } 4017 }
4016 4018
4017 4019
4018 static intptr_t FindTypeParameterIndex(List<TypeParameter>* parameters, 4020 static intptr_t FindTypeParameterIndex(List<TypeParameter>* parameters,
4019 TypeParameter* param) { 4021 TypeParameter* param) {
4020 for (intptr_t i = 0; i < parameters->length(); i++) { 4022 for (intptr_t i = 0; i < parameters->length(); i++) {
4021 if (param == (*parameters)[i]) { 4023 if (param == (*parameters)[i]) {
4022 return i; 4024 return i;
(...skipping 1814 matching lines...) Expand 10 before | Expand all | Expand 10 after
5837 instructions += LoadLocal(parsed_function_->current_context_var()); 5839 instructions += LoadLocal(parsed_function_->current_context_var());
5838 instructions += StoreInstanceField(Closure::context_offset()); 5840 instructions += StoreInstanceField(Closure::context_offset());
5839 5841
5840 return instructions; 5842 return instructions;
5841 } 5843 }
5842 5844
5843 5845
5844 } // namespace kernel 5846 } // namespace kernel
5845 } // namespace dart 5847 } // namespace dart
5846 #endif // !defined(DART_PRECOMPILED_RUNTIME) 5848 #endif // !defined(DART_PRECOMPILED_RUNTIME)
OLDNEW
« no previous file with comments | « runtime/vm/isolate_reload.cc ('k') | runtime/vm/object.h » ('j') | runtime/vm/parser.cc » ('J')

Powered by Google App Engine
This is Rietveld 408576698