void ResolveBaseTypes() { //2. resolve allbase type foreach (CodeTypeDeclaration typedecl in typedeclDic.Values) { //resolve base type List <CodeTypeReference> baseTypes = typedecl.BaseTypes; if (baseTypes.Count == 0) { //eg. struct } else { foreach (CodeTypeReference baseType in baseTypes) { CefResolvingContext resolvingContext = new CefResolvingContext(this, typedecl, ResolvingContextKind.Base); baseType.ResolvedType = resolvingContext.ResolveType(baseType); if (baseType.ResolvedType == null) { throw new NotSupportedException(); } } } } }
void AddMoreTypeInfo() { //-------- //copy all Freeze(); // Dictionary <string, TypeSymbol> tempSymbols = new Dictionary <string, TypeSymbol>(); int typeCount = typeSymbols.Count; foreach (var kp in typeSymbols) { tempSymbols.Add(kp.Key, kp.Value); } //Cef- find tune detail of base type foreach (TypeSymbol t in tempSymbols.Values) { switch (t.TypeSymbolKind) { default: throw new NotSupportedException(); case TypeSymbolKind.Simple: { SimpleTypeSymbol simpleType = (SimpleTypeSymbol)t; if (simpleType.PrimitiveTypeKind == PrimitiveTypeKind.NotPrimitiveType) { //resolve base type CodeTypeDeclaration typedecl = simpleType.CreatedByTypeDeclaration; if (typedecl != null && typedecl.BaseTypes != null && typedecl.BaseTypes.Count > 0) { CefResolvingContext ctx = new CefResolvingContext(this, null, ResolvingContextKind.Base); simpleType.BaseType = ctx.ResolveType(typedecl.BaseTypes[0]); } else { } } else { } } break; case TypeSymbolKind.TypeDef: { CTypeDefTypeSymbol typedefSymbol = (CTypeDefTypeSymbol)t; CefResolvingContext ctx = new CefResolvingContext(this, null, ResolvingContextKind.Base); typedefSymbol.ReferToTypeSymbol = ctx.ResolveType(typedefSymbol.OriginalTypeDecl); } break; } } //------- //assign bridge information //------- //swap this.typeSymbols = tempSymbols; }
void ResolveTypeMembers() { foreach (CodeTypeDeclaration typedecl in typedeclDic.Values) { foreach (CodeMethodDeclaration metDecl in typedecl.GetMethodIter()) { switch (metDecl.MethodKind) { default: throw new NotSupportedException(); case MethodKind.Ctor: case MethodKind.Dtor: { foreach (CodeMethodParameter p in metDecl.Parameters) { CefResolvingContext resolvingContext = new CefResolvingContext(this, typedecl, ResolvingContextKind.MethodParReturnType); // p.ParameterType.ResolvedType = resolvingContext.ResolveType(p.ParameterType); } } break; case MethodKind.Normal: { //resolve return type and type parameter { CefResolvingContext resolvingContext = new CefResolvingContext(this, typedecl, ResolvingContextKind.MethodParReturnType); // metDecl.ReturnType.ResolvedType = resolvingContext.ResolveType(metDecl.ReturnType); } foreach (CodeMethodParameter p in metDecl.Parameters) { CefResolvingContext resolvingContext = new CefResolvingContext(this, typedecl, ResolvingContextKind.MethodPar); // p.ParameterType.ResolvedType = resolvingContext.ResolveType(p.ParameterType); } } break; } } } }