public UnitComposition(List <Unit> units) { Units = units; Types = DyType.GetAll(); Members = new FastList <string>(); MembersMap = new Dictionary <string, int>(); }
private CompilerError GetTypeHandle(string parent, string local, out int handle, out bool std) { handle = -1; std = false; if (parent == null) { handle = DyType.GetTypeCodeByName(local); } if (handle > -1) { std = true; return(CompilerError.None); } if (parent == null) { if (!TryGetType(local, out var ti)) { return(CompilerError.UndefinedType); } else { handle = (byte)ti.Unit.Handle | ti.TypeId << 8; return(CompilerError.None); } } else { if (!referencedUnits.TryGetValue(parent, out var ui)) { return(CompilerError.UndefinedModule); } else { if (!TryGetExternalType(ui, local, out var id)) { return(CompilerError.UndefinedType); } handle = (byte)ui.Handle | id << 8; return(CompilerError.None); } } }