summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorpaltherr <paltherr@epfl.ch>2003-09-03 08:49:40 +0000
committerpaltherr <paltherr@epfl.ch>2003-09-03 08:49:40 +0000
commitc52494a7e00a0febb924381994d3c359c7dd52ab (patch)
treeb0fc61f28a52cbad22d05889659c9c4ddd17d437
parent7e8423ed479be6a71f5ba9a59143757cc8f284d1 (diff)
downloadscala-c52494a7e00a0febb924381994d3c359c7dd52ab.tar.gz
scala-c52494a7e00a0febb924381994d3c359c7dd52ab.tar.bz2
scala-c52494a7e00a0febb924381994d3c359c7dd52ab.zip
- Renamed isFinal into isMethodFinal
- Moved additional tests from TailCall into method isMethodFinal
-rw-r--r--sources/scalac/symtab/Symbol.java10
-rw-r--r--sources/scalac/transformer/TailCall.java5
2 files changed, 8 insertions, 7 deletions
diff --git a/sources/scalac/symtab/Symbol.java b/sources/scalac/symtab/Symbol.java
index 5acaec4dee..e87c4d201e 100644
--- a/sources/scalac/symtab/Symbol.java
+++ b/sources/scalac/symtab/Symbol.java
@@ -250,9 +250,13 @@ public abstract class Symbol implements Modifiers, Kinds {
return kind == VAL && (flags & MUTABLE) != 0;
}
- /** Does this symbol denote a final symbol? */
- public final boolean isFinal() {
- return (flags & FINAL) != 0;
+ /**
+ * Does this symbol denote a final method? A final method is one
+ * that can't be overridden in a subclass. This method assumes
+ * that this symbol denotes a method. It doesn't test it.
+ */
+ public final boolean isMethodFinal() {
+ return (flags & FINAL) != 0 || isPrivate() || isLifted();
}
/** Does this symbol denote a sealed class symbol? */
diff --git a/sources/scalac/transformer/TailCall.java b/sources/scalac/transformer/TailCall.java
index 19914f78ba..39095ac5d6 100644
--- a/sources/scalac/transformer/TailCall.java
+++ b/sources/scalac/transformer/TailCall.java
@@ -152,10 +152,7 @@ public class TailCall extends Transformer {
(qual instanceof This && qual.symbol() == state.currentClass)){
// We can only rewrite final functions in a safe way.
- if(state.currentFunction.isFinal() ||
- state.currentFunction.isPrivate() ||
- state.currentFunction.isLifted()
- ) { // It would be nice if we had a cant-be-overridden function in symbol...
+ if(state.currentFunction.isMethodFinal()) {
Tree[] newArgs = tail_transform(args,false);
// Redirect the call to the LabelDef.