public static bool IsBaseClass(this ASTRecord record) { if (!record.GetParent(out Class decl)) { return(false); } return(record.Object is Class recordDecl && recordDecl == decl.BaseClass); }
public static bool IsEnumNestedInClass(this ASTRecord <Declaration> record) { var @enum = record.Value as Enumeration; var typedDecl = record.Value as ITypedDecl; if (@enum != null || (typedDecl?.Type?.TryGetEnum(out @enum)).GetValueOrDefault()) { return(@enum?.Namespace is Class); } return(false); }
public static bool IsBaseClass(this ASTRecord record) { Class decl; if (!record.GetParent(out decl)) { return(false); } var recordDecl = record.Object as Class; return(recordDecl != null && recordDecl == decl.BaseClass); }
public static bool IsFieldValueType(this ASTRecord record) { var ancestors = new Stack <object>(); if (!record.GetAncestors <Field>(ref ancestors)) { return(false); } var field = (Field)ancestors.Pop(); return(field.Type.Desugar().TryGetClass(out var decl) && decl.IsValueType); }
public static bool FunctionReturnsClassByValue(this ASTRecord record) { var ancestors = new Stack <object>(); if (!record.GetAncestors <Function>(ref ancestors)) { return(false); } var function = (Function)ancestors.Pop(); var tagType = function.ReturnType.Type.Desugar() as TagType; return(tagType?.Declaration is Class); }
public ASTRecord <T> Push <T>(T value) { ASTRecord parent = null; if (recordStack.Count > 0) { parent = recordStack.Peek(); } var record = new ASTRecord <T>() { Parent = parent, Object = value }; recordStack.Push(record); return(record); }
public static bool IsFieldValueType(this ASTRecord record) { var ancestors = new Stack <object>(); if (!record.GetAncestors <Field>(ref ancestors)) { return(false); } var field = (Field)ancestors.Pop(); Class decl; if (!field.Type.Desugar().IsTagDecl(out decl)) { return(false); } return(decl.IsValueType); }
public static bool IsBaseClass(this ASTRecord record) { Class decl; return(record.GetParent(out decl) && decl.BaseClass == record.Object); }
public static bool IsDelegate(this ASTRecord record) { return(record.Object is TypedefDecl typedef && typedef.Type.GetPointee() is FunctionType); }
public static bool IsDelegate(this ASTRecord record) { var typedef = record.Object as TypedefDecl; return(typedef != null && typedef.Type.GetPointee() is FunctionType); }