parseJsonFile method
Parses an AST from a JSON file.
Supports both plain .json and gzipped .json.gz files.
Implementation
Future<SCompilationUnit> parseJsonFile(String path) async {
final file = File(path);
if (!file.existsSync()) {
throw ArgumentD4rtException('AST file not found: $path');
}
List<int> bytes = await file.readAsBytes();
// Decompress if gzipped
if (path.endsWith('.gz')) {
bytes = gzip.decode(bytes);
}
final jsonString = utf8.decode(bytes);
return parseJson(jsonString);
}