summaryrefslogtreecommitdiff
path: root/chapter04/src/main/java/com
diff options
context:
space:
mode:
authorHsiang-Ying Fu <66062782+fuhsnn@users.noreply.github.com>2026-09-27 23:54:55 +0800
committerGitHub <noreply@github.com>2026-09-27 08:54:55 -0700
commit837b6ae9cc19efb569f69422f6b82034b61e8ffe (patch)
tree0fc2aeca6ad1d1e09212155af2d51b59e077dec8 /chapter04/src/main/java/com
parentc5ef4e52fd7d183861b33476db999fa04f777607 (diff)
downloadSimple-837b6ae9cc19efb569f69422f6b82034b61e8ffe.tar.gz
Simple-837b6ae9cc19efb569f69422f6b82034b61e8ffe.zip
Use consistent implementation for Node::peephole() (#255)
Diffstat (limited to 'chapter04/src/main/java/com')
-rw-r--r--chapter04/src/main/java/com/seaofnodes/simple/node/Node.java6
1 files changed, 3 insertions, 3 deletions
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. </li>
* </ul>
*/
- 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;
}