Mercurial > hg > graal-compiler
comparison graal/com.oracle.truffle.dsl.processor/src/com/oracle/truffle/dsl/processor/model/TemplateMethod.java @ 20940:476374f3fe9a
Truffle-DSL: generate better polymorphic execute signatures
author | Christian Humer <christian.humer@gmail.com> |
---|---|
date | Tue, 14 Apr 2015 15:12:48 +0200 |
parents | 18c0f02fa4d2 |
children | 6361fa2e3321 |
comparison
equal
deleted
inserted
replaced
20939:f83fd99b2962 | 20940:476374f3fe9a |
---|---|
71 | 71 |
72 public final Parameter getFrame() { | 72 public final Parameter getFrame() { |
73 return findParameter(FRAME_NAME); | 73 return findParameter(FRAME_NAME); |
74 } | 74 } |
75 | 75 |
76 public void removeParameter(Parameter p) { | |
77 this.parameters.remove(p); | |
78 this.parameterCache.remove(p.getLocalName()); | |
79 p.setMethod(this); | |
80 } | |
81 | |
82 public void addParameter(int index, Parameter p) { | |
83 this.parameters.add(index, p); | |
84 this.parameterCache.put(p.getLocalName(), p); | |
85 p.setMethod(this); | |
86 } | |
87 | |
76 public String createReferenceName() { | 88 public String createReferenceName() { |
77 if (getMethod() == null) { | 89 if (getMethod() == null) { |
78 return "-"; | 90 return "-"; |
79 } | 91 } |
80 return ElementUtils.createReferenceName(getMethod()); | 92 return ElementUtils.createReferenceName(getMethod()); |
130 } | 142 } |
131 | 143 |
132 public void replaceParameter(String localName, Parameter newParameter) { | 144 public void replaceParameter(String localName, Parameter newParameter) { |
133 if (returnType.getLocalName().equals(localName)) { | 145 if (returnType.getLocalName().equals(localName)) { |
134 returnType = newParameter; | 146 returnType = newParameter; |
135 returnType.setMethod(this); | |
136 } else { | 147 } else { |
137 Parameter local = findParameter(localName); | 148 Parameter local = findParameter(localName); |
138 int index = parameters.indexOf(local); | 149 int index = parameters.indexOf(local); |
139 parameters.set(index, newParameter); | 150 parameters.set(index, newParameter); |
140 } | 151 } |
152 parameterCache.put(newParameter.getLocalName(), newParameter); | |
153 newParameter.setMethod(this); | |
141 } | 154 } |
142 | 155 |
143 public Iterable<Parameter> getSignatureParameters() { | 156 public Iterable<Parameter> getSignatureParameters() { |
144 return new FilteredIterable<>(getParameters(), new Predicate<Parameter>() { | 157 return new FilteredIterable<>(getParameters(), new Predicate<Parameter>() { |
145 public boolean evaluate(Parameter value) { | 158 public boolean evaluate(Parameter value) { |