Chromium Code Reviews| OLD | NEW |
|---|---|
| 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 6038 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 6049 instructions += TranslateExpression(node->expression()); | 6049 instructions += TranslateExpression(node->expression()); |
| 6050 instructions += Return(TokenPosition::kNoSource); | 6050 instructions += Return(TokenPosition::kNoSource); |
| 6051 | 6051 |
| 6052 // Note: DropTempsInstr serves as an anchor instruction. It will not | 6052 // Note: DropTempsInstr serves as an anchor instruction. It will not |
| 6053 // be linked into the resulting graph. | 6053 // be linked into the resulting graph. |
| 6054 DropTempsInstr* anchor = new (Z) DropTempsInstr(0, NULL); | 6054 DropTempsInstr* anchor = new (Z) DropTempsInstr(0, NULL); |
| 6055 yield_continuations_.Add(YieldContinuation(anchor, CurrentTryIndex())); | 6055 yield_continuations_.Add(YieldContinuation(anchor, CurrentTryIndex())); |
| 6056 | 6056 |
| 6057 Fragment continuation(instructions.entry, anchor); | 6057 Fragment continuation(instructions.entry, anchor); |
| 6058 | 6058 |
| 6059 // TODO(27590): we need a better way to detect if we need to check for an | 6059 // TODO(27590): we need a better way to detect if we need to check for an |
|
Kevin Millikin (Google)
2017/02/22 07:59:59
If we set it correctly, can't we instead ask here
jensj
2017/02/22 10:36:45
That makes sence.
I've tried, and it seems to pass
| |
| 6060 // exception after yield or not. | 6060 // exception after yield or not. |
| 6061 if (parsed_function_->function().NumOptionalPositionalParameters() == 3) { | 6061 if (parsed_function_->function().NumOptionalPositionalParameters() == 3) { |
| 6062 // If function takes three parameters then the second and the third | 6062 // If function takes three parameters then the second and the third |
| 6063 // are exception and stack_trace. Check if exception is non-null | 6063 // are exception and stack_trace. Check if exception is non-null |
| 6064 // and rethrow it. | 6064 // and rethrow it. |
| 6065 // | 6065 // |
| 6066 // :async_op([:result, :exception, :stack_trace]) { | 6066 // :async_op([:result, :exception, :stack_trace]) { |
| 6067 // ... | 6067 // ... |
| 6068 // Continuation<index>: | 6068 // Continuation<index>: |
| 6069 // if (:exception != null) rethrow(:exception, :stack_trace); | 6069 // if (:exception != null) rethrow(:exception, :stack_trace); |
| (...skipping 55 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 6125 if (parent->IsFunctionExpression()) { | 6125 if (parent->IsFunctionExpression()) { |
| 6126 name = &Symbols::AnonymousClosure(); | 6126 name = &Symbols::AnonymousClosure(); |
| 6127 } else { | 6127 } else { |
| 6128 ASSERT(parent->IsFunctionDeclaration()); | 6128 ASSERT(parent->IsFunctionDeclaration()); |
| 6129 name = &H.DartSymbol( | 6129 name = &H.DartSymbol( |
| 6130 FunctionDeclaration::Cast(parent)->variable()->name()); | 6130 FunctionDeclaration::Cast(parent)->variable()->name()); |
| 6131 } | 6131 } |
| 6132 // NOTE: This is not TokenPosition in the general sense! | 6132 // NOTE: This is not TokenPosition in the general sense! |
| 6133 function = Function::NewClosureFunction( | 6133 function = Function::NewClosureFunction( |
| 6134 *name, parsed_function_->function(), position); | 6134 *name, parsed_function_->function(), position); |
| 6135 function.set_is_debuggable(node->debuggable()); | 6135 function.set_is_debuggable(node->original_async_marker() == |
|
Kevin Millikin (Google)
2017/02/22 07:59:59
Why not set the function to be correctly sync*/asy
jensj
2017/02/22 10:36:45
Done.
| |
| 6136 FunctionNode::kSync); | |
| 6136 function.set_end_token_pos(node->end_position()); | 6137 function.set_end_token_pos(node->end_position()); |
| 6137 LocalScope* scope = scopes_->function_scopes[i].scope; | 6138 LocalScope* scope = scopes_->function_scopes[i].scope; |
| 6138 const ContextScope& context_scope = | 6139 const ContextScope& context_scope = |
| 6139 ContextScope::Handle(Z, scope->PreserveOuterScope(context_depth_)); | 6140 ContextScope::Handle(Z, scope->PreserveOuterScope(context_depth_)); |
| 6140 function.set_context_scope(context_scope); | 6141 function.set_context_scope(context_scope); |
| 6141 function.set_kernel_function(node); | 6142 function.set_kernel_function(node); |
| 6142 KernelReader::SetupFunctionParameters(H, T, dart::Class::Handle(Z), | 6143 KernelReader::SetupFunctionParameters(H, T, dart::Class::Handle(Z), |
| 6143 function, node, | 6144 function, node, |
| 6144 false, // is_method | 6145 false, // is_method |
| 6145 true); // is_closure | 6146 true); // is_closure |
| (...skipping 135 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 6281 thread->clear_sticky_error(); | 6282 thread->clear_sticky_error(); |
| 6282 return error.raw(); | 6283 return error.raw(); |
| 6283 } | 6284 } |
| 6284 } | 6285 } |
| 6285 | 6286 |
| 6286 | 6287 |
| 6287 } // namespace kernel | 6288 } // namespace kernel |
| 6288 } // namespace dart | 6289 } // namespace dart |
| 6289 | 6290 |
| 6290 #endif // !defined(DART_PRECOMPILED_RUNTIME) | 6291 #endif // !defined(DART_PRECOMPILED_RUNTIME) |
| OLD | NEW |