public HlFunctionDefinition( string name, HlTypeDefinition returnType, HlTypeDefinition[] parameters, IHlToken[] mods) : base(name, mods) { ReturnType = returnType; ParameterTypes = parameters; }
public void Finalize(HlCompilation compilation) { m_Types = new List <HlTypeDefinition>(); foreach (IHlToken baseType in m_BaseTypes) { HlTypeDefinition def = compilation.TypeSystem.GetType(compilation.Root, baseType.ToString()); m_Types.Add(def); } }
public ArrayTypeDefintion(HlNamespace root, HlTypeDefinition elementType, uint size) : base( root, elementType.Name + "[]", true, false, false ) { Size = size; ElementType = elementType; }
public string GetFinalStaticProperty(string name) { if (m_Members.All(x => x.Name != name)) { HlTypeDefinition tdef = m_Types.First(x => x.HasMember(name)); return(tdef.GetFinalStaticProperty(name)); } return($"SFLD_{Name}_{name}"); }
public string GetFinalDynamicProperty(string name) { if (m_Members.All(x => x.Name != name)) { HlTypeDefinition tdef = m_Types.First(x => x.HasMember(name)); return(tdef.GetFinalDynamicProperty(name)); } HlMemberDefinition mdef = GetPrivateOrPublicMember(name); string prefix = mdef.IsAbstract ? "ADFLD_" : mdef.IsVirtual ? "VDFLD_" : "DFLD_"; return($"{prefix}_{Name}_{name}"); }
public static HlMemberDefinition RecursiveGetPublicMember(HlTypeDefinition start, int current, string[] parts) { HlMemberDefinition ret = start.GetPublicMember(parts[current]); if (current == parts.Length - 1) { return(ret); } return(RecursiveGetPublicMember( start.GetType(start.GetPublicMember(parts[current])), current + 1, parts )); }
public static uint RecursiveGetOffset(HlTypeDefinition start, uint value, int current, string[] parts) { uint ret = value + start.GetOffset(parts[current]); if (current == parts.Length - 1) { return(ret); } return(RecursiveGetOffset( start.GetType(start.GetPrivateOrPublicMember(parts[current])), ret, current + 1, parts )); }
public HlMemberDefinition GetPublicMember(string memberName) { HlMemberDefinition ret = m_Members.FirstOrDefault(x => x.IsPublic && x.Name == memberName); if (ret == null) { HlTypeDefinition def = m_Types.FirstOrDefault(x => x.HasMember(memberName)); if (def != null) { return(def.GetPublicMember(memberName)); } EventManager <ErrorEvent> .SendEvent(new HlMemberNotFoundEvent( this, memberName )); } return(ret); }
public HlPropertyDefinition( string name, HlTypeDefinition type, IHlToken[] mods ) : base( name, mods ) { PropertyType = type; }