From 6958bbfdda76ff69d6c28cb5fbe726b25f17e800 Mon Sep 17 00:00:00 2001 From: tom_at_work Date: Fri, 18 Jul 2008 15:30:20 +0000 Subject: [PATCH] * allow explicit conversion of enumeration values (in addition to integers) to object references in Delphi mode git-svn-id: trunk@11398 - --- compiler/defcmp.pas | 2 +- compiler/raatt.pas | 26 ++++++++++++++++---------- 2 files changed, 17 insertions(+), 11 deletions(-) diff --git a/compiler/defcmp.pas b/compiler/defcmp.pas index b36909247d..42626e0d83 100644 --- a/compiler/defcmp.pas +++ b/compiler/defcmp.pas @@ -1259,7 +1259,7 @@ implementation end { ugly, but delphi allows it } else if (eq=te_incompatible) and - (def_from.typ=orddef) and + (def_from.typ in [orddef,enumdef]) and (m_delphi in current_settings.modeswitches) and (cdo_explicit in cdoptions) then begin diff --git a/compiler/raatt.pas b/compiler/raatt.pas index cf8c0edce6..a40a5bf760 100644 --- a/compiler/raatt.pas +++ b/compiler/raatt.pas @@ -79,26 +79,32 @@ unit raatt; type tattreader = class(tasmreader) + protected actasmtoken : tasmtoken; prevasmtoken : tasmtoken; - procedure SetupTables; - procedure BuildConstant(constsize: byte); + procedure BuildRecordOffsetSize(const expr: string;var offset:aint;var size:aint; var mangledname: string; needvmtofs: boolean); + function BuildConstExpression(allowref,betweenbracket:boolean): aint; + procedure BuildConstSymbolExpression(allowref,betweenbracket,needofs:boolean;var value:aint;var asmsym:string;var asmsymtyp:TAsmsymtype); procedure BuildConstantOperand(oper : toperand); + procedure BuildConstant(constsize: byte); procedure BuildRealConstant(typ : tfloattype); procedure BuildStringConstant(asciiz: boolean); - procedure BuildRecordOffsetSize(const expr: string;var offset:aint;var size:aint; var mangledname: string; needvmtofs: boolean); - procedure BuildConstSymbolExpression(allowref,betweenbracket,needofs:boolean;var value:aint;var asmsym:string;var asmsymtyp:TAsmsymtype); - function BuildConstExpression(allowref,betweenbracket:boolean): aint; + private + procedure SetupTables; + public function Assemble: tlinkedlist;override; + protected procedure handleopcode;virtual;abstract; function is_asmopcode(const s: string) : boolean;virtual;abstract; - Function is_asmdirective(const s: string):boolean; function is_register(const s:string):boolean;virtual; - function is_locallabel(const s: string):boolean; - procedure GetToken; - function consume(t : tasmtoken):boolean; - procedure RecoverConsume(allowcomma:boolean); procedure handlepercent;virtual; + private + Function is_asmdirective(const s: string):boolean; + procedure GetToken; + protected + function is_locallabel(const s: string):boolean; + procedure RecoverConsume(allowcomma:boolean); + function consume(t : tasmtoken):boolean; end; tcattreader = class of tattreader;