Explorar o código

Warn the user when subclassing nil

Nicolas Petton %!s(int64=11) %!d(string=hai) anos
pai
achega
e21e79a75f
Modificáronse 1 ficheiros con 6 adicións e 0 borrados
  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);
 	};