For performing static analysis, IAnalysisService.analyze() requires a context. Currently, context creation involves the project service, a project, and the context service:

public static IContext getContext(Spoofax spoofax, ILanguageImpl implementation, FileObject file) throws MetaborgException, IOException  {
	IProject project = spoofax.projectService.get(file);
	if (project == null) {
		ISimpleProjectService projectService = spoofax.injector.getInstance(SimpleProjectService.class);
		project = projectService.create(file);
	}
	return spoofax.contextService.get(file, project, implementation);
}

For languages with programs in single files, the project notion seems to be overkill, since every file is its own project. Is there a way to get IContextService.get(file, implementation) working for such use cases?

For parsing and analysing strings which are not stored in a file, the situation is worse, since context creation requires a file. Currently we need to create a temporary file for each string we want to parse and analyse. Here, it would be great if project service (if still needed) and context service could handle null as a file parameter.

Submitted by Guido Wachsmuth on 7 September 2016 at 18:05

On 13 September 2016 at 13:13 Gabriƫl Konat tagged core

Log in to post comments