sbin/res/jsdoc/app/lib/JSDOC/SymbolSet.js
author hamidouk
Fri, 23 Dec 2011 11:38:47 +0100
branchjsdoc
changeset 520 fe008e95a716
permissions -rw-r--r--
added jsdoc support, and a script to generate the docs. Also added sample documentation for the IriSP.widget base class.
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
520
fe008e95a716 added jsdoc support, and a script to generate the docs.
hamidouk
parents:
diff changeset
     1
/** @constructor */
fe008e95a716 added jsdoc support, and a script to generate the docs.
hamidouk
parents:
diff changeset
     2
JSDOC.SymbolSet = function() {
fe008e95a716 added jsdoc support, and a script to generate the docs.
hamidouk
parents:
diff changeset
     3
	this.init();
fe008e95a716 added jsdoc support, and a script to generate the docs.
hamidouk
parents:
diff changeset
     4
}
fe008e95a716 added jsdoc support, and a script to generate the docs.
hamidouk
parents:
diff changeset
     5
fe008e95a716 added jsdoc support, and a script to generate the docs.
hamidouk
parents:
diff changeset
     6
JSDOC.SymbolSet.prototype.init = function() {
fe008e95a716 added jsdoc support, and a script to generate the docs.
hamidouk
parents:
diff changeset
     7
	this._index = new Hash();
fe008e95a716 added jsdoc support, and a script to generate the docs.
hamidouk
parents:
diff changeset
     8
}
fe008e95a716 added jsdoc support, and a script to generate the docs.
hamidouk
parents:
diff changeset
     9
fe008e95a716 added jsdoc support, and a script to generate the docs.
hamidouk
parents:
diff changeset
    10
JSDOC.SymbolSet.prototype.keys = function() {
fe008e95a716 added jsdoc support, and a script to generate the docs.
hamidouk
parents:
diff changeset
    11
	return this._index.keys();
fe008e95a716 added jsdoc support, and a script to generate the docs.
hamidouk
parents:
diff changeset
    12
}
fe008e95a716 added jsdoc support, and a script to generate the docs.
hamidouk
parents:
diff changeset
    13
fe008e95a716 added jsdoc support, and a script to generate the docs.
hamidouk
parents:
diff changeset
    14
JSDOC.SymbolSet.prototype.hasSymbol = function(alias) {
fe008e95a716 added jsdoc support, and a script to generate the docs.
hamidouk
parents:
diff changeset
    15
	return this._index.hasKey(alias);
fe008e95a716 added jsdoc support, and a script to generate the docs.
hamidouk
parents:
diff changeset
    16
}
fe008e95a716 added jsdoc support, and a script to generate the docs.
hamidouk
parents:
diff changeset
    17
fe008e95a716 added jsdoc support, and a script to generate the docs.
hamidouk
parents:
diff changeset
    18
JSDOC.SymbolSet.prototype.addSymbol = function(symbol) {
fe008e95a716 added jsdoc support, and a script to generate the docs.
hamidouk
parents:
diff changeset
    19
	if (JSDOC.opt.a && this.hasSymbol(symbol.alias)) {
fe008e95a716 added jsdoc support, and a script to generate the docs.
hamidouk
parents:
diff changeset
    20
		LOG.warn("Overwriting symbol documentation for: " + symbol.alias + ".");
fe008e95a716 added jsdoc support, and a script to generate the docs.
hamidouk
parents:
diff changeset
    21
		this.deleteSymbol(symbol.alias);
fe008e95a716 added jsdoc support, and a script to generate the docs.
hamidouk
parents:
diff changeset
    22
	}
fe008e95a716 added jsdoc support, and a script to generate the docs.
hamidouk
parents:
diff changeset
    23
	this._index.set(symbol.alias, symbol);
fe008e95a716 added jsdoc support, and a script to generate the docs.
hamidouk
parents:
diff changeset
    24
}
fe008e95a716 added jsdoc support, and a script to generate the docs.
hamidouk
parents:
diff changeset
    25
fe008e95a716 added jsdoc support, and a script to generate the docs.
hamidouk
parents:
diff changeset
    26
JSDOC.SymbolSet.prototype.getSymbol = function(alias) {
fe008e95a716 added jsdoc support, and a script to generate the docs.
hamidouk
parents:
diff changeset
    27
	if (this.hasSymbol(alias)) return this._index.get(alias);
fe008e95a716 added jsdoc support, and a script to generate the docs.
hamidouk
parents:
diff changeset
    28
}
fe008e95a716 added jsdoc support, and a script to generate the docs.
hamidouk
parents:
diff changeset
    29
