[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Soot typing failure



Here's a patch to be applied in the following context:

$ svn info
Path:
URL: https://svn.sable.mcgill.ca/soot/soot/trunk/src/soot/jimple/toolkits/typing
Repository UUID: 8cfe803f-38b8-0310-ad8c-c0bb4caa2ed3
Revision: 1320
Node Kind: directory
Schedule: normal
Last Changed Author: olhota
Last Changed Rev: 1320
Last Changed Date: 2003-11-22 19:21:47 -0500 (Sat, 22 Nov 2003)
Properties Last Updated: 2003-11-22 20:38:32 -0500 (Sat, 22 Nov 2003)

$ svn diff
Index: TypeNode.java
===================================================================
--- TypeNode.java       (revision 1320)
+++ TypeNode.java       (working copy)
@@ -450,11 +450,22 @@
   {
     if(type instanceof ArrayType ||
        type instanceof NullType ||
-       (type instanceof RefType))
+       type instanceof RefType)
       {
        return true;
       }

     return false;
   }
+
+  public boolean isArray()
+  {
+    if(type instanceof ArrayType ||
+       type instanceof NullType)
+      {
+       return true;
+      }
+
+    return false;
+  }
 }
Index: ConstraintChecker.java
===================================================================
--- ConstraintChecker.java      (revision 1320)
+++ ConstraintChecker.java      (working copy)
@@ -276,7 +276,7 @@
        ArrayRef ref = (ArrayRef) l;
        TypeNode base = hierarchy.typeNode(((Local) ref.getBase()).getType());

-       if(!base.hasElement())
+       if(!base.isArray())
          {
            error("Type Error(16)");
          }
@@ -342,7 +342,7 @@
        ArrayRef ref = (ArrayRef) r;
        TypeNode base = hierarchy.typeNode(((Local) ref.getBase()).getType());

-       if(!base.hasElement())
+       if(!base.isArray())
          {
            if(base == hierarchy.NULL)
            {
@@ -696,7 +696,7 @@

        if(le.getOp() instanceof Local)
          {
-           if(!hierarchy.typeNode(((Local) le.getOp()).getType()).hasElement())
+           if(!hierarchy.typeNode(((Local) le.getOp()).getType()).isArray())
              {
                error("Type Error(39)");
              }



Mainly, I added an explicit isArray() method that says YES for null_type, as it should.


Etienne


--
Etienne M. Gagnon, Ph.D.             http://www.info.uqam.ca/~egagnon/
SableVM:                                       http://www.sablevm.org/
SableCC:                                       http://www.sablecc.org/