summaryrefslogtreecommitdiff
path: root/sources/scalac/ast/TreeInfo.java
diff options
context:
space:
mode:
Diffstat (limited to 'sources/scalac/ast/TreeInfo.java')
-rw-r--r--sources/scalac/ast/TreeInfo.java15
1 files changed, 15 insertions, 0 deletions
diff --git a/sources/scalac/ast/TreeInfo.java b/sources/scalac/ast/TreeInfo.java
index fc12935250..19b2341f44 100644
--- a/sources/scalac/ast/TreeInfo.java
+++ b/sources/scalac/ast/TreeInfo.java
@@ -127,6 +127,21 @@ public class TreeInfo {
}
}
+ /** Is tree a self constructor call?
+ */
+ public static boolean isSelfConstrCall(Tree tree) {
+ switch (tree) {
+ case Ident(Name name):
+ return name == Names.CONSTRUCTOR;
+ case TypeApply(Tree constr, _):
+ return isSelfConstrCall(constr);
+ case Apply(Tree constr, _):
+ return isSelfConstrCall(constr);
+ default:
+ return false;
+ }
+ }
+
/** Is tree a variable pattern
*/
public static boolean isVarPattern(Tree pat) {