Hi,
I just realized that AngelScript considers an empty module as an error. The build function prints the TXT_NOTHING_WAS_BUILT
message to the message handler and returns the asERROR
error code.
However, IMHO an empty script (resp. a script which contains no code) is a totally valid use-case. Why should this be invalid? I don't know any other compiler or interpreter which considers an empty input file as an error ?
So, wouldn't it make more sense to remove this logic, i.e. don't output any message, and return asSUCCESS
instead? An alternative would be to return a specific error code like asEMPTY_MODULE
, then the user could decide whether this should be ignored or not.
Or is there any issue with modules containing no code? If there's no problem, I'd for now simply patch AngelScript in my application by removing this logic.
EDIT: Also note that a script containing a #include
statement is not an empty file from user perspective, but still the compilation fails because CScriptBuilder
removes that statement (well, it fails only if the included file does not contain any code…).