Skip to content
This repository was archived by the owner on Aug 31, 2021. It is now read-only.

Commit e32fd9f

Browse files
author
Monte Goulding
committed
now using optional and is_optional to check for non optional parameters after optional ones also resolved a typo \t\bool instead of \t\tbool
1 parent 1e5dd36 commit e32fd9f

2 files changed

Lines changed: 3 additions & 3 deletions

File tree

lcidlc/src/Interface.cpp

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -420,9 +420,9 @@ bool InterfaceDefineHandlerParameter(InterfaceRef self, Position p_where, Parame
420420
}
421421

422422
// RULE: No non-optional parameters after an optional one
423-
if (optional &&
423+
if (!optional &&
424424
t_variant -> parameter_count > 0 &&
425-
t_variant -> parameters[t_variant -> parameter_count - 1] . default_value != nil)
425+
t_variant -> parameters[t_variant -> parameter_count - 1] . is_optional)
426426
InterfaceReport(self, p_where, kInterfaceErrorParamAfterOptionalParam, nil);
427427

428428
if (!MCMemoryResizeArray(t_variant -> parameter_count + 1, t_variant -> parameters, t_variant -> parameter_count))

lcidlc/src/InterfaceGenerate.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -860,7 +860,7 @@ static bool InterfaceGenerateHandlers(InterfaceRef self, CoderRef p_coder)
860860
if (t_native_type != kNativeTypeEnum)
861861
CoderWriteLine(p_coder, "\t\tbool t_fetched = fetch__%s(\"%s\", argv[%d], param__%s);", NativeTypeGetTag(t_native_type), t_name, k, t_name);
862862
else
863-
CoderWriteLine(p_coder, "\t\bool t_fetched = fetchenum__%s(\"%s\", argv[%d], param__%s);", name_to_cname(t_parameter -> type), t_name, k, t_name);
863+
CoderWriteLine(p_coder, "\t\tbool t_fetched = fetchenum__%s(\"%s\", argv[%d], param__%s);", name_to_cname(t_parameter -> type), t_name, k, t_name);
864864
// optional parameters without a default value
865865
if (!t_parameter->is_optional)
866866
CoderWriteLine(p_coder, "\t\tsuccess = t_fetched;");

0 commit comments

Comments
 (0)