return get_signal_canonical_constant (sig);
}
- if (detail_expr.value_type is NullType || !detail_expr.value_type.compatible (string_type)) {
- node.error = true;
- Report.error (detail_expr.source_reference, "only string details are supported");
- return null;
- }
-
if (detail_expr is StringLiteral) {
return get_signal_canonical_constant (sig, ((StringLiteral) detail_expr).eval ());
}
}
private CCodeExpression? get_detail_cexpression (Expression detail_expr, CodeNode node) {
- if (detail_expr.value_type is NullType || !detail_expr.value_type.compatible (string_type)) {
- node.error = true;
- Report.error (detail_expr.source_reference, "only string details are supported");
- return null;
- }
-
var detail_cexpr = get_cvalue (detail_expr);
CCodeFunctionCall detail_ccall;
if (is_constant_ccode_expression (detail_cexpr)) {
}
public override void visit_signal (Signal sig) {
- // parent_symbol may be null for dynamic signals
-
- var cl = sig.parent_symbol as Class;
- if (cl != null && cl.is_compact) {
- sig.error = true;
- Report.error (sig.source_reference, "Signals are not supported in compact classes");
- return;
- }
-
- if (cl != null) {
- foreach (DataType base_type in cl.get_base_types ()) {
- if (SemanticAnalyzer.symbol_lookup_inherited (base_type.data_type, sig.name) is Signal) {
- sig.error = true;
- Report.error (sig.source_reference, "Signals with the same name as a signal in a base type are not supported");
- return;
- }
- }
- }
-
if (signal_enum != null && sig.parent_symbol is TypeSymbol) {
signal_enum.add_value (new CCodeEnumValue ("%s_%s_SIGNAL".printf (get_ccode_upper_case_name ((TypeSymbol) sig.parent_symbol), get_ccode_upper_case_name (sig))));
}
Report.error (source_reference, "Element access with more than one dimension is not supported for signals");
return false;
}
- get_indices ().get (0).target_type = context.analyzer.string_type.copy ();
+
+ var detail_expr = get_indices ().get (0);
+ detail_expr.target_type = context.analyzer.string_type.copy ();
+ detail_expr.check (context);
+
+ if (detail_expr.value_type is NullType || !detail_expr.value_type.compatible (context.analyzer.string_type)) {
+ error = true;
+ Report.error (detail_expr.source_reference, "only string details are supported");
+ return false;
+ }
}
foreach (Expression index in get_indices ()) {
checked = true;
+ // parent_symbol may be null for dynamic signals
+ var parent_cl = parent_symbol as Class;
+ if (parent_cl != null && parent_cl.is_compact) {
+ error = true;
+ Report.error (source_reference, "Signals are not supported in compact classes");
+ return false;
+ }
+
+ if (parent_cl != null) {
+ foreach (DataType base_type in parent_cl.get_base_types ()) {
+ if (SemanticAnalyzer.symbol_lookup_inherited (base_type.data_type, name) is Signal) {
+ error = true;
+ Report.error (source_reference, "Signals with the same name as a signal in a base type are not supported");
+ return false;
+ }
+ }
+ }
+
+ if (this is DynamicSignal) {
+ return !error;
+ }
+
return_type.check (context);
foreach (Parameter param in parameters) {