d4t_formulas/.pub-cache/hosted/pub.dev/analyzer-7.7.1/example/ddd05.dart
Álvaro González 1d339653d5 feat: add formula data classes with strict JSON parsing
- Add VariableSpec class with magnitude field validation
- Add Formula class supporting multiple input/output variables
- Support d4rt_code as string or object with code field
- Add comprehensive tests for parsing and serialization
- Fix broken test import in pruebas_d4rt_test.dart

Follows README.md format requirements exactly
2025-08-21 17:15:00 +02:00

47 lines
1.4 KiB
Dart

import 'package:analyzer/file_system/overlay_file_system.dart';
import 'package:analyzer/file_system/physical_file_system.dart';
import 'package:analyzer/src/dart/analysis/analysis_context_collection.dart';
import 'package:analyzer/src/dart/analysis/byte_store.dart';
void main() async {
{
var byteStore = MemoryByteStore();
var resourceProvider = OverlayResourceProvider(
PhysicalResourceProvider.INSTANCE,
);
var analysisOptionsPath =
'/Users/scheglov/Source/Dart/analysis_options.yaml';
resourceProvider.setOverlay(
analysisOptionsPath,
content: r'''
analyzer:
enable-experiment:
- macros
''',
modificationStamp: -1,
);
var collection = AnalysisContextCollectionImpl(
resourceProvider: resourceProvider,
includedPaths: ['/Users/scheglov/Source/Dart/sdk.git/sdk/pkg/analyzer'],
byteStore: byteStore,
optionsFile: analysisOptionsPath,
);
var timer = Stopwatch()..start();
for (var analysisContext in collection.contexts) {
print(analysisContext.contextRoot.root.path);
var analysisSession = analysisContext.currentSession;
for (var path in analysisContext.contextRoot.analyzedFiles()) {
if (path.endsWith('.dart')) {
await analysisSession.getUnitElement(path);
}
}
}
print('[time: ${timer.elapsedMilliseconds} ms]');
await collection.dispose();
}
}