public override void visit(Generated.Type obj, bool visitSubNodes) { Types.Type type = obj as Types.Type; if (type != null) { if (type is Types.StateMachine) { // Ignore state machines } else { if (!(type is Types.Structure) && !(type is Functions.Function)) { if (Utils.Utils.isEmpty(type.getDefault())) { type.AddError("Types should define their default value"); } else { if (type.DefaultValue == null) { type.AddError("Invalid default value"); } } if (type is Types.Range) { Types.Range range = type as Types.Range; if (range.getPrecision() == Generated.acceptor.PrecisionEnum.aIntegerPrecision && range.Default.IndexOf('.') > 0 || range.getPrecision() == Generated.acceptor.PrecisionEnum.aDoublePrecision && range.Default.IndexOf('.') <= 0) { type.AddError("Default value's precision does not correspond to the type's precision"); } foreach (Constants.EnumValue specValue in range.SpecialValues) { String value = specValue.getValue(); if (range.getPrecision() == Generated.acceptor.PrecisionEnum.aDoublePrecision && value.IndexOf('.') <= 0 || range.getPrecision() == Generated.acceptor.PrecisionEnum.aIntegerPrecision && value.IndexOf('.') > 0) { type.AddError("Precision of the special value + " + specValue.Name + " does not correspond to the type's precision"); } } } } if (declaredTypes.ContainsKey(type.FullName)) { declaredTypes[type.Name].AddError(TYPE_DECLARED_SEVERAL_TIMES); type.AddError(TYPE_DECLARED_SEVERAL_TIMES); } else { declaredTypes[type.Name] = type; } } } base.visit(obj, visitSubNodes); }
/// <summary> /// Cleans all text fields in this element /// </summary> /// <param name="obj"></param> /// <param name="visitSubNodes"></param> public override void visit(Generated.Type obj, bool visitSubNodes) { if (obj.getDefault() != null) { obj.setDefault(obj.getDefault().Trim()); } base.visit(obj, visitSubNodes); }
public override void visit(Generated.Type obj, bool subNodes) { currentSet.Add((Types.Type)obj); base.visit(obj, subNodes); }