-
Notifications
You must be signed in to change notification settings - Fork 38
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Dart Language Parser #91
base: main
Are you sure you want to change the base?
Conversation
Cool! Dart is a language that would be nice to have in dep-tree, I could even use it myself. I see that the progress is still ongoing, let me know if you have any question along the process or if you want me to do a full review straight away. |
Great! Thank you! Still definitely in prototype stage at the moment as I play around with it and wrap my head around go, but I'll definitely get you to have a further look a bit later down the track when I think it's working pretty properly! Quick question on exports though, firstly I don't really understand the role they play in the output entropy graph in languages like JS, secondly for dart to work properly I've been testing just treating exports as imports as they essentially import and re-export the file to be visible to other code when imported, doing this seems to make a correct output graph, what are your thoughts? |
Imagine that we have three files: a.js, b.js and c.js
Given this situation, what would you say, that a.js depends on b.js or c.js? This question can only be answered knowing which names where exported from which file, and in this case,
I think Dart's implementation should be very straight forward, as the import system is very simple. You basically import whole files without declaring which names are imported, and there is already a function for building that kind of import: // EmptyImport builds an ImportEntry where nothing specific is imported, like a side effect import.
func EmptyImport(absPath string) ImportEntry {
return ImportEntry{AbsPath: absPath}
} You should be able to not even care about exports in Dart, as everything is exported by default, so you are pretty much always importing whole files instead of specific names. Another approach you could take is to build imports with |
Thank you so much for the detailed explanation! (and apologies for my late response!) That's a lot clearer now! I've updated the imports as you suggested, which does indeed make more sense. I'm still wondering about the exports, in the example that: // a.dart
import 'b.dart';
print(foo); // b.dart
export 'c.dart';
export 'd.dart';
export 'e.dart';
export 'f.dart'; // c.dart
final foo = 'foo'; If we were to try to use the same logic as JS, really,
Although it's probably not perfectly correct, option 1 does seem the best of the two... |
* 'main' of github.com:gabotechs/dep-tree: (47 commits) Update README [skip ci] tag: v0.23.0 feat: Add the ability to ignore nodes from visualization (gabotechs#108) tag: v0.22.5 Improve folder coloring (gabotechs#107) tag: v0.22.4 Workaround cycle analysis freezes (gabotechs#105) tag: v0.22.3 Refactor config and args (gabotechs#104) Update README [skip ci] tag: v0.22.2 Commit index file tag: v0.22.1 Fix folder squash bug tag: v0.22.0 feat: File explorer (gabotechs#103) tag: v0.21.3 Introduce virtual dir modes Fix virtual dir nodes Update README [skip ci] ...
Working on a dart language parser! 🎉
Using regex and simple step by step process as I couldn't find a good way to handle the relative vs package absolute imports with participle, and a simple step by step regex should do everything that's needed.
Note: This is my first time using the go language, apologies for the many oversights I may make!
Current status: