checked = true;
+ if (!context.experimental_non_null) {
+ // local reference variables are considered nullable
+ // except when using experimental non-null enhancements
+ if (variable_type is ReferenceType) {
+ var array_type = variable_type as ArrayType;
+ if (array_type != null && array_type.fixed_length) {
+ // local fixed length arrays are not nullable
+ } else {
+ variable_type.nullable = true;
+ }
+ }
+ }
+
if (variable_type != null) {
if (variable_type is VoidType) {
error = true;
* Code visitor resolving symbol names.
*/
public class Vala.SymbolResolver : CodeVisitor {
- CodeContext context;
Symbol root_symbol;
Scope current_scope;
* @param context a code context
*/
public void resolve (CodeContext context) {
- this.context = context;
root_symbol = context.root;
context.root.accept (this);
root_symbol = null;
- this.context = null;
}
public override void visit_namespace (Namespace ns) {
public override void visit_local_variable (LocalVariable local) {
local.accept_children (this);
- if (!context.experimental_non_null) {
- // local reference variables are considered nullable
- // except when using experimental non-null enhancements
- if (local.variable_type is ReferenceType) {
- var array_type = local.variable_type as ArrayType;
- if (array_type != null && array_type.fixed_length) {
- // local fixed length arrays are not nullable
- } else {
- local.variable_type.nullable = true;
- }
- }
- }
}
public override void visit_initializer_list (InitializerList list) {