fe008e95a716 added jsdoc support, and a script to generate the docs.
hamidouk
parents:
diff changeset
    30
JSDOC.SymbolSet.prototype.getSymbolByName = function(name) {
fe008e95a716 added jsdoc support, and a script to generate the docs.
hamidouk
parents:
diff changeset
    31
	for (var p = this._index.first(); p; p = this._index.next()) {
fe008e95a716 added jsdoc support, and a script to generate the docs.
hamidouk
parents:
diff changeset
    32
		var symbol = p.value;
fe008e95a716 added jsdoc support, and a script to generate the docs.
hamidouk
parents:
diff changeset
    33
		if (symbol.name == name) return symbol;
fe008e95a716 added jsdoc support, and a script to generate the docs.
hamidouk
parents:
diff changeset
    34
	}
fe008e95a716 added jsdoc support, and a script to generate the docs.
hamidouk
parents:
diff changeset
    35
}
fe008e95a716 added jsdoc support, and a script to generate the docs.
hamidouk
parents:
diff changeset
    36
fe008e95a716 added jsdoc support, and a script to generate the docs.
hamidouk
parents:
diff changeset
    37
JSDOC.SymbolSet.prototype.toArray = function() {
fe008e95a716 added jsdoc support, and a script to generate the docs.
hamidouk
parents:
diff changeset
    38
	return this._index.values();
fe008e95a716 added jsdoc support, and a script to generate the docs.
hamidouk
parents:
diff changeset
    39
}
fe008e95a716 added jsdoc support, and a script to generate the docs.
hamidouk
parents:
diff changeset
    40
fe008e95a716 added jsdoc support, and a script to generate the docs.
hamidouk
parents:
diff changeset
    41
JSDOC.SymbolSet.prototype.deleteSymbol = function(alias) {
fe008e95a716 added jsdoc support, and a script to generate the docs.
hamidouk
parents:
diff changeset
    42
	if (!this.hasSymbol(alias)) return;
fe008e95a716 added jsdoc support, and a script to generate the docs.
hamidouk
parents:
diff changeset
    43
	this._index.drop(alias);
fe008e95a716 added jsdoc support, and a script to generate the docs.
hamidouk
parents:
diff changeset
    44
}
fe008e95a716 added jsdoc support, and a script to generate the docs.
hamidouk
parents:
diff changeset
    45
fe008e95a716 added jsdoc support, and a script to generate the docs.
hamidouk
parents:
diff changeset
    46
JSDOC.SymbolSet.prototype.renameSymbol = function(oldName, newName) {
fe008e95a716 added jsdoc support, and a script to generate the docs.
hamidouk
parents:
diff changeset
    47
	// todo: should check if oldname or newname already exist
fe008e95a716 added jsdoc support, and a script to generate the docs.
hamidouk
parents:
diff changeset
    48
	this._index.replace(oldName, newName);
fe008e95a716 added jsdoc support, and a script to generate the docs.
hamidouk
parents:
diff changeset
    49
	this._index.get(newName).alias = newName;
fe008e95a716 added jsdoc support, and a script to generate the docs.
hamidouk
parents:
diff changeset
    50
	return newName;
fe008e95a716 added jsdoc support, and a script to generate the docs.
hamidouk
parents:
diff changeset
    51
}
fe008e95a716 added jsdoc support, and a script to generate the docs.
hamidouk
parents:
diff changeset
    52
fe008e95a716 added jsdoc support, and a script to generate the docs.
hamidouk
parents:
diff changeset
    53
JSDOC.SymbolSet.prototype.relate = function() {
fe008e95a716 added jsdoc support, and a script to generate the docs.
hamidouk
parents:
diff changeset
    54
	this.resolveBorrows();
fe008e95a716 added jsdoc support, and a script to generate the docs.
hamidouk
parents:
diff changeset
    55
	this.resolveMemberOf();
fe008e95a716 added jsdoc support, and a script to generate the docs.
hamidouk
parents:
diff changeset
    56
	this.resolveAugments();
fe008e95a716 added jsdoc support, and a script to generate the docs.
hamidouk
parents:
diff changeset
    57
}
fe008e95a716 added jsdoc support, and a script to generate the docs.
hamidouk
parents:
diff changeset
    58
fe008e95a716 added jsdoc support, and a script to generate the docs.
hamidouk
parents:
diff changeset
    59
