Closed trinnguyen closed 3 years ago
When generating scchart get_shortest_route
, variables declared in an outer scope are not resolved:
immediate do _result = null [ 0 ] go to S_get_shortest_route_1_0_2
immediate do _length = config_get_scalar_float_value ( "route" , null , "length" ) go to S_get_shortest_route_1_0_3_0_2
immediate if _length < null go to S_get_shortest_route_1_0_3_0_2_0
Caused by #10
The standardlib has to be validated in order to resolve variable scopes. Otherwise, variable references are not linked to their declarations. This can be done just before BahnModel is validated in generator/StandaloneApp.java
in runGenerator()
.
Compilation of BahnDSL methods no longer work in Eclipse: null pointer exception. Same waiting problem with VSCode extension.
When setting up the standardlib URI in BahnImportURIGlobalScopeProvider
, the Xtext resource set load options also have to be set:
resourceSet.addLoadOption(XtextResource.OPTION_RESOLVE_ALL, Boolean.TRUE);
Compilation to C and shared library in Eclipse not working:
Couldn't find resource on classpath. URI was 'classpath:/standardlib.bahn'
In Eclipse, the context menu command for compilation creates an instance of StandaloneApp
which tries to validate the standardlib and model file before the XtextResourceSet
setClasspathUriResolver
has been set to our own CustomClassPathUriResolver
. This causes an exception because standardlib cannot be found in the resourceSets and cannot be loaded with the default classloader.
The fix is to setClasspathUriResolver
when calling loadResource
in StandaloneApp
.
When editing in Eclipse, BahnScopeProvider
is automatically called, which invokes BahnImportURIGlobalScopeProvider.getImportedUris()
to set the custom URI resolver.
@eyip002 Thanks for solving this!!!