ソースを参照

* allow explicit conversion of enumeration values (in addition to integers) to object references in Delphi mode

git-svn-id: trunk@11398 -
tom_at_work 17 年 前
コミット
6958bbfdda
2 ファイル変更16 行追加10 行削除
  1. 1 1
      compiler/defcmp.pas
  2. 15 9
      compiler/raatt.pas

+ 1 - 1
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

+ 15 - 9
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 handlepercent;virtual;
+       private
+         Function is_asmdirective(const s: string):boolean;
          procedure GetToken;
-         function consume(t : tasmtoken):boolean;
+       protected
+         function is_locallabel(const s: string):boolean;
          procedure RecoverConsume(allowcomma:boolean);
-         procedure handlepercent;virtual;
+         function consume(t : tasmtoken):boolean;
        end;
        tcattreader = class of tattreader;