# Path: pyjvm/prim.py
# PRIMITIVES = {'B': 'byte', 'C': 'char', 'D': 'double',
#               'F': 'float', 'I': 'int', 'J': 'long', 'S': 'short',
#               'Z': 'boolean'}


from pyjvm.prim import PRIMITIVES

# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
# GNU General Public License for more details.
#
# You should have received a copy of the GNU General Public License
# along with this program.  If not, see <http://www.gnu.org/licenses/>.
"""Major definitions for classes and instances"""



def checkcast(s, t, vm):
    '''Check if a is instance of b
    both are classes from vm.get_class(...) - JavaClass
    '''
    if s.is_array:
        if t.is_array:
            s_name = s.this_name
            assert s_name[0] == '['
            t_name = t.this_name
            assert t_name[0] == '['
            s_name = s_name[1:]
            t_name = t_name[1:]
            if s_name[0] == 'L':
                s_name = s_name[1:-1]
            else:
                s_name = PRIMITIVES[s_name]
            if t_name[0] == 'L':
                t_name = t_name[1:-1]
            else:

# Path: pyjvm/prim.py
# PRIMITIVES = {'B': 'byte', 'C': 'char', 'D': 'double',
#               'F': 'float', 'I': 'int', 'J': 'long', 'S': 'short',
#               'Z': 'boolean'}


# Path: pyjvm/checkcast.py
from pyjvm.prim import PRIMITIVES

# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
# GNU General Public License for more details.
#
# You should have received a copy of the GNU General Public License
# along with this program.  If not, see <http://www.gnu.org/licenses/>.
"""Major definitions for classes and instances"""



def checkcast(s, t, vm):
    '''Check if a is instance of b
    both are classes from vm.get_class(...) - JavaClass
    '''
    if s.is_array:
        if t.is_array:
            s_name = s.this_name
            assert s_name[0] == '['
            t_name = t.this_name
            assert t_name[0] == '['
            s_name = s_name[1:]
            t_name = t_name[1:]
            if s_name[0] == 'L':
                s_name = s_name[1:-1]
            else:
                s_name = PRIMITIVES[s_name]
            if t_name[0] == 'L':
                t_name = t_name[1:-1]
            else:

                t_name = PRIMITIVES[t_name]
