瀏覽代碼

Warn the user when subclassing nil

Nicolas Petton 11 年之前
父節點
當前提交
e21e79a75f
共有 1 個文件被更改,包括 6 次插入0 次删除
  1. 6 0
      support/boot.js

+ 6 - 0
support/boot.js

@@ -447,6 +447,12 @@ function ClassesBrik(brikz, st) {
 
 	st.addClass = function(className, superclass, iVarNames, pkgName) {
 		if (superclass == nil) { superclass = null; }
+
+		// While subclassing nil is allowed, it might be an error, so
+		// warn about it.
+		if (superclass === null) {
+			console.warn('Compiling ' + className + ' as a subclass of `nil`. A dependency might be missing.');
+		}
 		rawAddClass(pkgName, className, superclass, iVarNames, false, null);
 	};