From 3d4323a75dba8d845725f701c092b51f4627e773 Mon Sep 17 00:00:00 2001 From: Jonas Maebe Date: Sat, 20 Aug 2011 07:55:50 +0000 Subject: [PATCH] + support sealed/abstract Java classes (todo: allow abstract Java classes to only partially implement an interface, and check in first non-abstract class in inheritance tree whether it implements all interface methods) git-svn-id: branches/jvmbackend@18393 - --- compiler/pdecobj.pas | 20 +++++++++++++++++--- 1 file changed, 17 insertions(+), 3 deletions(-) diff --git a/compiler/pdecobj.pas b/compiler/pdecobj.pas index 1380c6d218..9d8b50b7a8 100644 --- a/compiler/pdecobj.pas +++ b/compiler/pdecobj.pas @@ -421,10 +421,14 @@ implementation procedure parse_object_options; + var + gotexternal: boolean; begin case current_objectdef.objecttype of - odt_object,odt_class: + odt_object,odt_class, + odt_javaclass: begin + gotexternal:=false; while true do begin if try_to_consume(_ABSTRACT) then @@ -432,14 +436,24 @@ implementation else if try_to_consume(_SEALED) then include(current_structdef.objectoptions,oo_is_sealed) + else if (current_objectdef.objecttype=odt_javaclass) and + (token=_ID) and + (idtoken=_EXTERNAL) then + begin + get_cpp_or_java_class_external_status(current_objectdef); + gotexternal:=true; + end else break; end; - if [oo_is_abstract, oo_is_sealed] * current_structdef.objectoptions = [oo_is_abstract, oo_is_sealed] then + if [oo_is_abstract, oo_is_sealed] <= current_structdef.objectoptions then Message(parser_e_abstract_and_sealed_conflict); + { set default external name in case of no external directive } + if (current_objectdef.objecttype=odt_javaclass) and + not gotexternal then + get_cpp_or_java_class_external_status(current_objectdef) end; odt_cppclass, - odt_javaclass, odt_interfacejava: get_cpp_or_java_class_external_status(current_objectdef); odt_objcclass,odt_objcprotocol,odt_objccategory: