Index: runtime/vm/parser.cc |
diff --git a/runtime/vm/parser.cc b/runtime/vm/parser.cc |
index cb9c620101ec318ff2baffb48bf4f5a698cea49e..3d211a3891386329e687c8cae843c59e2a90a746 100644 |
--- a/runtime/vm/parser.cc |
+++ b/runtime/vm/parser.cc |
@@ -16,6 +16,7 @@ |
#include "vm/compiler_stats.h" |
#include "vm/dart_api_impl.h" |
#include "vm/dart_entry.h" |
+#include "vm/kernel_to_il.h" |
#include "vm/growable_array.h" |
#include "vm/handles.h" |
#include "vm/hash_table.h" |
@@ -225,6 +226,19 @@ void ParsedFunction::Bailout(const char* origin, const char* reason) const { |
} |
+kernel::ScopeBuildingResult* ParsedFunction::EnsureKernelScopes() { |
+ if (kernel_scopes_ == NULL) { |
+ kernel::TreeNode* node = NULL; |
+ if (function().kernel_function() != NULL) { |
+ node = static_cast<kernel::TreeNode*>(function().kernel_function()); |
+ } |
+ kernel::ScopeBuilder builder(this, node); |
+ kernel_scopes_ = builder.BuildScopes(); |
+ } |
+ return kernel_scopes_; |
+} |
+ |
+ |
LocalVariable* ParsedFunction::EnsureExpressionTemp() { |
if (!has_expression_temp_var()) { |
LocalVariable* temp = |
@@ -1592,10 +1606,13 @@ SequenceNode* Parser::ParseImplicitClosure(const Function& func) { |
&Object::dynamic_type()); |
ASSERT(func.num_fixed_parameters() == 2); // closure, value. |
} else if (!parent.IsGetterFunction() && !parent.IsImplicitGetterFunction()) { |
- const bool allow_explicit_default_values = true; |
- SkipFunctionPreamble(); |
- ParseFormalParameterList(allow_explicit_default_values, false, ¶ms); |
- SetupDefaultsForOptionalParams(params); |
+ // NOTE: For the `kernel -> flowgraph` we don't use the parser. |
+ if (parent.kernel_function() == NULL) { |
+ const bool allow_explicit_default_values = true; |
+ SkipFunctionPreamble(); |
+ ParseFormalParameterList(allow_explicit_default_values, false, ¶ms); |
+ SetupDefaultsForOptionalParams(params); |
+ } |
} |
// Populate function scope with the formal parameters. |
@@ -15015,6 +15032,12 @@ void ParsedFunction::AddToGuardedFields(const Field* field) const { |
} |
+kernel::ScopeBuildingResult* ParsedFunction::EnsureKernelScopes() { |
+ UNREACHABLE(); |
+ return NULL; |
+} |
+ |
+ |
LocalVariable* ParsedFunction::EnsureExpressionTemp() { |
UNREACHABLE(); |
return NULL; |