Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
12 changes: 11 additions & 1 deletion src/main/java/org/yinwang/rubysonar/ast/Call.java
Original file line number Diff line number Diff line change
Expand Up @@ -82,10 +82,13 @@ public Type transform(State s) {
}
}

// Class.new
Name newName = null;
Type clsType = null;
if (func instanceof Attribute) {
Attribute afun = (Attribute) func;
clsType = afun.target.transform(s);

// Class.new
if (afun.attr.id.equals("new")) {
func = afun.target;
newName = afun.attr;
Expand All @@ -104,6 +107,13 @@ public Type transform(State s) {
}

Type fun = transformExpr(func, s);

// `self` refers to current class
if (clsType != null && fun instanceof FunType) {
((FunType) fun).env.update(
Constants.SELFNAME, clsType.table.lookupAttr(Constants.SELFNAME));
}

List<Type> pos = resolveList(args, s);
Map<String, Type> hash = new HashMap<>();

Expand Down