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

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

Issue 893193004: Propagate the stack trace of the inner-most throw when using async/await. (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: Created 5 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 | Annotate | Revision Log
« no previous file with comments | « runtime/vm/flow_graph_builder.cc ('k') | runtime/vm/symbols.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) 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 6
7 #include "lib/invocation_mirror.h" 7 #include "lib/invocation_mirror.h"
8 #include "platform/utils.h" 8 #include "platform/utils.h"
9 #include "vm/ast_transformer.h" 9 #include "vm/ast_transformer.h"
10 #include "vm/bootstrap.h" 10 #include "vm/bootstrap.h"
(...skipping 3053 matching lines...) Expand 10 before | Expand all | Expand 10 after
3064 func.IsGetterFunction() || 3064 func.IsGetterFunction() ||
3065 func.is_async_closure()); 3065 func.is_async_closure());
3066 const bool allow_explicit_default_values = true; 3066 const bool allow_explicit_default_values = true;
3067 if (func.IsGetterFunction()) { 3067 if (func.IsGetterFunction()) {
3068 // Populate function scope with the formal parameters. Since in this case 3068 // Populate function scope with the formal parameters. Since in this case
3069 // we are compiling a getter this will at most populate the receiver. 3069 // we are compiling a getter this will at most populate the receiver.
3070 AddFormalParamsToScope(&params, current_block_->scope); 3070 AddFormalParamsToScope(&params, current_block_->scope);
3071 } else if (func.is_async_closure()) { 3071 } else if (func.is_async_closure()) {
3072 // Async closures have two optional parameters: 3072 // Async closures have two optional parameters:
3073 // * A continuation result. 3073 // * A continuation result.
3074 // * A continuation error. 3074 // * A continuation error.
hausner 2015/02/04 16:47:33 Comment is now out of sync with the code.
3075 // 3075 //
3076 // If the error!=null we rethrow the error at the next await. 3076 // If the error!=null we rethrow the error at the next await.
3077 const Type& dynamic_type = Type::ZoneHandle(Z, Type::DynamicType()); 3077 const Type& dynamic_type = Type::ZoneHandle(Z, Type::DynamicType());
3078 ParamDesc result_param; 3078 ParamDesc result_param;
3079 result_param.name = &Symbols::AsyncOperationParam(); 3079 result_param.name = &Symbols::AsyncOperationParam();
3080 result_param.default_value = &Object::null_instance(); 3080 result_param.default_value = &Object::null_instance();
3081 result_param.type = &dynamic_type; 3081 result_param.type = &dynamic_type;
3082 ParamDesc error_param; 3082 ParamDesc error_param;
3083 error_param.name = &Symbols::AsyncOperationErrorParam(); 3083 error_param.name = &Symbols::AsyncOperationErrorParam();
3084 error_param.default_value = &Object::null_instance(); 3084 error_param.default_value = &Object::null_instance();
3085 error_param.type = &dynamic_type; 3085 error_param.type = &dynamic_type;
3086 ParamDesc stack_trace_param;
3087 stack_trace_param.name = &Symbols::AsyncOperationStackTraceParam();
3088 stack_trace_param.default_value = &Object::null_instance();
3089 stack_trace_param.type = &dynamic_type;
3086 params.parameters->Add(result_param); 3090 params.parameters->Add(result_param);
3087 params.parameters->Add(error_param); 3091 params.parameters->Add(error_param);
3088 params.num_optional_parameters += 2; 3092 params.parameters->Add(stack_trace_param);
3093 params.num_optional_parameters += 3;
3089 params.has_optional_positional_parameters = true; 3094 params.has_optional_positional_parameters = true;
3090 SetupDefaultsForOptionalParams(&params, default_parameter_values); 3095 SetupDefaultsForOptionalParams(&params, default_parameter_values);
3091 AddFormalParamsToScope(&params, current_block_->scope); 3096 AddFormalParamsToScope(&params, current_block_->scope);
3092 ASSERT(AbstractType::Handle(Z, func.result_type()).IsResolved()); 3097 ASSERT(AbstractType::Handle(Z, func.result_type()).IsResolved());
3093 ASSERT(func.NumParameters() == params.parameters->length()); 3098 ASSERT(func.NumParameters() == params.parameters->length());
3094 if (!Function::Handle(func.parent_function()).IsGetterFunction()) { 3099 if (!Function::Handle(func.parent_function()).IsGetterFunction()) {
3095 // Parse and discard any formal parameters. They are accessed as 3100 // Parse and discard any formal parameters. They are accessed as
3096 // context variables. 3101 // context variables.
3097 ParamList parse_away; 3102 ParamList parse_away;
3098 ParseFormalParameterList(allow_explicit_default_values, 3103 ParseFormalParameterList(allow_explicit_default_values,
(...skipping 2962 matching lines...) Expand 10 before | Expand all | Expand 10 after
6061 ParamDesc result_param; 6066 ParamDesc result_param;
6062 result_param.name = &Symbols::AsyncOperationParam(); 6067 result_param.name = &Symbols::AsyncOperationParam();
6063 result_param.default_value = &Object::null_instance(); 6068 result_param.default_value = &Object::null_instance();
6064 result_param.type = &dynamic_type; 6069 result_param.type = &dynamic_type;
6065 closure_params.parameters->Add(result_param); 6070 closure_params.parameters->Add(result_param);
6066 ParamDesc error_param; 6071 ParamDesc error_param;
6067 error_param.name = &Symbols::AsyncOperationErrorParam(); 6072 error_param.name = &Symbols::AsyncOperationErrorParam();
6068 error_param.default_value = &Object::null_instance(); 6073 error_param.default_value = &Object::null_instance();
6069 error_param.type = &dynamic_type; 6074 error_param.type = &dynamic_type;
6070 closure_params.parameters->Add(error_param); 6075 closure_params.parameters->Add(error_param);
6076 ParamDesc stack_trace_param;
6077 stack_trace_param.name = &Symbols::AsyncOperationStackTraceParam();
6078 stack_trace_param.default_value = &Object::null_instance();
6079 stack_trace_param.type = &dynamic_type;
6080 closure_params.parameters->Add(stack_trace_param);
6071 closure_params.has_optional_positional_parameters = true; 6081 closure_params.has_optional_positional_parameters = true;
6072 closure_params.num_optional_parameters += 2; 6082 closure_params.num_optional_parameters += 3;
6073 6083
6074 if (is_new_closure) { 6084 if (is_new_closure) {
6075 // Add the parameters to the newly created closure. 6085 // Add the parameters to the newly created closure.
6076 AddFormalParamsToFunction(&closure_params, closure); 6086 AddFormalParamsToFunction(&closure_params, closure);
6077 6087
6078 // Create and set the signature class of the closure. 6088 // Create and set the signature class of the closure.
6079 const String& sig = String::Handle(Z, closure.Signature()); 6089 const String& sig = String::Handle(Z, closure.Signature());
6080 Class& sig_cls = Class::Handle(Z, library_.LookupLocalClass(sig)); 6090 Class& sig_cls = Class::Handle(Z, library_.LookupLocalClass(sig));
6081 if (sig_cls.IsNull()) { 6091 if (sig_cls.IsNull()) {
6082 sig_cls = 6092 sig_cls =
(...skipping 6149 matching lines...) Expand 10 before | Expand all | Expand 10 after
12232 void Parser::SkipQualIdent() { 12242 void Parser::SkipQualIdent() {
12233 ASSERT(IsIdentifier()); 12243 ASSERT(IsIdentifier());
12234 ConsumeToken(); 12244 ConsumeToken();
12235 if (CurrentToken() == Token::kPERIOD) { 12245 if (CurrentToken() == Token::kPERIOD) {
12236 ConsumeToken(); // Consume the kPERIOD token. 12246 ConsumeToken(); // Consume the kPERIOD token.
12237 ExpectIdentifier("identifier expected after '.'"); 12247 ExpectIdentifier("identifier expected after '.'");
12238 } 12248 }
12239 } 12249 }
12240 12250
12241 } // namespace dart 12251 } // namespace dart
OLDNEW
« no previous file with comments | « runtime/vm/flow_graph_builder.cc ('k') | runtime/vm/symbols.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698