Implemented static methods in String struct. Implemented String.Format and String.AppendFormat. Implemented native vararg methods for the future.
This commit is contained in:
parent
da3da61b67
commit
6f5fff00a0
14 changed files with 213 additions and 312 deletions
|
|
@ -722,7 +722,7 @@ type_name1(X) ::= BOOL(T). { X.Int = ZCC_Bool; X.SourceLoc = T.SourceLoc; }
|
|||
type_name1(X) ::= int_type(X).
|
||||
type_name1(X) ::= FLOAT(T). { X.Int = ZCC_FloatAuto; X.SourceLoc = T.SourceLoc; }
|
||||
type_name1(X) ::= DOUBLE(T). { X.Int = ZCC_Float64; X.SourceLoc = T.SourceLoc; }
|
||||
type_name1(X) ::= STRING(T). { X.Int = ZCC_String; X.SourceLoc = T.SourceLoc; }
|
||||
//type_name1(X) ::= STRING(T). { X.Int = ZCC_String; X.SourceLoc = T.SourceLoc; } // [ZZ] it's handled elsewhere. this particular line only causes troubles in the form of String.Format being invalid.
|
||||
type_name1(X) ::= VECTOR2(T). { X.Int = ZCC_Vector2; X.SourceLoc = T.SourceLoc; }
|
||||
type_name1(X) ::= VECTOR3(T). { X.Int = ZCC_Vector3; X.SourceLoc = T.SourceLoc; }
|
||||
type_name1(X) ::= NAME(T). { X.Int = ZCC_Name; X.SourceLoc = T.SourceLoc; }
|
||||
|
|
@ -994,6 +994,7 @@ decl_flag(X) ::= READONLY(T). { X.Int = ZCC_ReadOnly; X.SourceLoc = T.SourceLoc
|
|||
decl_flag(X) ::= DEPRECATED(T). { X.Int = ZCC_Deprecated; X.SourceLoc = T.SourceLoc; }
|
||||
decl_flag(X) ::= VIRTUAL(T). { X.Int = ZCC_Virtual; X.SourceLoc = T.SourceLoc; }
|
||||
decl_flag(X) ::= OVERRIDE(T). { X.Int = ZCC_Override; X.SourceLoc = T.SourceLoc; }
|
||||
decl_flag(X) ::= VARARG(T). { X.Int = ZCC_VarArg; X.SourceLoc = T.SourceLoc; }
|
||||
|
||||
func_const(X) ::= . { X.Int = 0; X.SourceLoc = stat->sc->GetMessageLine(); }
|
||||
func_const(X) ::= CONST(T). { X.Int = ZCC_FuncConst; X.SourceLoc = T.SourceLoc; }
|
||||
|
|
|
|||
|
|
@ -1423,10 +1423,11 @@ bool ZCCCompiler::CompileProperties(PClass *type, TArray<ZCC_Property *> &Proper
|
|||
|
||||
FString ZCCCompiler::FlagsToString(uint32_t flags)
|
||||
{
|
||||
const char *flagnames[] = { "native", "static", "private", "protected", "latent", "final", "meta", "action", "deprecated", "readonly", "funcconst", "abstract" };
|
||||
|
||||
const char *flagnames[] = { "native", "static", "private", "protected", "latent", "final", "meta", "action", "deprecated", "readonly", "funcconst", "abstract", "extension", "virtual", "override", "transient", "vararg" };
|
||||
FString build;
|
||||
|
||||
for (int i = 0; i < 12; i++)
|
||||
for (int i = 0; i < countof(flagnames); i++)
|
||||
{
|
||||
if (flags & (1 << i))
|
||||
{
|
||||
|
|
@ -2287,6 +2288,11 @@ void ZCCCompiler::CompileFunction(ZCC_StructWork *c, ZCC_FuncDeclarator *f, bool
|
|||
if (f->Flags & ZCC_Deprecated) varflags |= VARF_Deprecated;
|
||||
if (f->Flags & ZCC_Virtual) varflags |= VARF_Virtual;
|
||||
if (f->Flags & ZCC_Override) varflags |= VARF_Override;
|
||||
if (f->Flags & ZCC_VarArg) varflags |= VARF_VarArg;
|
||||
if ((f->Flags & ZCC_VarArg) && !(f->Flags & ZCC_Native))
|
||||
{
|
||||
Error(f, "'VarArg' can only be used with native methods");
|
||||
}
|
||||
if (f->Flags & ZCC_Action)
|
||||
{
|
||||
// Non-Actors cannot have action functions.
|
||||
|
|
|
|||
|
|
@ -136,6 +136,7 @@ static void InitTokenMap()
|
|||
TOKENDEF (TK_Protected, ZCC_PROTECTED);
|
||||
TOKENDEF (TK_Latent, ZCC_LATENT);
|
||||
TOKENDEF (TK_Virtual, ZCC_VIRTUAL);
|
||||
TOKENDEF (TK_VarArg, ZCC_VARARG);
|
||||
TOKENDEF (TK_Override, ZCC_OVERRIDE);
|
||||
TOKENDEF (TK_Final, ZCC_FINAL);
|
||||
TOKENDEF (TK_Meta, ZCC_META);
|
||||
|
|
|
|||
|
|
@ -36,6 +36,7 @@ enum
|
|||
ZCC_Virtual = 1 << 13,
|
||||
ZCC_Override = 1 << 14,
|
||||
ZCC_Transient = 1 << 15,
|
||||
ZCC_VarArg = 1 << 16
|
||||
};
|
||||
|
||||
// Function parameter modifiers
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue