Skip to content

Commit

Permalink
inline function
Browse files Browse the repository at this point in the history
  • Loading branch information
yinwang0 committed Nov 14, 2016
1 parent 6df1c01 commit c7d791b
Showing 1 changed file with 11 additions and 10 deletions.
21 changes: 11 additions & 10 deletions src/main/java/org/yinwang/pysonar/visitor/TypeInferencer.java
Original file line number Diff line number Diff line change
Expand Up @@ -930,12 +930,6 @@ public void setAttr(Attribute node, State s, @NotNull Type v) {
}
}

private void addRef(Attribute node, @NotNull Set<Binding> bs) {
for (Binding b : bs) {
Analyzer.self.putRef(node.attr, b);
}
}

private void setAttrType(Attribute node, @NotNull Type targetType, @NotNull Type v)
{
if (targetType.isUnknownType())
Expand All @@ -959,15 +953,22 @@ private void setAttrType(Attribute node, @NotNull Type targetType, @NotNull Type
}
}

public Type getAttrType(Attribute node, @NotNull Type targetType) {
public Type getAttrType(Attribute node, @NotNull Type targetType)
{
Set<Binding> bs = targetType.table.lookupAttr(node.attr.id);
if (bs == null) {
if (bs == null)
{
addWarningToNode(node.attr, "attribute not found in type: " + targetType);
Type t = Types.UNKNOWN;
t.table.setPath(targetType.table.extendPath(node.attr.id));
return t;
} else {
addRef(node, bs);
}
else
{
for (Binding b : bs)
{
Analyzer.self.putRef(node.attr, b);
}
return State.makeUnion(bs);
}
}
Expand Down

0 comments on commit c7d791b

Please sign in to comment.