From 837b6ae9cc19efb569f69422f6b82034b61e8ffe Mon Sep 17 00:00:00 2001 From: Hsiang-Ying Fu <66062782+fuhsnn@users.noreply.github.com> Date: Sun, 27 Sep 2026 23:54:55 +0800 Subject: Use consistent implementation for Node::peephole() (#255) --- chapter04/src/main/java/com/seaofnodes/simple/node/Node.java | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) (limited to 'chapter04/src/main') diff --git a/chapter04/src/main/java/com/seaofnodes/simple/node/Node.java b/chapter04/src/main/java/com/seaofnodes/simple/node/Node.java index 2a4aad2f..4f196805 100644 --- a/chapter04/src/main/java/com/seaofnodes/simple/node/Node.java +++ b/chapter04/src/main/java/com/seaofnodes/simple/node/Node.java @@ -224,13 +224,13 @@ public abstract class Node { * code. * */ - public final Node peephole( ) { + public final Node peephole() { var obs = Parser.PARSER == null ? null : Parser.PARSER._obs; - Type old = _type; if( obs != null ) obs.before(this); + Type old = _type; Node n = peepholeOpt(); Node rez = n == null ? this : n; - if( obs != null ) obs.after(this, n != null || old != _type ? rez : null, false); + if( obs != null ) obs.after(this, n == null && old == _type ? null : rez, false); return rez; } -- cgit v1.2.3