Forráskód Böngészése

explicit error on context error

Nicolas Cannasse 5 éve
szülő
commit
32b0575581
1 módosított fájl, 10 hozzáadás és 5 törlés
  1. 10 5
      hide/comp/ScriptEditor.hx

+ 10 - 5
hide/comp/ScriptEditor.hx

@@ -133,11 +133,16 @@ class ScriptChecker {
 				this.evalTo = api.evalTo;
 		}
 		if( context != null ) {
-			switch( checker.types.resolve(context) ) {
-			case TInst(c,_):
-				for( f in c.fields ) if( f.t.match(TFun(_)) ) f.isPublic = true; // allow access to private methods
-				checker.setGlobals(c);
-			default: error(context+" is not a class");
+			var ctx = checker.types.resolve(context);
+			if( ctx == null )
+				error(context+" is not defined");
+			else {
+				switch( ctx ) {
+				case TInst(c,_):
+					for( f in c.fields ) if( f.t.match(TFun(_)) ) f.isPublic = true; // allow access to private methods
+					checker.setGlobals(c);
+				default: error(context+" is not a class");
+				}
 			}
 		}
 		checker.allowUntypedMeta = true;