X-Git-Url: http://git.phpeclipse.com diff --git a/net.sourceforge.phpeclipse/src/net/sourceforge/phpdt/internal/compiler/lookup/BaseTypeBinding.java b/net.sourceforge.phpeclipse/src/net/sourceforge/phpdt/internal/compiler/lookup/BaseTypeBinding.java index 2115b38..55cedda 100644 --- a/net.sourceforge.phpeclipse/src/net/sourceforge/phpdt/internal/compiler/lookup/BaseTypeBinding.java +++ b/net.sourceforge.phpeclipse/src/net/sourceforge/phpdt/internal/compiler/lookup/BaseTypeBinding.java @@ -12,147 +12,176 @@ package net.sourceforge.phpdt.internal.compiler.lookup; public final class BaseTypeBinding extends TypeBinding { public char[] simpleName; - private char [] constantPoolName; -BaseTypeBinding(int id, char[] name, char[] constantPoolName) { - this.tagBits |= IsBaseType; - this.id = id; - this.simpleName = name; - this.constantPoolName = constantPoolName; -} -/* Answer the receiver's constant pool name. -*/ -public char[] constantPoolName() { - return constantPoolName; -} -public PackageBinding getPackage() { - return null; -} -/* Answer true if the receiver type can be assigned to the argument type (right) -*/ - -public final boolean isCompatibleWith(TypeBinding right) { - if (this == right) - return true; - if (!right.isBaseType()) - return this == NullBinding; - - switch (right.id) { - case T_boolean : - case T_byte : - case T_char : + private char[] constantPoolName; + + BaseTypeBinding(int id, char[] name, char[] constantPoolName) { + this.tagBits |= IsBaseType; + this.id = id; + this.simpleName = name; + this.constantPoolName = constantPoolName; + } + + /* + * Answer the receiver's constant pool name. + */ + + public char[] constantPoolName() { + return constantPoolName; + } + + public PackageBinding getPackage() { + return null; + } + + /* + * Answer true if the receiver type can be assigned to the argument type + * (right) + */ + + public final boolean isCompatibleWith(TypeBinding right) { + if (this == right) + return true; + if (!right.isBaseType()) + return this == NullBinding; + + switch (right.id) { + case T_boolean: + case T_byte: + case T_char: return false; - case T_double : + case T_double: switch (id) { - case T_byte : - case T_char : - case T_short : - case T_int : - case T_long : - case T_float : - return true; - default : - return false; + case T_byte: + case T_char: + case T_short: + case T_int: + case T_long: + case T_float: + return true; + default: + return false; } - case T_float : + case T_float: switch (id) { - case T_byte : - case T_char : - case T_short : - case T_int : - case T_long : - return true; - default : - return false; + case T_byte: + case T_char: + case T_short: + case T_int: + case T_long: + return true; + default: + return false; } - case T_long : + case T_long: switch (id) { - case T_byte : - case T_char : - case T_short : - case T_int : - return true; - default : - return false; + case T_byte: + case T_char: + case T_short: + case T_int: + return true; + default: + return false; } - case T_int : + case T_int: switch (id) { - case T_byte : - case T_char : - case T_short : - return true; - default : - return false; + case T_byte: + case T_char: + case T_short: + return true; + default: + return false; } - case T_short : + case T_short: return (id == T_byte); + } + return false; } - return false; -} -public static final boolean isNarrowing(int left, int right) { - //can "left" store a "right" using some narrowing conversion - //(is left smaller than right) - switch (left) { - case T_boolean : + public static final boolean isNarrowing(int left, int right) { + // can "left" store a "right" using some narrowing conversion + // (is left smaller than right) + + switch (left) { + case T_boolean: return right == T_boolean; - case T_char : - case T_byte : - if (right == T_byte) return true; - case T_short : - if (right == T_short) return true; - if (right == T_char) return true; - case T_int : - if (right == T_int) return true; - case T_long : - if (right == T_long) return true; - case T_float : - if (right == T_float) return true; - case T_double : - if (right == T_double) return true; - default : + case T_char: + case T_byte: + if (right == T_byte) + return true; + case T_short: + if (right == T_short) + return true; + if (right == T_char) + return true; + case T_int: + if (right == T_int) + return true; + case T_long: + if (right == T_long) + return true; + case T_float: + if (right == T_float) + return true; + case T_double: + if (right == T_double) + return true; + default: return false; + } } -} -public static final boolean isWidening(int left, int right) { - //can "left" store a "right" using some widening conversion - //(is left "bigger" than right) - switch (left) { - case T_boolean : + public static final boolean isWidening(int left, int right) { + // can "left" store a "right" using some widening conversion + // (is left "bigger" than right) + + switch (left) { + case T_boolean: return right == T_boolean; - case T_char : + case T_char: return right == T_char; - case T_double : - if (right == T_double) return true; - case T_float : - if (right == T_float) return true; - case T_long : - if (right == T_long) return true; - case T_int : - if (right == T_int) return true; - if (right == T_char) return true; - case T_short : - if (right == T_short) return true; - case T_byte : - if (right == T_byte) return true; - default : + case T_double: + if (right == T_double) + return true; + case T_float: + if (right == T_float) + return true; + case T_long: + if (right == T_long) + return true; + case T_int: + if (right == T_int) + return true; + if (right == T_char) + return true; + case T_short: + if (right == T_short) + return true; + case T_byte: + if (right == T_byte) + return true; + default: return false; + } + } + + public char[] qualifiedSourceName() { + return simpleName; + } + + public char[] readableName() { + return simpleName; + } + + public char[] shortReadableName() { + return simpleName; + } + + public char[] sourceName() { + return simpleName; + } + + public String toString() { + return new String(constantPoolName) + " (id=" + id + ")"; //$NON-NLS-1$ //$NON-NLS-2$ } -} -public char[] qualifiedSourceName() { - return simpleName; -} -public char[] readableName() { - return simpleName; -} -public char[] shortReadableName(){ - return simpleName; -} -public char[] sourceName() { - return simpleName; -} -public String toString() { - return new String(constantPoolName) + " (id=" + id + ")"; //$NON-NLS-1$ //$NON-NLS-2$ -} }