Browse Source

Array type handling added to builtin-types handling

constants
Tristan B. V. Kildaire 7 months ago
parent
commit
f9a8590604
  1. 28
      source/tlang/compiler/symbols/typing/builtins.d

28
source/tlang/compiler/symbols/typing/builtins.d

@ -64,29 +64,41 @@ public Type getBuiltInType(TypeChecker tc, string typeString)
return new Integer("ubyte", 1, false);
}
/**
* FIXME: For the below we need to find which is the RIGHT-MOST and THEN
* go from there
*
* This is so that we can support things such as:
*
* `char*[]`
*/
/* Pointer handling `<type>*` */
else if(lastIndexOf(typeString, "*") > -1)
{
/* FIXME: We may need to recurse call, for Pointer generation */
long ptrTypePos = lastIndexOf(typeString, "*");
string ptrType = typeString[0..(ptrTypePos)];
gprintln("Pointer to '"~ptrType~"'");
return new Pointer(tc.getType(tc.getModule(), ptrType));
}
/* Array handling `<type>[]` */
else if(lastIndexOf(typeString, "[]") > -1)
{
long arrayTypePos = lastIndexOf(typeString, "[]");
string arrayType = typeString[0..(arrayTypePos)];
gprintln("Array of '"~arrayType~"'");
return new Array(tc.getType(tc.getModule(), arrayType));
}
/* TODO: Add all remaining types, BUGS probabloy occur on failed looks ups when hitting this */
/* If unknown, return null */
else
{
/* If it contains a `[]` then its an array type */
if(indexOf(typeString, "[]") > -1)
{
/* FIXME: Implement me */
}

Loading…
Cancel
Save