Classes of the same package
Just like in Java, SmallJava classes should be able to refer to external classes in the same package without importing the package. However, this is not yet the case in the current implementation. For example, given the following two SmallJava files, they are not able to refer to each other without an explicit import, although they are in the same package:
// first file package my.pack; class A { B b; } // second file package my.pack; class B extends A {}
To solve this problem, we need to go back to our custom SmallJavaImportedNamespaceAwareLocalScopeProvider
that we implemented in section Default imports. The idea is to customize internalGetImportedNamespaceResolvers
so that when the context is a SmallJava program then ...
Get Implementing Domain-Specific Languages with Xtext and Xtend - Second Edition now with the O’Reilly learning platform.
O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.