Background
The named-import lowering (lower/expr_call/globals.rs:761-836) and the dotted-call lowering (lower/expr_call/module_static.rs:856-918) build identical Expr::Call { callee: PropertyGet { object: NativeModuleRef(\"crypto\"), property }, args, ... } for the same crypto methods. The two lists must be kept in sync manually; #1419 added several methods and both call sites needed parallel edits.
Scope
- Add
pub(crate) fn lower_crypto_method_passthrough(method: &str, args: Vec<Expr>) -> Expr to lower/expr_call/mod.rs (or a new crypto.rs submodule).
- Replace both call sites with calls to the helper.
- Methods passed through identical-shape: createHash, createSign, createVerify, createECDH, createDiffieHellman, ..., hkdfSync, scryptSync, sign, verify, publicEncrypt, privateDecrypt, generatePrime, etc.
Pure refactor, behavior identical. Tracked under #793.
Background
The named-import lowering (
lower/expr_call/globals.rs:761-836) and the dotted-call lowering (lower/expr_call/module_static.rs:856-918) build identicalExpr::Call { callee: PropertyGet { object: NativeModuleRef(\"crypto\"), property }, args, ... }for the same crypto methods. The two lists must be kept in sync manually; #1419 added several methods and both call sites needed parallel edits.Scope
pub(crate) fn lower_crypto_method_passthrough(method: &str, args: Vec<Expr>) -> Exprtolower/expr_call/mod.rs(or a newcrypto.rssubmodule).Pure refactor, behavior identical. Tracked under #793.