private Type(CXType handle, TranslationUnit translationUnit) { Debug.Assert(translationUnit != null); Handle = handle; TranslationUnit = translationUnit; translationUnit.AddVisitedType(this); _canonicalType = new Lazy <Type>(() => translationUnit.GetOrCreateType(handle.CanonicalType, () => Create(handle.CanonicalType, translationUnit))); _elementType = new Lazy <Type>(() => translationUnit.GetOrCreateType(handle.ElementType, () => Create(handle.ElementType, translationUnit))); _modifierType = new Lazy <Type>(() => translationUnit.GetOrCreateType(handle.ModifierType, () => Create(handle.ModifierType, translationUnit))); _pointeeType = new Lazy <Type>(() => translationUnit.GetOrCreateType(handle.PointeeType, () => Create(handle.PointeeType, translationUnit))); _resultType = new Lazy <Type>(() => translationUnit.GetOrCreateType(handle.ResultType, () => Create(handle.ResultType, translationUnit))); _declarationCursor = new Lazy <Decl>(() => { var cursor = translationUnit.GetOrCreateCursor(handle.Declaration, () => Cursor.Create(handle.Declaration, translationUnit)); cursor?.Visit(clientData: default);
public EnumDecl(CXCursor handle, Cursor parent) : base(handle, parent) { Debug.Assert(handle.Kind == CXCursorKind.CXCursor_EnumDecl); _enumConstantDecls = new List <EnumConstantDecl>(); _integerType = new Lazy <Type>(() => TranslationUnit.GetOrCreateType(Handle.EnumDecl_IntegerType, () => Type.Create(Handle.EnumDecl_IntegerType, TranslationUnit))); }
protected Expr(CXCursor handle, Cursor parent) : base(handle, parent) { Debug.Assert(handle.IsExpression); _type = new Lazy <Type>(() => TranslationUnit.GetOrCreateType(Handle.Type, () => Type.Create(Handle.Type, TranslationUnit))); }
public TypedefDecl(CXCursor handle, Cursor parent) : base(handle, parent) { Debug.Assert(handle.Kind == CXCursorKind.CXCursor_TypedefDecl); _parmDecls = new List <ParmDecl>(); _underlyingType = new Lazy <Type>(() => TranslationUnit.GetOrCreateType(Handle.TypedefDeclUnderlyingType, () => Type.Create(Handle.TypedefDeclUnderlyingType, TranslationUnit))); }