Skip to content

Commit

Permalink
Merge pull request #4 from Tensegritics/feat/awesome-type-system
Browse files Browse the repository at this point in the history
Better type inference
  • Loading branch information
cgrand committed Oct 26, 2021
2 parents 286b9a0 + 8a3c5dc commit 4c080b7
Show file tree
Hide file tree
Showing 5 changed files with 290 additions and 135 deletions.
14 changes: 9 additions & 5 deletions bin/analyzer.dart
Expand Up @@ -80,7 +80,8 @@ String emitType(DartType t) {
}

String emitTypeParameter(TypeParameterElement tp) =>
M({':name': "\"${tp.displayName}\"",
M({':type': "\"${tp.displayName}\"",
':is-param': true,
':bound': fnil(emitType,tp.bound,null)});

String emitParameter(ParameterElement p) {
Expand Down Expand Up @@ -186,7 +187,6 @@ Future<void> analyzePaths (session, List<String> paths) async {
}
}


void main(args) async {
final resourceProvider = OverlayResourceProvider(PhysicalResourceProvider.INSTANCE);
var ctx = resourceProvider.pathContext;
Expand All @@ -211,10 +211,14 @@ void main(args) async {
rootUri = ctx.join(rootUri, jc["packageUri"]);
}
packages[rootUri] = 'package:' + jc["name"] + '/';
includedDependenciesPaths.add(ctx.normalize(ctx.fromUri(rootUri)));
String normalizedPath = ctx.normalize(ctx.fromUri(rootUri));
if (!ctx.isRelative(normalizedPath)) {
includedDependenciesPaths.add(normalizedPath);
} else {
stderr.write("WARNING: could not analyze '" + jc["name"] + "' package \n");
// TODO: better message on consequences
}
};
// TODO see whether we remove current project or not
includedDependenciesPaths.removeLast();
}
}
// NOTE : deps analysis
Expand Down
11 changes: 7 additions & 4 deletions clj/src/cljd/build.clj
Expand Up @@ -63,9 +63,13 @@
(.waitFor process))
(.destroy process)
(prn "== Analyze your project dependencies... ===")
(doto (.start pb-analyzer)
.waitFor
.destroy))
(let [process-analyze (.start pb-analyzer)]
(with-open [r (io/reader (.getErrorStream process-analyze))]
(loop []
(when (doto (.readLine r) prn)
(recur)))
(.waitFor process-analyze))
(.destroy process-analyze)))
(throw (ex-info "Can't find ClojureDart on your classpath" {:classpath (cp/classpath)}))))))

(def cli-options
Expand Down Expand Up @@ -121,7 +125,6 @@

(defn -main [& args]
(let [{:keys [action options exit-message namespaces ok?]} (validate-args args)]
(prn action)
(if exit-message
(exit (if ok? 0 1) exit-message)
(do (println "== Warming up `.clojuredart/libs-info.edn` (helps us emit better code)")
Expand Down

0 comments on commit 4c080b7

Please sign in to comment.