summary |
shortlog |
log |
commit | commitdiff |
tree
raw |
patch |
inline | side by side (from parent 1:
617cc1d)
The type may be determined at the same place as the declaration, yet
still not be explicit. To ensure correct output when printing code,
record what was found.
Signed-off-by: NeilBrown <neil@brown.name>
When a variable is used, we need to remember to follow the `->merged`
link to find the primary instance.
When a variable is used, we need to remember to follow the `->merged`
link to find the primary instance.
+When a variable is declared, it may or may not be given an explicit
+type. We need to record which so that we can report the parsed code
+correctly.
+
+###### variable fields
+ int explicit_type;
+
###### Grammar
$TERM : ::
###### Grammar
$TERM : ::
v->where_decl = $0;
v->where_set = $0;
v->type = $<Type;
v->where_decl = $0;
v->where_set = $0;
v->type = $<Type;
} else {
v = var_ref(c, $1.txt);
$0->var = v;
} else {
v = var_ref(c, $1.txt);
$0->var = v;
v->where_set = $0;
v->type = $<Type;
v->constant = 1;
v->where_set = $0;
v->type = $<Type;
v->constant = 1;
} else {
v = var_ref(c, $1.txt);
$0->var = v;
} else {
v = var_ref(c, $1.txt);
$0->var = v;
print_exec(b->left, indent, bracket);
if (cast(var, b->left)->var->constant) {
printf("::");
print_exec(b->left, indent, bracket);
if (cast(var, b->left)->var->constant) {
printf("::");
- if (v->where_decl == v->where_set) {
+ if (v->explicit_type) {
type_print(v->type, stdout);
printf(" ");
}
} else {
printf(":");
type_print(v->type, stdout);
printf(" ");
}
} else {
printf(":");
- if (v->where_decl == v->where_set) {
+ if (v->explicit_type) {
type_print(v->type, stdout);
printf(" ");
}
type_print(v->type, stdout);
printf(" ");
}