JSDOC.SymbolSet.prototype.resolveBorrows = function() {
fe008e95a716 added jsdoc support, and a script to generate the docs.
hamidouk
parents:
diff changeset
    60
	for (var p = this._index.first(); p; p = this._index.next()) {
fe008e95a716 added jsdoc support, and a script to generate the docs.
hamidouk
parents:
diff changeset
    61
		var symbol = p.value;
fe008e95a716 added jsdoc support, and a script to generate the docs.
hamidouk
parents:
diff changeset
    62
		if (symbol.is("FILE") || symbol.is("GLOBAL")) continue;
fe008e95a716 added jsdoc support, and a script to generate the docs.
hamidouk
parents:
diff changeset
    63
		
fe008e95a716 added jsdoc support, and a script to generate the docs.
hamidouk
parents:
diff changeset
    64
		var borrows = symbol.inherits;
fe008e95a716 added jsdoc support, and a script to generate the docs.
hamidouk
parents:
diff changeset
    65
		for (var i = 0; i < borrows.length; i++) {
fe008e95a716 added jsdoc support, and a script to generate the docs.
hamidouk
parents:
diff changeset
    66
		
fe008e95a716 added jsdoc support, and a script to generate the docs.
hamidouk
parents:
diff changeset
    67
if (/#$/.test(borrows[i].alias)) {
fe008e95a716 added jsdoc support, and a script to generate the docs.
hamidouk
parents:
diff changeset
    68
	LOG.warn("Attempted to borrow entire instance of "+borrows[i].alias+" but that feature is not yet implemented.");
fe008e95a716 added jsdoc support, and a script to generate the docs.
hamidouk
parents:
diff changeset
    69
	return;
fe008e95a716 added jsdoc support, and a script to generate the docs.
hamidouk
parents:
diff changeset
    70
}
fe008e95a716 added jsdoc support, and a script to generate the docs.
hamidouk
parents:
diff changeset
    71
			var borrowed = this.getSymbol(borrows[i].alias);
fe008e95a716 added jsdoc support, and a script to generate the docs.
hamidouk
parents:
diff changeset
    72
			
fe008e95a716 added jsdoc support, and a script to generate the docs.
hamidouk
parents:
diff changeset
    73
			if (!borrowed) {
fe008e95a716 added jsdoc support, and a script to generate the docs.
hamidouk
parents:
diff changeset
    74
				LOG.warn("Can't borrow undocumented "+borrows[i].alias+".");
fe008e95a716 added jsdoc support, and a script to generate the docs.
hamidouk
parents:
diff changeset
    75
				continue;
fe008e95a716 added jsdoc support, and a script to generate the docs.
hamidouk
parents:
diff changeset
    76
			}
fe008e95a716 added jsdoc support, and a script to generate the docs.
hamidouk
parents:
diff changeset
    77
fe008e95a716 added jsdoc support, and a script to generate the docs.
hamidouk
parents:
diff changeset
    78
			if (borrows[i].as == borrowed.alias) {
fe008e95a716 added jsdoc support, and a script to generate the docs.
hamidouk
parents:
diff changeset
    79
				var assumedName = borrowed.name.split(/([#.-])/).pop();
fe008e95a716 added jsdoc support, and a script to generate the docs.
hamidouk
parents:
diff changeset
    80
				borrows[i].as = symbol.name+RegExp.$1+assumedName;
fe008e95a716 added jsdoc support, and a script to generate the docs.
hamidouk
parents:
diff changeset
    81
				LOG.inform("Assuming borrowed as name is "+borrows[i].as+" but that feature is experimental.");
fe008e95a716 added jsdoc support, and a script to generate the docs.
hamidouk
parents:
diff changeset
    82
			}
fe008e95a716 added jsdoc support, and a script to generate the docs.
hamidouk
parents:
diff changeset
    83
			
fe008e95a716 added jsdoc support, and a script to generate the docs.
hamidouk
parents:
diff changeset
    84
			var borrowAsName = borrows[i].as;
fe008e95a716 added jsdoc support, and a script to generate the docs.
hamidouk
parents:
diff changeset
    85
			var borrowAsAlias = borrowAsName;
fe008e95a716 added jsdoc support, and a script to generate the docs.
hamidouk
parents:
diff changeset
    86
			if (!borrowAsName) {
fe008e95a716 added jsdoc support, and a script to generate the docs.
hamidouk
parents:
diff changeset
    87
				LOG.warn("Malformed @borrow, 'as' is required.");
fe008e95a716 added jsdoc support, and a script to generate the docs.
hamidouk
parents:
diff changeset
    88
				continue;
fe008e95a716 added jsdoc support, and a script to generate the docs.
hamidouk
parents:
diff changeset
    89
			}
fe008e95a716 added jsdoc support, and a script to generate the docs.
hamidouk
parents:
diff changeset
    90
			
fe008e95a716 added jsdoc support, and a script to generate the docs.
hamidouk
parents:
diff changeset
    91
			if (borrowAsName.length > symbol.alias.length && borrowAsName.indexOf(symbol.alias) == 0) {
fe008e95a716 added jsdoc support, and a script to generate the docs.
hamidouk
parents:
diff changeset
    92
				borrowAsName = borrowAsName.replace(borrowed.alias, "")
fe008e95a716 added jsdoc support, and a script to generate the docs.
hamidouk
parents:
diff changeset
    93
			}
fe008e95a716 added jsdoc support, and a script to generate the docs.
hamidouk
parents:
diff changeset
    94
			else {
fe008e95a716 added jsdoc support, and a script to generate the docs.
hamidouk
parents:
diff changeset
    95
				var joiner = "";
fe008e95a716 added jsdoc support, and a script to generate the docs.
hamidouk
parents:
diff changeset
    96
				if (borrowAsName.charAt(0) != "#") joiner = ".";
fe008e95a716 added jsdoc support, and a script to generate the docs.
hamidouk
parents:
diff changeset
    97
				borrowAsAlias = borrowed.alias + joiner + borrowAsName;
fe008e95a716 added jsdoc support, and a script to generate the docs.
hamidouk
parents:
diff changeset
    98
			}
fe008e95a716 added jsdoc support, and a script to generate the docs.
hamidouk
parents:
diff changeset
    99
			
fe008e95a716 added jsdoc support, and a script to generate the docs.
hamidouk
parents:
diff changeset
   100
			borrowAsName = borrowAsName.replace(/^[#.]/, "");
fe008e95a716 added jsdoc support, and a script to generate the docs.
hamidouk
parents:
diff changeset
   101
					
fe008e95a716 added jsdoc support, and a script to generate the docs.
hamidouk
parents:
diff changeset
   102
			if (this.hasSymbol(borrowAsAlias)) continue;
fe008e95a716 added jsdoc support, and a script to generate the docs.
hamidouk
parents:
diff changeset
   103
fe008e95a716 added jsdoc support, and a script to generate the docs.
hamidouk
parents:
diff changeset
   104
			var clone = borrowed.clone();
fe008e95a716 added jsdoc support, and a script to generate the docs.
hamidouk
parents:
diff changeset
   105
			clone.name = borrowAsName;
fe008e95a716 added jsdoc support, and a script to generate the docs.
hamidouk
parents:
diff changeset
   106
			clone.alias = borrowAsAlias;
fe008e95a716 added jsdoc support, and a script to generate the docs.
hamidouk
parents:
diff changeset
   107
			this.addSymbol(clone);
fe008e95a716 added jsdoc support, and a script to generate the docs.
hamidouk
parents:
diff changeset
   108
		}
fe008e95a716 added jsdoc support, and a script to generate the docs.
hamidouk
parents:
diff changeset
   109
	}
fe008e95a716 added jsdoc support, and a script to generate the docs.
hamidouk
parents:
diff changeset
   110
}
fe008e95a716 added jsdoc support, and a script to generate the docs.
hamidouk
parents:
diff changeset
   111
fe008e95a716 added jsdoc support, and a script to generate the docs.
hamidouk
parents:
diff changeset
   112
JSDOC.SymbolSet.prototype.resolveMemberOf = function() {
fe008e95a716 added jsdoc support, and a script to generate the docs.
hamidouk
parents:
diff changeset
   113
	for (var p = this._index.first(); p; p = this._index.next()) {
fe008e95a716 added jsdoc support, and a script to generate the docs.
hamidouk
parents:
diff changeset
   114
		var symbol = p.value;
fe008e95a716 added jsdoc support, and a script to generate the docs.
hamidouk
parents:
diff changeset
   115
fe008e95a716 added jsdoc support, and a script to generate the docs.
hamidouk
parents:
diff changeset
   116
		if (symbol.is("FILE") || symbol.is("GLOBAL")) continue;
fe008e95a716 added jsdoc support, and a script to generate the docs.
hamidouk
parents:
diff changeset
   117
		
fe008e95a716 added jsdoc support, and a script to generate the docs.
hamidouk
parents:
diff changeset
   118
		// the memberOf value was provided in the @memberOf tag
fe008e95a716 added jsdoc support, and a script to generate the docs.
hamidouk
parents:
diff changeset
   119
		else if (symbol.memberOf) {			
fe008e95a716 added jsdoc support, and a script to generate the docs.
hamidouk
parents:
diff changeset
   120
			// like foo.bar is a memberOf foo
fe008e95a716 added jsdoc support, and a script to generate the docs.
hamidouk
parents:
diff changeset
   121
			if (symbol.alias.indexOf(symbol.memberOf) == 0) {
fe008e95a716 added jsdoc support, and a script to generate the docs.
hamidouk
parents:
diff changeset
   122
				var memberMatch = new RegExp("^("+symbol.memberOf+")[.#-]?(.+)$");
fe008e95a716 added jsdoc support, and a script to generate the docs.
hamidouk
parents:
diff changeset
   123
				var aliasParts = symbol.alias.match(memberMatch);
fe008e95a716 added jsdoc support, and a script to generate the docs.
hamidouk
parents:
diff changeset
   124
				
fe008e95a716 added jsdoc support, and a script to generate the docs.
hamidouk
parents:
diff changeset
   125
				if (aliasParts) {
fe008e95a716 added jsdoc support, and a script to generate the docs.
hamidouk
parents:
diff changeset
   126
					symbol.memberOf = aliasParts[1];
fe008e95a716 added jsdoc support, and a script to generate the docs.
hamidouk
parents:
diff changeset
   127
					symbol.name = aliasParts[2];
fe008e95a716 added jsdoc support, and a script to generate the docs.
hamidouk
parents:
diff changeset
   128
				}
fe008e95a716 added jsdoc support, and a script to generate the docs.
hamidouk
parents:
diff changeset
   129
				
fe008e95a716 added jsdoc support, and a script to generate the docs.
hamidouk
parents:
diff changeset
   130
				var nameParts = symbol.name.match(memberMatch);
fe008e95a716 added jsdoc support, and a script to generate the docs.
hamidouk
parents:
diff changeset
   131
fe008e95a716 added jsdoc support, and a script to generate the docs.
hamidouk
parents:
diff changeset
   132
				if (nameParts) {
fe008e95a716 added jsdoc support, and a script to generate the docs.
hamidouk
parents:
diff changeset
   133
					symbol.name = nameParts[2];
fe008e95a716 added jsdoc support, and a script to generate the docs.
hamidouk
parents:
diff changeset
   134
				}
fe008e95a716 added jsdoc support, and a script to generate the docs.
hamidouk
parents:
diff changeset
   135
			}
fe008e95a716 added jsdoc support, and a script to generate the docs.
hamidouk
parents:
diff changeset
   136
			// like bar is a memberOf foo
fe008e95a716 added jsdoc support, and a script to generate the docs.
hamidouk
parents:
diff changeset
   137
			else {
fe008e95a716 added jsdoc support, and a script to generate the docs.
hamidouk
parents:
diff changeset
   138
				var joiner = symbol.memberOf.charAt(symbol.memberOf.length-1);
fe008e95a716 added jsdoc support, and a script to generate the docs.
hamidouk
parents:
diff changeset
   139
				if (!/[.#-]/.test(joiner)) symbol.memberOf += ".";
fe008e95a716 added jsdoc support, and a script to generate the docs.
hamidouk
parents:
diff changeset
   140
				this.renameSymbol(symbol.alias, symbol.memberOf + symbol.name);
fe008e95a716 added jsdoc support, and a script to generate the docs.
hamidouk
parents:
diff changeset
   141
			}
fe008e95a716 added jsdoc support, and a script to generate the docs.
hamidouk
parents:
diff changeset
   142
		}
fe008e95a716 added jsdoc support, and a script to generate the docs.
hamidouk
parents:
diff changeset
   143
		// the memberOf must be calculated
fe008e95a716 added jsdoc support, and a script to generate the docs.
hamidouk
parents:
diff changeset
   144
		else {
fe008e95a716 added jsdoc support, and a script to generate the docs.
hamidouk
parents:
diff changeset
   145
			var parts = symbol.alias.match(/^(.*[.#-])([^.#-]+)$/);
fe008e95a716 added jsdoc support, and a script to generate the docs.
hamidouk
parents:
diff changeset
   146
fe008e95a716 added jsdoc support, and a script to generate the docs.
hamidouk
parents:
diff changeset
   147
			if (parts) {
fe008e95a716 added jsdoc support, and a script to generate the docs.
hamidouk
parents:
diff changeset
   148
				symbol.memberOf = parts[1];
fe008e95a716 added jsdoc support, and a script to generate the docs.
hamidouk
parents:
diff changeset
   149
				symbol.name = parts[2];				
fe008e95a716 added jsdoc support, and a script to generate the docs.
hamidouk
parents:
diff changeset
   150
			}
fe008e95a716 added jsdoc support, and a script to generate the docs.
hamidouk
parents:
diff changeset
   151
		}
fe008e95a716 added jsdoc support, and a script to generate the docs.
hamidouk
parents:
diff changeset
   152
fe008e95a716 added jsdoc support, and a script to generate the docs.
hamidouk
parents:
diff changeset
   153
		// set isStatic, isInner
fe008e95a716 added jsdoc support, and a script to generate the docs.
hamidouk
parents:
diff changeset
   154
		if (symbol.memberOf) {
fe008e95a716 added jsdoc support, and a script to generate the docs.
hamidouk
parents:
diff changeset
   155
			switch (symbol.memberOf.charAt(symbol.memberOf.length-1)) {
fe008e95a716 added jsdoc support, and a script to generate the docs.
hamidouk
parents:
diff changeset
   156
				case '#' :
fe008e95a716 added jsdoc support, and a script to generate the docs.
hamidouk
parents:
diff changeset
   157
					symbol.isStatic = false;
fe008e95a716 added jsdoc support, and a script to generate the docs.
hamidouk
parents:
diff changeset
   158
					symbol.isInner = false;
fe008e95a716 added jsdoc support, and a script to generate the docs.
hamidouk
parents:
diff changeset
   159
				break;
fe008e95a716 added jsdoc support, and a script to generate the docs.
hamidouk
parents:
diff changeset
   160
				case '.' :
fe008e95a716 added jsdoc support, and a script to generate the docs.
hamidouk
parents:
diff changeset
   161
					symbol.isStatic = true;
fe008e95a716 added jsdoc support, and a script to generate the docs.
hamidouk
parents:
diff changeset
   162
					symbol.isInner = false;
fe008e95a716 added jsdoc support, and a script to generate the docs.
hamidouk
parents:
diff changeset
   163
				break;
fe008e95a716 added jsdoc support, and a script to generate the docs.
hamidouk
parents:
diff changeset
   164
				case '-' :
fe008e95a716 added jsdoc support, and a script to generate the docs.
hamidouk
parents:
diff changeset
   165
					symbol.isStatic = false;
fe008e95a716 added jsdoc support, and a script to generate the docs.
hamidouk
parents:
diff changeset
   166
					symbol.isInner = true;
fe008e95a716 added jsdoc support, and a script to generate the docs.
hamidouk
parents:
diff changeset
   167
				break;
fe008e95a716 added jsdoc support, and a script to generate the docs.
hamidouk
parents:
diff changeset
   168
				default: // memberOf ends in none of the above
fe008e95a716 added jsdoc support, and a script to generate the docs.
hamidouk
parents:
diff changeset
   169
					symbol.isStatic = true;
fe008e95a716 added jsdoc support, and a script to generate the docs.
hamidouk
parents:
diff changeset
   170
				break;
fe008e95a716 added jsdoc support, and a script to generate the docs.
hamidouk
parents:
diff changeset
   171
			}
fe008e95a716 added jsdoc support, and a script to generate the docs.
hamidouk
parents:
diff changeset
   172
		}
fe008e95a716 added jsdoc support, and a script to generate the docs.
hamidouk
parents:
diff changeset
   173
		
fe008e95a716 added jsdoc support, and a script to generate the docs.
hamidouk
parents:
diff changeset
   174
		// unowned methods and fields belong to the global object
fe008e95a716 added jsdoc support, and a script to generate the docs.
hamidouk
parents:
diff changeset
   175
		if (!symbol.is("CONSTRUCTOR") && !symbol.isNamespace && symbol.memberOf == "") {
fe008e95a716 added jsdoc support, and a script to generate the docs.
hamidouk
parents:
diff changeset
   176
			symbol.memberOf = "_global_";
fe008e95a716 added jsdoc support, and a script to generate the docs.
hamidouk
parents:
diff changeset
   177
		}
fe008e95a716 added jsdoc support, and a script to generate the docs.
hamidouk
parents:
diff changeset
   178
fe008e95a716 added jsdoc support, and a script to generate the docs.
hamidouk
parents:
diff changeset
   179
		// clean up
fe008e95a716 added jsdoc support, and a script to generate the docs.
hamidouk
parents:
diff changeset
   180
		if (symbol.memberOf.match(/[.#-]$/)) {
fe008e95a716 added jsdoc support, and a script to generate the docs.
hamidouk
parents:
diff changeset
   181
			symbol.memberOf = symbol.memberOf.substr(0, symbol.memberOf.length-1);
fe008e95a716 added jsdoc support, and a script to generate the docs.
hamidouk
parents:
diff changeset
   182
		}
fe008e95a716 added jsdoc support, and a script to generate the docs.
hamidouk
parents:
diff changeset
   183
		// add to parent's methods or properties list
fe008e95a716 added jsdoc support, and a script to generate the docs.
hamidouk
parents:
diff changeset
   184
		if (symbol.memberOf) {
fe008e95a716 added jsdoc support, and a script to generate the docs.
hamidouk
parents:
diff changeset
   185
fe008e95a716 added jsdoc support, and a script to generate the docs.
hamidouk
parents:
diff changeset
   186
			var container = this.getSymbol(symbol.memberOf);
fe008e95a716 added jsdoc support, and a script to generate the docs.
hamidouk
parents:
diff changeset
   187
			if (!container) {
fe008e95a716 added jsdoc support, and a script to generate the docs.
hamidouk
parents:
diff changeset
   188
				if (JSDOC.Lang.isBuiltin(symbol.memberOf)) container = JSDOC.Parser.addBuiltin(symbol.memberOf);
fe008e95a716 added jsdoc support, and a script to generate the docs.
hamidouk
parents:
diff changeset
   189
				else {
fe008e95a716 added jsdoc support, and a script to generate the docs.
hamidouk
parents:
diff changeset
   190
					LOG.warn("Trying to document "+symbol.name +" as a member of undocumented symbol "+symbol.memberOf+".");
fe008e95a716 added jsdoc support, and a script to generate the docs.
hamidouk
parents:
diff changeset
   191
				}
fe008e95a716 added jsdoc support, and a script to generate the docs.
hamidouk
parents:
diff changeset
   192
			}
fe008e95a716 added jsdoc support, and a script to generate the docs.
hamidouk
parents:
diff changeset
   193
			
fe008e95a716 added jsdoc support, and a script to generate the docs.
hamidouk
parents:
diff changeset
   194
			if (container) container.addMember(symbol);
fe008e95a716 added jsdoc support, and a script to generate the docs.
hamidouk
parents:
diff changeset
   195
		}
fe008e95a716 added jsdoc support, and a script to generate the docs.
hamidouk
parents:
diff changeset
   196
	}
fe008e95a716 added jsdoc support, and a script to generate the docs.
hamidouk
parents:
diff changeset
   197
}
fe008e95a716 added jsdoc support, and a script to generate the docs.
hamidouk
parents:
diff changeset
   198
fe008e95a716 added jsdoc support, and a script to generate the docs.
hamidouk
parents:
diff changeset
   199
JSDOC.SymbolSet.prototype.resolveAugments = function() {
fe008e95a716 added jsdoc support, and a script to generate the docs.
hamidouk
parents:
diff changeset
   200
	for (var p = this._index.first(); p; p = this._index.next()) {
fe008e95a716 added jsdoc support, and a script to generate the docs.
hamidouk
parents:
diff changeset
   201
		var symbol = p.value;
fe008e95a716 added jsdoc support, and a script to generate the docs.
hamidouk
parents:
diff changeset
   202
		
fe008e95a716 added jsdoc support, and a script to generate the docs.
hamidouk
parents:
diff changeset
   203
		if (symbol.alias == "_global_" || symbol.is("FILE")) continue;
fe008e95a716 added jsdoc support, and a script to generate the docs.
hamidouk
parents:
diff changeset
   204
		JSDOC.SymbolSet.prototype.walk.apply(this, [symbol]);
fe008e95a716 added jsdoc support, and a script to generate the docs.
hamidouk
parents:
diff changeset
   205
	}
fe008e95a716 added jsdoc support, and a script to generate the docs.
hamidouk
parents:
diff changeset
   206
}
fe008e95a716 added jsdoc support, and a script to generate the docs.
hamidouk
parents:
diff changeset
   207
fe008e95a716 added jsdoc support, and a script to generate the docs.
hamidouk
parents:
diff changeset
   208
JSDOC.SymbolSet.prototype.walk = function(symbol) {
fe008e95a716 added jsdoc support, and a script to generate the docs.
hamidouk
parents:
diff changeset
   209
	var augments = symbol.augments;
fe008e95a716 added jsdoc support, and a script to generate the docs.
hamidouk
parents:
diff changeset
   210
	for(var i = 0; i < augments.length; i++) {
fe008e95a716 added jsdoc support, and a script to generate the docs.
hamidouk
parents:
diff changeset
   211
		var contributer = this.getSymbol(augments[i]);
fe008e95a716 added jsdoc support, and a script to generate the docs.
hamidouk
parents:
diff changeset
   212
		if (!contributer && JSDOC.Lang.isBuiltin(''+augments[i])) {
fe008e95a716 added jsdoc support, and a script to generate the docs.
hamidouk
parents:
diff changeset
   213
			contributer = new JSDOC.Symbol("_global_."+augments[i], [], augments[i], new JSDOC.DocComment("Built in."));
fe008e95a716 added jsdoc support, and a script to generate the docs.
hamidouk
parents:
diff changeset
   214
			contributer.isNamespace = true;
fe008e95a716 added jsdoc support, and a script to generate the docs.
hamidouk
parents:
diff changeset
   215
			contributer.srcFile = "";
fe008e95a716 added jsdoc support, and a script to generate the docs.
hamidouk
parents:
diff changeset
   216
			contributer.isPrivate = false;
fe008e95a716 added jsdoc support, and a script to generate the docs.
hamidouk
parents:
diff changeset
   217
			JSDOC.Parser.addSymbol(contributer);
fe008e95a716 added jsdoc support, and a script to generate the docs.
hamidouk
parents:
diff changeset
   218
		}
fe008e95a716 added jsdoc support, and a script to generate the docs.
hamidouk
parents:
diff changeset
   219
		
fe008e95a716 added jsdoc support, and a script to generate the docs.
hamidouk
parents:
diff changeset
   220
		if (contributer) {			
fe008e95a716 added jsdoc support, and a script to generate the docs.
hamidouk
parents:
diff changeset
   221
			if (contributer.augments.length) {
fe008e95a716 added jsdoc support, and a script to generate the docs.
hamidouk
parents:
diff changeset
   222
				JSDOC.SymbolSet.prototype.walk.apply(this, [contributer]);
fe008e95a716 added jsdoc support, and a script to generate the docs.
hamidouk
parents:
diff changeset
   223
			}
fe008e95a716 added jsdoc support, and a script to generate the docs.
hamidouk
parents:
diff changeset
   224
			
fe008e95a716 added jsdoc support, and a script to generate the docs.
hamidouk
parents:
diff changeset
   225
			symbol.inheritsFrom.push(contributer.alias);
fe008e95a716 added jsdoc support, and a script to generate the docs.
hamidouk
parents:
diff changeset
   226
			//if (!isUnique(symbol.inheritsFrom)) {
fe008e95a716 added jsdoc support, and a script to generate the docs.
hamidouk
parents:
diff changeset
   227
			//	LOG.warn("Can't resolve augments: Circular reference: "+symbol.alias+" inherits from "+contributer.alias+" more than once.");
fe008e95a716 added jsdoc support, and a script to generate the docs.
hamidouk
parents:
diff changeset
   228
			//}
fe008e95a716 added jsdoc support, and a script to generate the docs.
hamidouk
parents:
diff changeset
   229
			//else {
fe008e95a716 added jsdoc support, and a script to generate the docs.
hamidouk
parents:
diff changeset
   230
				var cmethods = contributer.methods;
fe008e95a716 added jsdoc support, and a script to generate the docs.
hamidouk
parents:
diff changeset
   231
				var cproperties = contributer.properties;
fe008e95a716 added jsdoc support, and a script to generate the docs.
hamidouk
parents:
diff changeset
   232
				
fe008e95a716 added jsdoc support, and a script to generate the docs.
hamidouk
parents:
diff changeset
   233
				for (var ci = 0, cl = cmethods.length; ci < cl; ci++) {
fe008e95a716 added jsdoc support, and a script to generate the docs.
hamidouk
parents:
diff changeset
   234
					if (!cmethods[ci].isStatic) symbol.inherit(cmethods[ci]);
fe008e95a716 added jsdoc support, and a script to generate the docs.
hamidouk
parents:
diff changeset
   235
				}
fe008e95a716 added jsdoc support, and a script to generate the docs.
hamidouk
parents:
diff changeset
   236
				for (var ci = 0, cl = cproperties.length; ci < cl; ci++) {
fe008e95a716 added jsdoc support, and a script to generate the docs.
hamidouk
parents:
diff changeset
   237
					if (!cproperties[ci].isStatic) symbol.inherit(cproperties[ci]);
fe008e95a716 added jsdoc support, and a script to generate the docs.
hamidouk
parents:
diff changeset
   238
				}	
fe008e95a716 added jsdoc support, and a script to generate the docs.
hamidouk
parents:
diff changeset
   239
			//}
fe008e95a716 added jsdoc support, and a script to generate the docs.
hamidouk
parents:
diff changeset
   240
		}
fe008e95a716 added jsdoc support, and a script to generate the docs.
hamidouk
parents:
diff changeset
   241
		else LOG.warn("Can't augment contributer: "+augments[i]+", not found.");
fe008e95a716 added jsdoc support, and a script to generate the docs.
hamidouk
parents:
diff changeset
   242
	}
fe008e95a716 added jsdoc support, and a script to generate the docs.
hamidouk
parents:
diff changeset
   243
}