JavaMethod.st
changeset 428 4b400c64ccec
parent 427 a7083b7a8724
child 431 fe362bcc1aeb
equal deleted inserted replaced
427:a7083b7a8724 428:4b400c64ccec
  1474     ^ 'none'
  1474     ^ 'none'
  1475 
  1475 
  1476     "Created: 5.2.1997 / 11:31:26 / cg"
  1476     "Created: 5.2.1997 / 11:31:26 / cg"
  1477 !
  1477 !
  1478 
  1478 
       
  1479 quickLineNumberForPC:pc
       
  1480     |last|
       
  1481 
       
  1482     lineNumberTable notNil ifTrue:[
       
  1483         lineNumberTable pairWiseDo:[:lPc :lNr |
       
  1484             lPc >= pc ifTrue:[
       
  1485                 lPc == pc ifTrue:[^ lNr].
       
  1486                 last isNil ifTrue:[^ lNr].
       
  1487                 ^ last.
       
  1488             ].
       
  1489             last := lNr.
       
  1490         ].
       
  1491         last notNil ifTrue:[        
       
  1492             ^ last
       
  1493         ].
       
  1494         ^ lineNumberTable at:2
       
  1495     ].
       
  1496     ^ nil
       
  1497 
       
  1498     "Modified: / 14.1.1998 / 13:30:54 / cg"
       
  1499     "Created: / 10.11.1998 / 14:18:22 / cg"
       
  1500 !
       
  1501 
  1479 who
  1502 who
  1480     "return the class and selector of where I am defined in."
  1503     "return the class and selector of where I am defined in."
  1481 
  1504 
  1482     |sel|
  1505     |sel|
  1483 
  1506 
  1585 
  1608 
  1586 _checkCast:anObject class:aClassOrInterface
  1609 _checkCast:anObject class:aClassOrInterface
  1587     "trampouline for unhandled cases ..."
  1610     "trampouline for unhandled cases ..."
  1588 
  1611 
  1589     aClassOrInterface isBehavior ifTrue:[
  1612     aClassOrInterface isBehavior ifTrue:[
       
  1613         aClassOrInterface == ByteArray ifTrue:[
       
  1614             ^ anObject class == aClassOrInterface
       
  1615         ].
       
  1616 
  1590         aClassOrInterface isInterface ifTrue:[
  1617         aClassOrInterface isInterface ifTrue:[
  1591             (anObject class hasInterface:aClassOrInterface) ifTrue:[
  1618             (anObject class hasInterface:aClassOrInterface) ifTrue:[
  1592                 ^ true
  1619                 ^ true
  1593             ]
  1620             ]
  1594         ].
  1621         ].
  1595         ^ (anObject isKindOf:aClassOrInterface)
  1622         (anObject isKindOf:aClassOrInterface) ifTrue:[
       
  1623             ^ true
       
  1624         ].
       
  1625         anObject isArray ifTrue:[
       
  1626             ^ true
       
  1627         ].
       
  1628         self halt.
       
  1629         ^ false.
  1596     ].
  1630     ].
  1597     (aClassOrInterface isMemberOf:JavaClassPointerRef) ifTrue:[
  1631     (aClassOrInterface isMemberOf:JavaClassPointerRef) ifTrue:[
  1598         "/ must be a pointer to an array of that class
  1632         "/ must be a pointer to an array of that class
  1599 
  1633 
  1600         ^ anObject isArray 
  1634         anObject isArray ifTrue:[
       
  1635             ^ true
       
  1636         ].
       
  1637         self halt.
       
  1638         ^ false.
  1601     ].
  1639     ].
  1602     (aClassOrInterface isMemberOf:JavaBuiltInClassPointerRef) ifTrue:[
  1640     (aClassOrInterface isMemberOf:JavaBuiltInClassPointerRef) ifTrue:[
  1603         aClassOrInterface arrayClass == anObject class ifTrue:[
  1641         aClassOrInterface arrayClass == anObject class ifTrue:[
  1604             ^ true
  1642             ^ true
  1605         ].
  1643         ].
  1607 
  1645 
  1608     (anObject isMemberOf:Array) ifTrue:[
  1646     (anObject isMemberOf:Array) ifTrue:[
  1609         anObject size == 0 ifTrue:[
  1647         anObject size == 0 ifTrue:[
  1610             ^ true
  1648             ^ true
  1611         ].
  1649         ].
  1612         ^ self _checkCast:(anObject at:1) class:(aClassOrInterface deref).
  1650         (self _checkCast:(anObject at:1) class:(aClassOrInterface deref)) ifTrue:[
       
  1651             ^ true
       
  1652         ].
       
  1653         self halt.
       
  1654         ^ false
  1613     ].
  1655     ].
  1614     self halt.
  1656     self halt.
  1615     ^ false.
  1657     ^ false.
  1616 
  1658 
  1617     "Created: / 4.1.1998 / 16:44:59 / cg"
  1659     "Created: / 4.1.1998 / 16:44:59 / cg"
  1618     "Modified: / 25.1.1998 / 18:25:03 / cg"
  1660     "Modified: / 10.11.1998 / 01:51:01 / cg"
  1619 !
  1661 !
  1620 
  1662 
  1621 _d2l:op1
  1663 _d2l:op1
  1622     |v|
  1664     |v|
  1623 
  1665 
  1878 !
  1920 !
  1879 
  1921 
  1880 _multiNew:typeRef _:dim1 _:dim2
  1922 _multiNew:typeRef _:dim1 _:dim2
  1881     |clsRef cls arr elType elSizes|
  1923     |clsRef cls arr elType elSizes|
  1882 
  1924 
       
  1925     typeRef == Array ifTrue:[
       
  1926         self halt.
       
  1927     ].
       
  1928 
  1883     clsRef := typeRef asClassPointerRef.
  1929     clsRef := typeRef asClassPointerRef.
  1884     cls := clsRef arrayClass.
  1930     cls := clsRef arrayClass.
  1885     arr := cls new:dim2.
  1931     arr := cls new:dim2.
  1886 
  1932 
  1887     elType := typeRef deref.
  1933     elType := typeRef deref.
  1891     ].
  1937     ].
  1892 
  1938 
  1893     ^ arr
  1939     ^ arr
  1894 
  1940 
  1895     "Created: / 6.1.1998 / 23:15:47 / cg"
  1941     "Created: / 6.1.1998 / 23:15:47 / cg"
  1896     "Modified: / 6.1.1998 / 23:34:28 / cg"
  1942     "Modified: / 10.11.1998 / 02:09:35 / cg"
  1897 !
  1943 !
  1898 
  1944 
  1899 _multiNew:typeRef _:dim1 _:dim2 _:dim3
  1945 _multiNew:typeRef _:dim1 _:dim2 _:dim3
  1900     |clsRef cls arr elType elSizes|
  1946     |clsRef cls arr elType elSizes|
  1901 
  1947 
  1979 ! !
  2025 ! !
  1980 
  2026 
  1981 !JavaMethod class methodsFor:'documentation'!
  2027 !JavaMethod class methodsFor:'documentation'!
  1982 
  2028 
  1983 version
  2029 version
  1984     ^ '$Header: /home/jv/Projects/SmalltalkX/repositories/cvs/stx/libjava/JavaMethod.st,v 1.76 1998/11/10 00:22:39 cg Exp $'
  2030     ^ '$Header: /home/jv/Projects/SmalltalkX/repositories/cvs/stx/libjava/JavaMethod.st,v 1.77 1998/11/10 14:29:25 cg Exp $'
  1985 ! !
  2031 ! !
  1986 JavaMethod initialize!
  2032 JavaMethod initialize!