From 848d9a68a9e45a78ad991e8c3210d01b9486c18d Mon Sep 17 00:00:00 2001 From: paltherr Date: Sat, 13 Mar 2004 15:56:39 +0000 Subject: - In class Name renamed sub, pos, lastPos into ... - In class Name renamed sub, pos, lastPos into charAt, indexOf, - lastIndexOf In those methdos, replaced byte by char --- .../scalac/ast/parser/PatternNormalizer.scala | 2 +- sources/scalac/symtab/Definitions.java | 12 +++++----- sources/scalac/symtab/Symbol.java | 2 +- sources/scalac/symtab/classfile/ConstantPool.java | 2 +- sources/scalac/util/Name.java | 28 +++++++++++----------- 5 files changed, 23 insertions(+), 23 deletions(-) diff --git a/sources/scala/tools/scalac/ast/parser/PatternNormalizer.scala b/sources/scala/tools/scalac/ast/parser/PatternNormalizer.scala index 2c0acff4f2..ab068f8c35 100644 --- a/sources/scala/tools/scalac/ast/parser/PatternNormalizer.scala +++ b/sources/scala/tools/scalac/ast/parser/PatternNormalizer.scala @@ -95,7 +95,7 @@ package scala.tools.scalac.ast.parser { case Tree$Ident( vble ) => if (inAlt && vble.isVariable() && vble != Names.PATTERN_WILDCARD && - vble.lastPos('$') == -1) { + vble.lastIndexOf('$') == -1) { unit.error( t.pos, "variable not allowed under alternative"); return false; } else if(( this.boundVars.containsKey( vble /*t.symbol()*/ )) diff --git a/sources/scalac/symtab/Definitions.java b/sources/scalac/symtab/Definitions.java index 09d996915b..0fa7c88e25 100644 --- a/sources/scalac/symtab/Definitions.java +++ b/sources/scalac/symtab/Definitions.java @@ -620,11 +620,11 @@ public class Definitions { public Symbol getModule(Name fullname, boolean fail) { Scope scope = ROOT_CLASS.members(); int i = 0; - int j = fullname.pos((byte)'.', i); - while (j < fullname.length()) { + int j = fullname.indexOf('.', i); + while (j >= 0) { scope = scope.lookup(fullname.subName(i, j)).members(); i = j + 1; - j = fullname.pos((byte)'.', i); + j = fullname.indexOf('.', i); } Symbol sym = scope.lookup(fullname.subName(i, fullname.length())); if (!sym.isModule()) { @@ -648,11 +648,11 @@ public class Definitions { public Symbol getClass(Name fullname) { Scope scope = ROOT_CLASS.members(); int i = 0; - int j = fullname.pos((byte)'.', i); - while (j < fullname.length()) { + int j = fullname.indexOf('.', i); + while (j >= 0) { scope = scope.lookup(fullname.subName(i, j)).members(); i = j + 1; - j = fullname.pos((byte)'.', i); + j = fullname.indexOf('.', i); } Symbol sym = scope.lookup(fullname.subName(i, fullname.length()).toTypeName()); assert sym.kind != Kinds.NONE : "no class '" + fullname + "'"; diff --git a/sources/scalac/symtab/Symbol.java b/sources/scalac/symtab/Symbol.java index dc3569ed67..84cb83c5bb 100644 --- a/sources/scalac/symtab/Symbol.java +++ b/sources/scalac/symtab/Symbol.java @@ -701,7 +701,7 @@ public abstract class Symbol implements Modifiers, Kinds { } public final boolean isGenerated() { - return name.pos((byte)'$') < name.length(); + return name.indexOf('$') < name.length(); } /** Symbol was preloaded from package diff --git a/sources/scalac/symtab/classfile/ConstantPool.java b/sources/scalac/symtab/classfile/ConstantPool.java index a4113ed9e7..6cd21b32c6 100644 --- a/sources/scalac/symtab/classfile/ConstantPool.java +++ b/sources/scalac/symtab/classfile/ConstantPool.java @@ -78,7 +78,7 @@ public class ConstantPool implements ClassfileConstants { * corresponding type; otherwise return a class definition with given name */ protected Object classOrType(Name name) { - if ((name.sub(0) == '[') || (name.sub(name.length() - 1) == ';')) { + if ((name.charAt(0) == '[') || (name.charAt(name.length() - 1) == ';')) { byte[] ascii = name.toAscii(); return sigparser.sigToType(ascii, 0, ascii.length); } else diff --git a/sources/scalac/util/Name.java b/sources/scalac/util/Name.java index 8585139c78..6db5ced772 100644 --- a/sources/scalac/util/Name.java +++ b/sources/scalac/util/Name.java @@ -201,30 +201,30 @@ public final class Name { return len; } -/** returns i'th byte of this name +/** returns i'th char of this name */ - public byte sub(int i) { - return names[index + i]; + public char charAt(int i) { + return (char)names[index + i]; } -/** returns first occurrence of byte b in this name, len if not found +/** returns first occurrence of char c in this name, -1 if not found */ - public int pos(byte b) { - return pos(b, 0); + public int indexOf(char c) { + return indexOf(c, 0); } -/** returns first occurrence of byte b in this name from `start', len if not found +/** returns first occurrence of char c in this name from `start', -1 if not found */ - public int pos(byte b, int start) { - int i = start; - while (i < len && names[index + i] != b) - i++; - return i; + public int indexOf(char c, int start) { + byte b = (byte)c; + for (int i = start; i < len; i++) if (names[index + i] == b) return i; + return -1; } -/** returns last occurrence of byte b in this name, -1 if not found. +/** returns last occurrence of char c in this name, -1 if not found. */ - public int lastPos(byte b) { + public int lastIndexOf(byte c) { + byte b = (byte)c; int i = len - 1; while (i >= 0 && names[index + i] != b) i--; -- cgit v1.2.3