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

Unified Diff: pkg/compiler/lib/src/ssa/kernel_ast_adapter.dart

Issue 2984783002: Fix and assert getLocalFunction invariant (Closed)
Patch Set: Created 3 years, 5 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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « pkg/compiler/lib/src/ssa/builder_kernel.dart ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: pkg/compiler/lib/src/ssa/kernel_ast_adapter.dart
diff --git a/pkg/compiler/lib/src/ssa/kernel_ast_adapter.dart b/pkg/compiler/lib/src/ssa/kernel_ast_adapter.dart
index 094e469713e1ecac982b382bcc3ebe8a16de4183..81ea469b63f6590501c0fc96417ae3b571d9c1ec 100644
--- a/pkg/compiler/lib/src/ssa/kernel_ast_adapter.dart
+++ b/pkg/compiler/lib/src/ssa/kernel_ast_adapter.dart
@@ -227,7 +227,13 @@ class KernelAstAdapter extends KernelToElementMapBaseMixin
LibraryElement getLibrary(ir.Library node) => getElement(node).declaration;
- LocalFunctionElement getLocalFunction(ir.TreeNode node) => getElement(node);
+ LocalFunctionElement getLocalFunction(ir.TreeNode node) {
+ assert(
+ node is ir.FunctionDeclaration || node is ir.FunctionExpression,
+ failedAt(
+ CURRENT_ELEMENT_SPANNABLE, 'Invalid local function node: $node'));
+ return getElement(node);
+ }
/// Returns the uri for the deferred import [node].
String getDeferredUri(ir.LibraryDependency node) {
« no previous file with comments | « pkg/compiler/lib/src/ssa/builder_kernel.dart ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698