2
0
Эх сурвалжийг харах

Tweaked makedocs ResolveLink.

Mark Sibly 8 жил өмнө
parent
commit
216bd40a5e

+ 22 - 8
src/mx2cc/docs/docsmaker.monkey2

@@ -259,7 +259,7 @@ Class DocsMaker
 				Local ctype:=TCast<ClassType>( node )
 				If ctype Return MakeLink( name,ctype.cdecl,ctype.scope.outer )
 				
-				Print "Can't resolve link:"+path+", name="+name+", id="+id
+				Print "Can't resolve link:"+path+", id="+id
 				Return name
 			Endif
 			
@@ -271,7 +271,6 @@ Class DocsMaker
 				Try
 					type=scope.FindType( FixKeyword( id ) )
 				Catch ex:SemantEx
-					Print "ResolveLink exception!"
 				End
 			Else If Not tpath
 				For Local fscope:=Eachin _module.fileScopes
@@ -282,13 +281,28 @@ Class DocsMaker
 				If Not type type=Builder.monkeyNamespace.FindType( FixKeyword( id ) )
 			Endif
 
+			tpath+=id+"."
+			
 			If Not type 
+				If scope
+					Try
+						Local node:=scope.FindNode( FixKeyword( id ) )
+						
+						Local vvar:=Cast<VarValue>( node )
+						If vvar
+							Local ctype:=TCast<ClassType>( vvar.type )
+							If ctype
+								scope=ctype.scope
+								Continue
+							Endif
+						Endif
+					Catch ex:SemantEx
+					End
+				Endif
 				Print "Can't resolve link:"+path+", id="+id
-				Return path
+				Return name
 			Endif
 			
-			tpath+=id+"."
-			
 			Local ntype:=TCast<NamespaceType>( type )
 			If ntype
 				scope=ntype.scope
@@ -308,11 +322,11 @@ Class DocsMaker
 				Return MakeLink( name,etype.edecl,etype.scope.outer )
 			Endif
 			
-			Return ""
+			Return name
 			
 		Forever
-			
-		Return ""
+		
+		Return name
 	End
 	
 	Method DeclIdent:String( decl:Decl,gen:Bool=False )