You are viewing a plain text version of this content. The canonical link for it is here.
Posted to xap-commits@incubator.apache.org by mt...@apache.org on 2006/07/27 06:29:43 UTC

svn commit: r425973 - /incubator/xap/trunk/src/xap/Xap.js

Author: mturyn
Date: Wed Jul 26 23:29:43 2006
New Revision: 425973

URL: http://svn.apache.org/viewvc?rev=425973&view=rev
Log:
Corrected and added to rudimentary class tree walking; may be useful for packaging, as a dry run for dependency graphing.

Modified:
    incubator/xap/trunk/src/xap/Xap.js

Modified: incubator/xap/trunk/src/xap/Xap.js
URL: http://svn.apache.org/viewvc/incubator/xap/trunk/src/xap/Xap.js?rev=425973&r1=425972&r2=425973&view=diff
==============================================================================
--- incubator/xap/trunk/src/xap/Xap.js (original)
+++ incubator/xap/trunk/src/xap/Xap.js Wed Jul 26 23:29:43 2006
@@ -433,14 +433,47 @@
 
 
 
-Xap.foo = new Array(0) ;
-
-Xap.getClassGraph = function(obj){
+Xap.getAllXapClasses = function(obj,name,arr){
+	var theArray = null ;
+	if (!arr ){
+		theArray = new Array(0) ;
+	} else {
+		theArray = arr ;
+	}
 	if ( obj.prototype ){
-		Xap.foo.push(obj) ;
+		theArray.push( name ) ;
+	} else {
+		for (var oo in obj){			
+			Xap.getAllXapClasses(obj[oo],name+"."+oo,theArray );
+		}
+	}
+	return theArray ;
+}
+
+
+
+Xap.getClassTree = function(name,obj,tree){
+	var theTree = null ;
+	if (!tree ){
+		theTree = new Object() ;
+	} else {
+		theTree = tree ;
+	}
+	
+	var theObject = null ;
+	if( obj ){
+		theObject = obj ;
 	} else {
-		for (var oo in obj){
-			Xap.getClassGraph(obj[oo],Xap.foo );
+		theObject = eval(name) ;	
+	}
+	if ( theObject.prototype ){
+		theTree[name] = theObject ;
+	} else {
+		for (var oo in theObject){			
+			Xap.getClassTree(name+"."+oo,theObject[oo],theTree[oo] );
 		}
 	}
+	return theTree ;
 }
+
+