compiler: no nil check needed for closure var dereferences
Add the "no nil check needed" annotation to the dereference operations
created in Parse::enclosing_var_reference (this is safe since the
closure object is under control of the compiler, and pointer fields in
it will always be non-nil).
Change-Id: I218f9e2226582792c7cbd5a26fe7a3d1cc2236f6
Reviewed-on: https://go-review.googlesource.com/81795
Reviewed-by: Cherry Zhang <cherryyz@google.com>
Reviewed-by: Ian Lance Taylor <iant@golang.org>
diff --git a/go/parse.cc b/go/parse.cc
index be6f3f1..98f3067 100644
--- a/go/parse.cc
+++ b/go/parse.cc
@@ -2747,7 +2747,7 @@
location);
closure_ref =
Expression::make_dereference(closure_ref,
- Expression::NIL_CHECK_DEFAULT,
+ Expression::NIL_CHECK_NOT_NEEDED,
location);
// The closure structure holds pointers to the variables, so we need
@@ -2755,7 +2755,8 @@
Expression* e = Expression::make_field_reference(closure_ref,
ins.first->index(),
location);
- e = Expression::make_dereference(e, Expression::NIL_CHECK_DEFAULT, location);
+ e = Expression::make_dereference(e, Expression::NIL_CHECK_NOT_NEEDED,
+ location);
return Expression::make_enclosing_var_reference(e, var, location);
}