From 423b5b900f4c1c2bb7e40deafd10cc71c2b462c4 Mon Sep 17 00:00:00 2001 From: "igor%mir2.org" Date: Fri, 15 Aug 2003 06:08:44 +0000 Subject: [PATCH] Removal of Token.TONUMBER: it had exactly the same semantics as Token.POS, that is to convert its argument to number. --- js/rhino/src/org/mozilla/javascript/IRFactory.java | 8 ++------ js/rhino/src/org/mozilla/javascript/Interpreter.java | 2 +- js/rhino/src/org/mozilla/javascript/Token.java | 12 +++++------- .../org/mozilla/javascript/optimizer/Codegen.java | 2 +- 4 files changed, 9 insertions(+), 15 deletions(-) diff --git a/js/rhino/src/org/mozilla/javascript/IRFactory.java b/js/rhino/src/org/mozilla/javascript/IRFactory.java index 4eb2e1e9aa6..c2891b193e1 100644 --- a/js/rhino/src/org/mozilla/javascript/IRFactory.java +++ b/js/rhino/src/org/mozilla/javascript/IRFactory.java @@ -839,10 +839,6 @@ public class IRFactory { } } - private Node createToNumber(Node expr) { - return new Node(Token.TONUMBER, expr); - } - private Node createSetName(int assignOp, Node left, Node right, boolean tonumber, boolean postfix) { @@ -861,7 +857,7 @@ public class IRFactory { Node opLeft = Node.newString(Token.NAME, s); if (tonumber) - opLeft = createToNumber(opLeft); + opLeft = new Node(Token.POS, opLeft); if (postfix) opLeft = createNewTemp(opLeft); Node op = new Node(assignOp, opLeft, right); @@ -985,7 +981,7 @@ public class IRFactory { } if (tonumber) - opLeft = createToNumber(opLeft); + opLeft = new Node(Token.POS, opLeft); if (postfix) opLeft = createNewTemp(opLeft); Node op = new Node(assignOp, opLeft, expr); diff --git a/js/rhino/src/org/mozilla/javascript/Interpreter.java b/js/rhino/src/org/mozilla/javascript/Interpreter.java index 2b7d6cae9f4..4c842332dbb 100644 --- a/js/rhino/src/org/mozilla/javascript/Interpreter.java +++ b/js/rhino/src/org/mozilla/javascript/Interpreter.java @@ -600,7 +600,7 @@ public class Interpreter itsStackDepth--; break; - case Token.TONUMBER: + case Token.POS: iCodeTop = generateICode(child, iCodeTop); iCodeTop = addToken(Token.POS, iCodeTop); break; diff --git a/js/rhino/src/org/mozilla/javascript/Token.java b/js/rhino/src/org/mozilla/javascript/Token.java index d718595d350..4d072f0622d 100644 --- a/js/rhino/src/org/mozilla/javascript/Token.java +++ b/js/rhino/src/org/mozilla/javascript/Token.java @@ -214,13 +214,12 @@ public class Token ENUMDONE = 115, EXPRSTMT = 116, PARENT = 117, - TONUMBER = 118, - JSR = 119, - NEWLOCAL = 120, - USELOCAL = 121, - SCRIPT = 122, // top-level node for entire script + JSR = 118, + NEWLOCAL = 119, + USELOCAL = 120, + SCRIPT = 121, // top-level node for entire script - LAST_TOKEN = 122; + LAST_TOKEN = 121; public static String name(int token) { @@ -345,7 +344,6 @@ public class Token case ENUMDONE: return "enumdone"; case EXPRSTMT: return "exprstmt"; case PARENT: return "parent"; - case TONUMBER: return "tonumber"; case JSR: return "jsr"; case NEWLOCAL: return "newlocal"; case USELOCAL: return "uselocal"; diff --git a/js/rhino/src/org/mozilla/javascript/optimizer/Codegen.java b/js/rhino/src/org/mozilla/javascript/optimizer/Codegen.java index db078a00c9c..82894275870 100644 --- a/js/rhino/src/org/mozilla/javascript/optimizer/Codegen.java +++ b/js/rhino/src/org/mozilla/javascript/optimizer/Codegen.java @@ -1280,7 +1280,7 @@ public class Codegen extends Interpreter { visitBitOp(node, type, child); break; - case Token.TONUMBER: + case Token.POS: addByteCode(ByteCode.NEW, "java/lang/Double"); addByteCode(ByteCode.DUP); generateCodeFromNode(child, node);