|
1464 | 1464 | (defn analyze-call [ctx expr m top-level?] |
1465 | 1465 | (with-top-level-loc top-level? m |
1466 | 1466 | (try |
1467 | | - (let [f (first expr)] |
1468 | | - (cond (symbol? f) |
1469 | | - (let [fsym f |
| 1467 | + (let [f* (first expr)] |
| 1468 | + (cond (symbol? f*) |
| 1469 | + (let [fsym f* |
1470 | 1470 | ;; in call position Clojure prioritizes special symbols over |
1471 | 1471 | ;; bindings |
1472 | | - special-sym (get special-syms f) |
| 1472 | + special-sym (get special-syms f*) |
1473 | 1473 | _ (when (and special-sym |
1474 | 1474 | (:check-permissions ctx)) |
1475 | | - (resolve/check-permission! ctx f [special-sym nil])) |
| 1475 | + (resolve/check-permission! ctx f* [special-sym nil])) |
1476 | 1476 | f (or special-sym |
1477 | | - (resolve/resolve-symbol ctx f true)) |
| 1477 | + (resolve/resolve-symbol ctx f* true)) |
1478 | 1478 | f-meta (meta f) |
1479 | 1479 | eval? (and f-meta (:sci.impl/op f-meta)) |
1480 | 1480 | fast-path (-> f-meta :sci.impl/fast-path) |
|
1555 | 1555 | :sci.impl/f-meta f-meta) |
1556 | 1556 | ^"[Ljava.lang.Class;" arg-types (when (pos? arg-count) |
1557 | 1557 | (make-array Class arg-count)) |
1558 | | - has-types? (volatile! nil)] |
| 1558 | + has-types? (volatile! nil) |
| 1559 | + ] |
1559 | 1560 | (when arg-types |
1560 | | - (areduce args idx _ret nil |
1561 | | - (let [arg (aget args idx) |
1562 | | - arg-meta (meta arg)] |
1563 | | - (when-let [t (:tag arg-meta)] |
1564 | | - (when-let [t (interop/resolve-type-hint ctx t)] |
1565 | | - (do (vreset! has-types? true) |
1566 | | - (aset arg-types idx t))))))) |
| 1561 | + (or (when-let [param-tags (-> f* (some-> meta :param-tags))] |
| 1562 | + (vreset! has-types? true) |
| 1563 | + ;; TODO: take into account wildcard _ class! |
| 1564 | + (areduce arg-types idx _ret nil |
| 1565 | + (when-let [t (nth param-tags idx)] |
| 1566 | + (when-let [t (interop/resolve-type-hint ctx t)] |
| 1567 | + (aset arg-types idx t))))) |
| 1568 | + (areduce args idx _ret nil |
| 1569 | + (let [arg (aget args idx) |
| 1570 | + arg-meta (meta arg)] |
| 1571 | + (when-let [t (:tag arg-meta)] |
| 1572 | + (when-let [t (interop/resolve-type-hint ctx t)] |
| 1573 | + (do (vreset! has-types? true) |
| 1574 | + (aset arg-types idx t)))))))) |
1567 | 1575 | (sci.impl.types/->Node |
1568 | 1576 | (let [obj (sci.impl.types/eval obj ctx bindings)] |
1569 | 1577 | (interop/invoke-instance-method ctx bindings obj clazz |
|
1656 | 1664 | :file @utils/current-file |
1657 | 1665 | :sci.impl/f-meta f-meta)] |
1658 | 1666 | (sci.impl.types/->Node nil stack))))))) |
1659 | | - (keyword? f) |
| 1667 | + (keyword? f*) |
1660 | 1668 | (let [children (analyze-children ctx (rest expr)) |
1661 | 1669 | ccount (count children)] |
1662 | 1670 | (case ccount |
1663 | 1671 | 1 (let [arg (nth children 0)] |
1664 | 1672 | (sci.impl.types/->Node |
1665 | | - (f (t/eval arg ctx bindings)) |
| 1673 | + (f* (t/eval arg ctx bindings)) |
1666 | 1674 | nil)) |
1667 | 1675 | 2 (let [arg0 (nth children 0) |
1668 | 1676 | arg1 (nth children 1)] |
1669 | 1677 | (sci.impl.types/->Node |
1670 | | - (f (t/eval arg0 ctx bindings) |
| 1678 | + (f* (t/eval arg0 ctx bindings) |
1671 | 1679 | (t/eval arg1 ctx bindings)) |
1672 | 1680 | nil)) |
1673 | | - (throw-error-with-location (str "Wrong number of args (" ccount ") passed to: " f) expr))) |
| 1681 | + (throw-error-with-location (str "Wrong number of args (" ccount ") passed to: " f*) expr))) |
1674 | 1682 | :else |
1675 | | - (let [f (analyze ctx f) |
| 1683 | + (let [f (analyze ctx f*) |
1676 | 1684 | children (analyze-children ctx (rest expr)) |
1677 | 1685 | stack (assoc m |
1678 | 1686 | :ns @utils/current-ns |
|
0 commit comments