-
Notifications
You must be signed in to change notification settings - Fork 4
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Importer: Missing information on class/enum field access #197
Comments
Not sure: it is a class field access if you now that MyClass is a class, but the parser does not |
Right, it could also refer to an enumeration. Is there any resolution done by the importer? class MyClass {
static MyClass getMyClass() { return MyClass; } // invalid, eclipse says "MyClass cannot be resolved to a variable"
} |
nope, no resolution And as for your example, yes, it could not be a fully qualified class, but it could be a variable "MyClass" with an attribute "FOO" |
Yes, it could be a variable access, which is what I initially wanted it to be when I opened the issue. |
hum right
(aReturnStatement expression isKindOf: JavaNameNode)
ifTrue: [
"If the element is named. It is more than propably an Identifier and not just an named element. So you pass over the normal rules of the importer"
currentFASTEntity expression: (self addToModel: (self clone visitIdentifier: aReturnStatement expression))
] and #visitIdentifier: does not consider qualified name And if we want to remove this hack and just call JavaSmaCCProgramNodeImporterVisitor >> visitQualifiedName: aQualifiedName
self isOutsideTypeDeclaration
ifTrue: [
currentFASTEntity := self addToModel: FASTJavaQualifiedName new.
self setStartEndPos: aQualifiedName.
currentFASTEntity namespace: (self clone accept: aQualifiedName nspace).
currentFASTEntity name: aQualifiedName name value ]
ifFalse: [
currentFASTEntity := self addToModel: FASTJavaClassProperty new.
self setStartEndPos: aQualifiedName.
currentFASTEntity type: (self clone accept: aQualifiedName nspace).
currentFASTEntity fieldName: aQualifiedName name value ].
^ currentFASTEntity So it looks like somebody tried to make the visitor smarter than it should be and it ends up as more complicate than should. I propose to remove all these special case and just parse everything as QualifiedName. But this will have impact and I don't want to deal with it just right now |
…ormation-on-classenum-field-access Created test exhibiting issue #197. Skipped for now to let CI pass
hummm seems the meta-model is not right But the second hack (in This will need to be re-considered |
Executing the following:
MyClass.FOO
should yield a class field access, however we only obtain an identifier:FASTJavaIdentifier new name: 'FOO'
.The text was updated successfully, but these errors were encountered: