public ES_StructData.Builder?GetStruct(ArrayPointer <byte> name) { CheckDisposed(); if (StructBuilders.TryGetValue(name, out var builder)) { return(builder); } return(null); }
public ES_TypeTag?CheckTypeExists(ArrayPointer <byte> name, ES_TypeTag?ignoredType) { if (ignoredType != ES_TypeTag.Class && ClassBuilders.TryGetValue(name, out var _)) { return(ES_TypeTag.Class); } if (ignoredType != ES_TypeTag.Struct && StructBuilders.TryGetValue(name, out var _)) { return(ES_TypeTag.Struct); } if (ignoredType != ES_TypeTag.Enum && EnumBuilders.TryGetValue(name, out var _)) { return(ES_TypeTag.Enum); } if (ignoredType != ES_TypeTag.Function && NamespaceData.functions.TryGetValue(name, out var _)) { return(ES_TypeTag.Function); } return(null); }
public ES_StructData.Builder GetOrCreateStruct(ES_AccessModifier accessMod, ArrayPointer <byte> name, ArrayPointer <byte> sourceUnit ) { CheckDisposed(); if (CheckTypeExists(name, ES_TypeTag.Struct) != null) { throw new CompilationException(ES_FrontendErrors.ClashingTypeExists); } if (StructBuilders.TryGetValue(name, out var builder)) { return(builder); } var structDataPtr = envBuilder.MemoryManager.GetMemory <ES_StructData> (); builder = new ES_StructData.Builder(structDataPtr, accessMod, new ES_FullyQualifiedName(NamespaceName, name), sourceUnit); StructBuilders.Add(name, builder); NamespaceData.types.Add(&structDataPtr->TypeInfo); return(builder); }