已合并
Fix hooks method when reset parameter #6
Fix hooks method when reset parameter #6
已合并
guozejun创建于 2025年10月21日
1 个文件变更+7-1
Markgen/src/printers/ModifierPrinter.ts+7-1
@@ -418,7 +418,13 @@ class ModifiersFileVisitor {
418 switchPrinter.print(`default: {`)418 switchPrinter.print(`default: {`)
419 switchPrinter.pushIndent()419 switchPrinter.pushIndent()
420 switchPrinter.print(`this.${this.generateFiledFlag(attribute)} = AttributeUpdaterFlag.INITIAL;`)420 switchPrinter.print(`this.${this.generateFiledFlag(attribute)} = AttributeUpdaterFlag.INITIAL;`)
421- if (attribute.isOptional) switchPrinter.print(`${resetStatement.asString()};`)421+ if (attribute.isOptional) {
422+ if (hookRecord && hookRecord.replaceImplementation) {
423+ switchPrinter.print(`${switchPrinter.makeFunctionCall(hookRecord.hookName, [switchPrinter.makeThis(), ...resetParams]).asString()};`)
424+ } else {
425+ switchPrinter.print(`${resetStatement.asString()};`)
pavelmironchik
pavelmironchikpavelmironchik2025年10月21日

would be better to use writeStatement, it will do the same thing but will be more verbal

likedislike
426+ }
427+ }
422 switchPrinter.popIndent()428 switchPrinter.popIndent()
423 switchPrinter.print(`}`)429 switchPrinter.print(`}`)
424 switchPrinter.popIndent()430 switchPrinter.popIndent()