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

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

Issue 2985293002: Add optional FunctionType.positionalParameterNames and use them to resynthesize function-type forma… (Closed)
Patch Set: Created 3 years, 4 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 "vm/kernel_binary_flowgraph.h" 5 #include "vm/kernel_binary_flowgraph.h"
6 6
7 #include "vm/compiler.h" 7 #include "vm/compiler.h"
8 #include "vm/longjump.h" 8 #include "vm/longjump.h"
9 #include "vm/object_store.h" 9 #include "vm/object_store.h"
10 10
(...skipping 1077 matching lines...) Expand 10 before | Expand all | Expand 10 after
1088 if (!simple) { 1088 if (!simple) {
1089 const intptr_t named_count = 1089 const intptr_t named_count =
1090 builder_->ReadListLength(); // read named_parameters list length. 1090 builder_->ReadListLength(); // read named_parameters list length.
1091 for (intptr_t i = 0; i < named_count; ++i) { 1091 for (intptr_t i = 0; i < named_count; ++i) {
1092 // read string reference (i.e. named_parameters[i].name). 1092 // read string reference (i.e. named_parameters[i].name).
1093 builder_->SkipStringReference(); 1093 builder_->SkipStringReference();
1094 VisitDartType(); // read named_parameters[i].type. 1094 VisitDartType(); // read named_parameters[i].type.
1095 } 1095 }
1096 } 1096 }
1097 1097
1098 builder_->SkipListOfStrings(); // read positional parameter names.
1098 VisitDartType(); // read return type. 1099 VisitDartType(); // read return type.
1099 } 1100 }
1100 1101
1101 void StreamingScopeBuilder::VisitTypeParameterType() { 1102 void StreamingScopeBuilder::VisitTypeParameterType() {
1102 Function& function = Function::Handle(Z, parsed_function_->function().raw()); 1103 Function& function = Function::Handle(Z, parsed_function_->function().raw());
1103 while (function.IsClosureFunction()) { 1104 while (function.IsClosureFunction()) {
1104 function = function.parent_function(); 1105 function = function.parent_function();
1105 } 1106 }
1106 1107
1107 if (function.IsFactory()) { 1108 if (function.IsFactory()) {
(...skipping 455 matching lines...) Expand 10 before | Expand all | Expand 10 after
1563 dart::String& name = H.DartSymbol(builder_->ReadStringReference()); 1564 dart::String& name = H.DartSymbol(builder_->ReadStringReference());
1564 BuildTypeInternal(); // read named_parameters[i].type. 1565 BuildTypeInternal(); // read named_parameters[i].type.
1565 if (result_.IsMalformed()) { 1566 if (result_.IsMalformed()) {
1566 result_ = AbstractType::dynamic_type().raw(); 1567 result_ = AbstractType::dynamic_type().raw();
1567 } 1568 }
1568 parameter_types.SetAt(pos, result_); 1569 parameter_types.SetAt(pos, result_);
1569 parameter_names.SetAt(pos, name); 1570 parameter_names.SetAt(pos, name);
1570 } 1571 }
1571 } 1572 }
1572 1573
1574 builder_->SkipListOfStrings(); // read positional parameter names.
1575
1573 BuildTypeInternal(); // read return type. 1576 BuildTypeInternal(); // read return type.
1574 if (result_.IsMalformed()) { 1577 if (result_.IsMalformed()) {
1575 result_ = AbstractType::dynamic_type().raw(); 1578 result_ = AbstractType::dynamic_type().raw();
1576 } 1579 }
1577 signature_function.set_result_type(result_); 1580 signature_function.set_result_type(result_);
1578 1581
1579 Type& signature_type = 1582 Type& signature_type =
1580 Type::ZoneHandle(Z, signature_function.SignatureType()); 1583 Type::ZoneHandle(Z, signature_function.SignatureType());
1581 1584
1582 if (finalize_) { 1585 if (finalize_) {
(...skipping 2213 matching lines...) Expand 10 before | Expand all | Expand 10 after
3796 if (!simple) { 3799 if (!simple) {
3797 const intptr_t named_count = 3800 const intptr_t named_count =
3798 ReadListLength(); // read named_parameters list length. 3801 ReadListLength(); // read named_parameters list length.
3799 for (intptr_t i = 0; i < named_count; ++i) { 3802 for (intptr_t i = 0; i < named_count; ++i) {
3800 // read string reference (i.e. named_parameters[i].name). 3803 // read string reference (i.e. named_parameters[i].name).
3801 SkipStringReference(); 3804 SkipStringReference();
3802 SkipDartType(); // read named_parameters[i].type. 3805 SkipDartType(); // read named_parameters[i].type.
3803 } 3806 }
3804 } 3807 }
3805 3808
3809 SkipListOfStrings(); // read positional parameter names.
3806 SkipDartType(); // read return type. 3810 SkipDartType(); // read return type.
3807 } 3811 }
3808 3812
3809 void StreamingFlowGraphBuilder::SkipListOfExpressions() { 3813 void StreamingFlowGraphBuilder::SkipListOfExpressions() {
3810 intptr_t list_length = ReadListLength(); // read list length. 3814 intptr_t list_length = ReadListLength(); // read list length.
3811 for (intptr_t i = 0; i < list_length; ++i) { 3815 for (intptr_t i = 0; i < list_length; ++i) {
3812 SkipExpression(); // read ith expression. 3816 SkipExpression(); // read ith expression.
3813 } 3817 }
3814 } 3818 }
3815 3819
3816 void StreamingFlowGraphBuilder::SkipListOfDartTypes() { 3820 void StreamingFlowGraphBuilder::SkipListOfDartTypes() {
3817 intptr_t list_length = ReadListLength(); // read list length. 3821 intptr_t list_length = ReadListLength(); // read list length.
3818 for (intptr_t i = 0; i < list_length; ++i) { 3822 for (intptr_t i = 0; i < list_length; ++i) {
3819 SkipDartType(); // read ith type. 3823 SkipDartType(); // read ith type.
3820 } 3824 }
3821 } 3825 }
3822 3826
3827 void StreamingFlowGraphBuilder::SkipListOfStrings() {
3828 intptr_t list_length = ReadListLength(); // read list length.
3829 for (intptr_t i = 0; i < list_length; ++i) {
3830 SkipStringReference(); // read ith string index.
3831 }
3832 }
3833
3823 void StreamingFlowGraphBuilder::SkipListOfVariableDeclarations() { 3834 void StreamingFlowGraphBuilder::SkipListOfVariableDeclarations() {
3824 intptr_t list_length = ReadListLength(); // read list length. 3835 intptr_t list_length = ReadListLength(); // read list length.
3825 for (intptr_t i = 0; i < list_length; ++i) { 3836 for (intptr_t i = 0; i < list_length; ++i) {
3826 SkipVariableDeclaration(); // read ith variable declaration. 3837 SkipVariableDeclaration(); // read ith variable declaration.
3827 } 3838 }
3828 } 3839 }
3829 3840
3830 void StreamingFlowGraphBuilder::SkipTypeParametersList() { 3841 void StreamingFlowGraphBuilder::SkipTypeParametersList() {
3831 intptr_t list_length = ReadListLength(); // read list length. 3842 intptr_t list_length = ReadListLength(); // read list length.
3832 for (intptr_t i = 0; i < list_length; ++i) { 3843 for (intptr_t i = 0; i < list_length; ++i) {
(...skipping 3438 matching lines...) Expand 10 before | Expand all | Expand 10 after
7271 } 7282 }
7272 } 7283 }
7273 7284
7274 return Array::Handle(Array::null()); 7285 return Array::Handle(Array::null());
7275 } 7286 }
7276 7287
7277 } // namespace kernel 7288 } // namespace kernel
7278 } // namespace dart 7289 } // namespace dart
7279 7290
7280 #endif // !defined(DART_PRECOMPILED_RUNTIME) 7291 #endif // !defined(DART_PRECOMPILED_RUNTIME)
OLDNEW
« pkg/kernel/lib/ast.dart ('K') | « runtime/vm/kernel_binary_flowgraph.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698