瀏覽代碼

* handle constsyms without an associated type by generating a default type

git-svn-id: branches/jvmbackend@18485 -
Jonas Maebe 14 年之前
父節點
當前提交
ee9cfc8916
共有 1 個文件被更改,包括 24 次插入1 次删除
  1. 24 1
      compiler/jvmdef.pas

+ 24 - 1
compiler/jvmdef.pas

@@ -380,7 +380,30 @@ implementation
           constsym:
           constsym:
             begin
             begin
               csym:=tconstsym(sym);
               csym:=tconstsym(sym);
-              result:=jvmencodetype(csym.constdef);
+              { some constants can be untyped }
+              if assigned (csym.constdef) then
+                result:=jvmencodetype(csym.constdef)
+              else
+                begin
+                  case csym.consttyp of
+                    constord:
+                      result:=jvmencodetype(s32inttype);
+                    constreal:
+                      result:=jvmencodetype(s64floattype);
+                    constset:
+                      internalerror(2011040701);
+                    constpointer,
+                    constnil:
+                      result:=jvmencodetype(java_jlobject);
+                    constwstring,
+                    conststring:
+                      result:=jvmencodetype(java_jlstring);
+                    constguid:
+                      internalerror(2011040702);
+                    else
+                      internalerror(2011040703);
+                  end;
+                end;
               result:=usesymname+' '+result;
               result:=usesymname+' '+result;
             end;
             end;
           else
           else