コード例 #1
0
 static String fullPath(int offset, String prefix, Tree.ImportPath path) {
   StringBuilder fullPath = new StringBuilder();
   if (path != null) {
     String pathString = formatPath(path.getIdentifiers());
     fullPath.append(pathString).append('.');
     int len = offset - path.getStartIndex() - prefix.length();
     fullPath.setLength(len);
   }
   return fullPath.toString();
 }
コード例 #2
0
ファイル: ImportVisitor.java プロジェクト: quintesse/ceylon
 @Override
 public void visit(Tree.CompilationUnit that) {
   unit = that.getUnit();
   super.visit(that);
   HashSet<String> set = new HashSet<String>();
   for (Tree.Import im : that.getImportList().getImports()) {
     Tree.ImportPath ip = im.getImportPath();
     if (ip != null) {
       String mp = formatPath(ip.getIdentifiers());
       if (!set.add(mp)) {
         ip.addError("duplicate import: '" + mp + "'");
       }
     }
   }
 }