Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Browse files

Fix reproducing yields for annotations.

  • Loading branch information...
commit dc20ba84417fa76da5caf13df408ff11e133baab 1 parent df2cac2
Tomohiro Matsuyama authored
View
1  src/org/cx4a/rsense/typing/Template.java
@@ -20,6 +20,7 @@
import org.cx4a.rsense.typing.vertex.Vertex;
import org.cx4a.rsense.typing.vertex.YieldVertex;
import org.cx4a.rsense.typing.annotation.TypeVariable;
+import org.cx4a.rsense.util.Logger;
public class Template {
private Method method;
View
7 src/org/cx4a/rsense/typing/runtime/AnnotationResolver.java
@@ -28,6 +28,7 @@
import org.cx4a.rsense.typing.annotation.TypeApplication;
import org.cx4a.rsense.typing.annotation.TypeConstraint;
import org.cx4a.rsense.typing.vertex.Vertex;
+import org.cx4a.rsense.typing.vertex.YieldVertex;
import org.cx4a.rsense.util.Logger;
public class AnnotationResolver {
@@ -318,14 +319,16 @@ public boolean resolveMethodBlock(Template template, ClassType classType, Method
boolean succeed = false;
Vertex returnVertex;
if (args.length == 1) {
- returnVertex = RuntimeHelper.yield(graph, block, args[0], true, template.getReturnVertex());
+ YieldVertex vertex = new YieldVertex(null, template, block, graph.createFreeVertex(args[0]), true);
+ returnVertex = RuntimeHelper.yield(graph, vertex);
} else {
Vertex[] elements = new Vertex[args.length];
for (int i = 0; i < args.length; i++) {
elements[i] = graph.createFreeVertex();
elements[i].getTypeSet().addAll(args[i]);
}
- returnVertex = RuntimeHelper.yield(graph, block, new Array(runtime, elements), true, template.getReturnVertex());
+ YieldVertex vertex = new YieldVertex(null, template, block, graph.createFreeSingleTypeVertex(new Array(runtime, elements)), true);
+ returnVertex = RuntimeHelper.yield(graph, vertex);
}
if (returnVertex != null) {
View
6 src/org/cx4a/rsense/typing/vertex/YieldVertex.java
@@ -46,7 +46,7 @@ public boolean accept(Propagation propagation, Vertex src) {
@Override
public int hashCode() {
- return template.hashCode();
+ return template.getAttribute().hashCode();
}
@Override
@@ -60,6 +60,8 @@ public boolean equals(Object other) {
}
YieldVertex o = (YieldVertex) other;
- return template == o.template;
+ return template != null
+ && o.template != null
+ && template.getAttribute().equals(o.template.getAttribute());
}
}
Please sign in to comment.
Something went wrong with that request. Please try again.