diff compiler.js @ 36:3b0503a67165

Add scripts for building programs via C using d8 rather than a browser
author Mike Pavone <pavone@retrodev.com>
date Tue, 10 Jul 2012 19:22:19 -0700
parents bf5e88f6419d
children e7be612fd3ae
line wrap: on
line diff
--- a/compiler.js	Mon Jul 09 21:32:28 2012 -0700
+++ b/compiler.js	Tue Jul 10 19:22:19 2012 -0700
@@ -8,18 +8,22 @@
 {
 	this.names = null;
 	var self = this;
-	get('/src/', function(data) {
-		self.names = {};
-		var fakeEl = newEl("div", {
-			innerHTML: data.response
+	if (typeof window === "object") {
+		get('/src/', function(data) {
+			self.names = {};
+			var fakeEl = newEl("div", {
+				innerHTML: data.response
+			});
+			each(qall('a', fakeEl), function(idx, a) {
+				var tpidx = a.textContent.indexOf('.tp');
+				if (tpidx > -1) {
+					self.names[a.textContent.substr(0, tpidx)] = true;
+				}
+			});
 		});
-		each(qall('a', fakeEl), function(idx, a) {
-			var tpidx = a.textContent.indexOf('.tp');
-			if (tpidx > -1) {
-				self.names[a.textContent.substr(0, tpidx)] = true;
-			}
-		});
-	});
+	} else {
+		this.names = {};
+	}
 }
 topsymbols.prototype.find = function(name) {
 	if (!this.names) {