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

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

Issue 2359543003: Make sure unresolved function type parameter bounds do not end up in snapshot. (Closed)
Patch Set: address Siva/s comments Created 4 years, 3 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') | runtime/vm/raw_object_snapshot.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/parser.h" 5 #include "vm/parser.h"
6 #include "vm/flags.h" 6 #include "vm/flags.h"
7 7
8 #ifndef DART_PRECOMPILED_RUNTIME 8 #ifndef DART_PRECOMPILED_RUNTIME
9 9
10 #include "lib/invocation_mirror.h" 10 #include "lib/invocation_mirror.h"
(...skipping 2126 matching lines...) Expand 10 before | Expand all | Expand 10 after
2137 &Object::dynamic_type()); 2137 &Object::dynamic_type());
2138 2138
2139 const bool no_explicit_default_values = false; 2139 const bool no_explicit_default_values = false;
2140 ParseFormalParameterList(no_explicit_default_values, false, &func_params); 2140 ParseFormalParameterList(no_explicit_default_values, false, &func_params);
2141 2141
2142 signature_function.set_result_type(result_type); 2142 signature_function.set_result_type(result_type);
2143 AddFormalParamsToFunction(&func_params, signature_function); 2143 AddFormalParamsToFunction(&func_params, signature_function);
2144 2144
2145 ASSERT(innermost_function().raw() == signature_function.raw()); 2145 ASSERT(innermost_function().raw() == signature_function.raw());
2146 innermost_function_ = signature_function.parent_function(); 2146 innermost_function_ = signature_function.parent_function();
2147 signature_function.set_data(Object::Handle()); 2147 signature_function.set_data(Object::Handle(Z));
2148 2148
2149 Type& signature_type = 2149 Type& signature_type =
2150 Type::ZoneHandle(Z, signature_function.SignatureType()); 2150 Type::ZoneHandle(Z, signature_function.SignatureType());
2151 if (!is_top_level_) { 2151 if (!is_top_level_) {
2152 signature_type ^= ClassFinalizer::FinalizeType( 2152 signature_type ^= ClassFinalizer::FinalizeType(
2153 current_class(), signature_type, ClassFinalizer::kCanonicalize); 2153 current_class(), signature_type, ClassFinalizer::kCanonicalize);
2154 signature_function.SetSignatureType(signature_type); 2154 signature_function.SetSignatureType(signature_type);
2155 } 2155 }
2156 ASSERT(is_top_level_ || signature_type.IsFinalized()); 2156 ASSERT(is_top_level_ || signature_type.IsFinalized());
2157 // A signature type itself cannot be malformed or malbounded, only its 2157 // A signature type itself cannot be malformed or malbounded, only its
(...skipping 3316 matching lines...) Expand 10 before | Expand all | Expand 10 after
5474 } 5474 }
5475 if ((CurrentToken() == Token::kEXTENDS) || 5475 if ((CurrentToken() == Token::kEXTENDS) ||
5476 (!parameterizing_class && (CurrentToken() == Token::kSUPER))) { 5476 (!parameterizing_class && (CurrentToken() == Token::kSUPER))) {
5477 ConsumeToken(); 5477 ConsumeToken();
5478 // TODO(regis): Handle 'super' differently than 'extends'. 5478 // TODO(regis): Handle 'super' differently than 'extends'.
5479 // A bound may refer to the owner of the type parameter it applies to, 5479 // A bound may refer to the owner of the type parameter it applies to,
5480 // i.e. to the class or function currently being parsed. 5480 // i.e. to the class or function currently being parsed.
5481 // Postpone resolution in order to avoid resolving the owner and its 5481 // Postpone resolution in order to avoid resolving the owner and its
5482 // type parameters, as they are not fully parsed yet. 5482 // type parameters, as they are not fully parsed yet.
5483 type_parameter_bound = ParseType(ClassFinalizer::kDoNotResolve); 5483 type_parameter_bound = ParseType(ClassFinalizer::kDoNotResolve);
5484 if (!parameterizing_class) {
5485 // TODO(regis): Resolve and finalize function type parameter bounds in
5486 // class finalizer. For now, ignore parsed bounds to avoid unresolved
5487 // bounds while writing snapshots.
5488 type_parameter_bound = I->object_store()->object_type();
5489 }
5484 } else { 5490 } else {
5485 type_parameter_bound = I->object_store()->object_type(); 5491 type_parameter_bound = I->object_store()->object_type();
5486 } 5492 }
5487 type_parameter = TypeParameter::New( 5493 type_parameter = TypeParameter::New(
5488 parameterizing_class ? current_class() : Class::Handle(Z), 5494 parameterizing_class ? current_class() : Class::Handle(Z),
5489 parameterizing_class ? Function::Handle(Z) : innermost_function(), 5495 parameterizing_class ? Function::Handle(Z) : innermost_function(),
5490 index, 5496 index,
5491 type_parameter_name, 5497 type_parameter_name,
5492 type_parameter_bound, 5498 type_parameter_bound,
5493 declaration_pos); 5499 declaration_pos);
5500 if (!parameterizing_class) {
5501 // TODO(regis): Resolve and finalize function type parameter in
5502 // class finalizer. For now, already mark as finalized.
5503 type_parameter.SetIsFinalized();
5504 }
5494 type_parameters_array.Add( 5505 type_parameters_array.Add(
5495 &AbstractType::ZoneHandle(Z, type_parameter.raw())); 5506 &AbstractType::ZoneHandle(Z, type_parameter.raw()));
5496 if (FLAG_enable_mirrors && metadata_pos.IsReal()) { 5507 if (FLAG_enable_mirrors && metadata_pos.IsReal()) {
5497 library_.AddTypeParameterMetadata(type_parameter, metadata_pos); 5508 library_.AddTypeParameterMetadata(type_parameter, metadata_pos);
5498 } 5509 }
5499 index++; 5510 index++;
5500 } while (CurrentToken() == Token::kCOMMA); 5511 } while (CurrentToken() == Token::kCOMMA);
5501 Token::Kind token = CurrentToken(); 5512 Token::Kind token = CurrentToken();
5502 if ((token == Token::kGT) || (token == Token::kSHR)) { 5513 if ((token == Token::kGT) || (token == Token::kSHR)) {
5503 ConsumeRightAngleBracket(); 5514 ConsumeRightAngleBracket();
(...skipping 9598 matching lines...) Expand 10 before | Expand all | Expand 10 after
15102 const ArgumentListNode& function_args, 15113 const ArgumentListNode& function_args,
15103 const LocalVariable* temp_for_last_arg, 15114 const LocalVariable* temp_for_last_arg,
15104 bool is_super_invocation) { 15115 bool is_super_invocation) {
15105 UNREACHABLE(); 15116 UNREACHABLE();
15106 return NULL; 15117 return NULL;
15107 } 15118 }
15108 15119
15109 } // namespace dart 15120 } // namespace dart
15110 15121
15111 #endif // DART_PRECOMPILED_RUNTIME 15122 #endif // DART_PRECOMPILED_RUNTIME
OLDNEW
« no previous file with comments | « runtime/vm/object.cc ('k') | runtime/vm/raw_object_snapshot.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698