public Choice<State<List<JCTree>>> unify( @Nullable Iterable<? extends Tree> nodes, State<?> state) { if (nodes == null) { return Choice.of(state.<List<JCTree>>withResult(null)); } Choice<State<List<JCTree>>> choice = Choice.of(state.withResult(List.<JCTree>nil())); for (final Tree node : nodes) { choice = choice.thenChoose( (State<List<JCTree>> s) -> unify(node, s) .transform( treeState -> treeState.withResult(s.result().prepend(treeState.result())))); } return choice.transform(s -> s.withResult(s.result().reverse())); }
UnifierWithUnconsumedStatements.create(resultUnifier, remainingStatements); List<JCStatement> impl = consumptionState.result().placeholderImplInReverseOrder().reverse(); ControlFlowVisitor.Result implFlow = ControlFlowVisitor.INSTANCE.visitStatements(impl); if (implFlow == implementationFlow()) {
private List<Attribute.TypeCompound> getTypePlaceholders() { List<Attribute.TypeCompound> res = List.<Attribute.TypeCompound>nil(); for (Attribute.TypeCompound a : type_attributes) { if (a instanceof Placeholder) { res = res.prepend(a); } } return res.reverse(); }
private List<Attribute.TypeCompound> getTypePlaceholders() { List<Attribute.TypeCompound> res = List.<Attribute.TypeCompound>nil(); for (Attribute.TypeCompound a : type_attributes) { if (a instanceof Placeholder) { res = res.prepend(a); } } return res.reverse(); }
private List<ClassSymbol> getTopLevelClasses(List<? extends JCCompilationUnit> units) { List<ClassSymbol> classes = List.nil(); for (JCCompilationUnit unit : units) { for (JCTree node : unit.defs) { if (node.tag == JCTree.CLASSDEF) { classes = classes.prepend(((JCClassDecl) node).sym); } } } return classes.reverse(); }
private List<Attribute.Compound> onlyTypeVariableAnnotations( List<Attribute.TypeCompound> candidates) { // Declaration annotations on TypeParameters are stored in type attributes List<Attribute.Compound> res = List.nil(); for (Attribute.TypeCompound a : candidates) { if (a.position.type == TargetType.CLASS_TYPE_PARAMETER || a.position.type == TargetType.METHOD_TYPE_PARAMETER) res = res.prepend(a); } return res = res.reverse(); }
/** Returns the list obtained from 'l' after removing all elements 'elem' */ public static <A> List<A> filter(List<A> l, A elem) { Assert.checkNonNull(elem); List<A> res = List.nil(); for (A a : l) { if (a != null && !a.equals(elem)) { res = res.prepend(a); } } return res.reverse(); }
public List<JCAnnotation> findAnnotations(List<? extends JCTree> nodes) { annotations = List.nil(); scan(nodes); List<JCAnnotation> found = annotations; annotations = List.nil(); return found.reverse(); }
private List<Attribute.Compound> getPlaceholders() { List<Attribute.Compound> res = List.<Attribute.Compound>nil(); for (Attribute.Compound a : filterDeclSentinels(attributes)) { if (a instanceof Placeholder) { res = res.prepend(a); } } return res.reverse(); }
private List<PackageSymbol> getPackageInfoFilesFromClasses(List<? extends ClassSymbol> syms) { List<PackageSymbol> packages = List.nil(); for (ClassSymbol sym : syms) { if (isPkgInfo(sym)) { packages = packages.prepend((PackageSymbol) sym.owner); } } return packages.reverse(); }
private List<ClassSymbol> getTopLevelClassesFromClasses(List<? extends ClassSymbol> syms) { List<ClassSymbol> classes = List.nil(); for (ClassSymbol sym : syms) { if (!isPkgInfo(sym)) { classes = classes.prepend(sym); } } return classes.reverse(); }
/** * Capture conversion as specified by JLS 3rd Ed. */ public List<Type> capture(List<Type> ts) { List<Type> buf = List.nil(); for (Type t : ts) { buf = buf.prepend(capture(t)); } return buf.reverse(); } public Type capture(Type t) {
private List<PackageSymbol> getPackageInfoFiles(List<? extends JCCompilationUnit> units) { List<PackageSymbol> packages = List.nil(); for (JCCompilationUnit unit : units) { if (isPkgInfo(unit.sourcefile, JavaFileObject.Kind.SOURCE)) { packages = packages.prepend(unit.packge); } } return packages.reverse(); }
private List<PackageSymbol> getPackageInfoFiles(List<? extends JCCompilationUnit> units) { List<PackageSymbol> packages = List.nil(); for (JCCompilationUnit unit : units) { boolean isPkgInfo = unit.sourcefile.isNameCompatible("package-info", JavaFileObject.Kind.SOURCE); if (isPkgInfo) { packages = packages.prepend(unit.packge); } } return packages.reverse(); }
public List<JCAnnotation> findAnnotations(List<? extends JCTree> nodes) { annotations = List.nil(); scan(nodes); List<JCAnnotation> found = annotations; annotations = List.nil(); return found.reverse(); }
private List<ClassSymbol> getTopLevelClassesFromClasses(List<? extends ClassSymbol> syms) { List<ClassSymbol> classes = List.nil(); for (ClassSymbol sym : syms) { if (!isPkgInfo(sym)) { classes = classes.prepend(sym); } } return classes.reverse(); }
private List<PackageSymbol> getPackageInfoFilesFromClasses(List<? extends ClassSymbol> syms) { List<PackageSymbol> packages = List.nil(); for (ClassSymbol sym : syms) { if (isPkgInfo(sym)) { packages = packages.prepend((PackageSymbol) sym.owner); } } return packages.reverse(); }
private List<ClassSymbol> getTopLevelClassesFromClasses(List<? extends ClassSymbol> syms) { List<ClassSymbol> classes = List.nil(); for (ClassSymbol sym : syms) { if (!isPkgInfo(sym)) { classes = classes.prepend(sym); } } return classes.reverse(); }
/** * Capture conversion as specified by the JLS. */ public List<Type> capture(List<Type> ts) { List<Type> buf = List.nil(); for (Type t : ts) { buf = buf.prepend(capture(t)); } return buf.reverse(); } public Type capture(Type t) {
for (JCTree resource : tryStatement.resources.reverse()) { if (resource instanceof JCVariableDecl) { println().printIndent().print(((JCVariableDecl) resource).name + ".close();");