if (variable_type is VoidType) {
error = true;
Report.error (source_reference, "'void' not supported as variable type");
- return false;
- }
- if (!variable_type.check (context)) {
+ } else if (!variable_type.check (context)) {
error = true;
- return false;
}
if (!external_package) {
context.analyzer.check_type (variable_type);
bool is_initializer_list = false;
int initializer_size = -1;
- if (initializer != null) {
+ if (initializer != null && !error) {
initializer.target_type = variable_type;
if (initializer is InitializerList) {
if (!initializer.check (context)) {
error = true;
- return false;
}
}
+ // local variables are defined even on errors
+ context.analyzer.current_symbol.scope.add (name, this);
+
+ if (error) {
+ return false;
+ }
+
if (variable_type is VarType) {
/* var type */
}
}
- context.analyzer.current_symbol.scope.add (name, this);
-
// current_symbol is a Method if this is the `result'
// variable used for postconditions
unowned Block? block = context.analyzer.current_symbol as Block;
Report.error (source_reference, "The name `%s' does not exist in the context of `%s'%s".printf (member_name, base_type_name, base_type_package));
return false;
+ } else if (symbol_reference.error) {
+ //ignore previous error
+ error = true;
+ return false;
}
unowned Symbol? member = symbol_reference;