| 244 | } |
| 245 | } |
| 246 | protected static Factory getForASTList(Class<? extends ASTree> clazz) { |
| 247 | Factory f = get(clazz, List.class); |
| 248 | if (f == null) |
| 249 | f = new Factory() { |
| 250 | protected ASTree make0(Object arg) throws Exception { |
| 251 | @SuppressWarnings("unchecked") |
| 252 | List<ASTree> results = (List<ASTree>)arg; |
| 253 | if (results.size() == 1) |
| 254 | return results.get(0); |
| 255 | else |
| 256 | return new ASTList(results); |
| 257 | } |
| 258 | }; |
| 259 | return f; |
| 260 | } |
| 261 | protected static Factory get(Class<? extends ASTree> clazz, |
| 262 | Class<?> argType) |
| 263 | { |