Skip to content

Extension of leaf nodes not working #3

@lausdahl

Description

@lausdahl

The test case SimpleExtendTest does not generate the expected output:

base

exp {-> package='org.overture.ast.expressions'}
    =   {aa} [type]:stm.st1
    ;

extention

exp {-> package='org.overture.interpreter.ast.expressions'}
    =   {aa}  [ee]:stm.st2
    ;

We would expect the extended tree to include an extended AAaExp (extended) which extends AAaExp (base), having the following fields:

type
ee

and the analysis to include analysis for this new class as well where the depth first visitor takes inherited fields into account.

The node is skipped in the extended generation in ExtensionGenerator2.includeClassesFromExtension where willGenerateExtensionFor excluded it.

hack to include it:

private static void includeClassesFromExtension(Environment result,
            Environment ext, Environment base)
    {
        for (IClassDefinition cDef : ext.getClasses())
        {
            if (!willGenerateExtensionFor(cDef, base))
            {
                if (!isUtilityOrTemplateClass(cDef, ext))
                {
                    cDef.setIsExtTree(true);
                    result.getClasses().add(cDef);
                }
            }

            if(cDef.getName().toString().startsWith("AAaExp"))
            {
                cDef.setIsExtTree(true);
                result.getClasses().add(cDef);
            }
        }
    }

Metadata

Metadata

Assignees

Labels

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions