Browse Source

Prevent direct calls to abstract methods. Fixes #416.

woollybah 6 năm trước cách đây
mục cha
commit
e4a65a382e
1 tập tin đã thay đổi với 5 bổ sung0 xóa
  1. 5 0
      expr.bmx

+ 5 - 0
expr.bmx

@@ -1127,6 +1127,11 @@ Type TInvokeSuperExpr Extends TExpr
 		' ensure the super function has been semanted
 		' ensure the super function has been semanted
 		funcDecl.Semant()
 		funcDecl.Semant()
 		
 		
+		' cannot directly call abstract methods
+		If funcDecl.isAbstract() Then
+			Err "Abstract method '" + funcDecl.ident + "' cannot be accessed directly."
+		End If
+		
 		' for static scope, we need to change class scope to that of the super class
 		' for static scope, we need to change class scope to that of the super class
 		If _env.FuncScope().IsStatic() Then
 		If _env.FuncScope().IsStatic() Then
 			classScope = TClassDecl(funcDecl.scope)
 			classScope = TClassDecl(funcDecl.scope)