[Gambas-user] Module is not static
benoit.minisini at gambas-basic.org
Tue Nov 29 08:12:00 CET 2022
Le 29/11/2022 à 08:04, BB a écrit :
> I'm reviving an old project, not used since Feb 2020, that re/generates
> the Gambas source code for some other project. (Essentially, like the
> Advanced/Format Code in the IDE but with a lot more, anyway...).
> But suddenly I have a module "Template" (that contains a set of public
> constants and that's all) that when I refer to it in my code generator I
> get errors like "_ERR: 'Template.ConstDec' is not static_".
> The top of the Template module looks like :
> ' Gambas module file
> ''' This module contains the code templates for all the code generated by the program.
> '==== Constants ====
> Public Const EventDec As String = "Event #NAME(#SIGNATURE) " '
> Public Const PropertyDec As String = "#STATIC Property #READONLY #NAME #ALIASES As #DATATYPE " '
> Public Const GlobalDec As String = "#STATIC #SCOPE #NAME As #AUTOCREATE #DATATYPE #DEFAULTVALUE " '
> Public Const ArrayDec As String = "#SCOPE #NAME As #AUTOCREATE #DATATYPE [ #DIMENSIONS ] " '
> *Public Const ConstDec As String = "#SCOPE Const #NAME As #DATATYPE =
> #VALUE " ' *
> Public Const StructDec As String = "Public Struct #NAME \n #STRUCTITEMS\n End Struct" '
> and a sample failing line is
> sCode = Replace(*Template.ConstDec*, "#SCOPE", IIf(Me.IsPrivate, "Private", "Public"))
> This worked fine two years ago. Any idea what I could be doing wrong?
Don't you have another 'Template' somewhere as a variable?
More information about the User