Remove field which hides another field with the same name; add check for this condition to OutputModelWalker
This commit is contained in:
parent
45815d97f7
commit
589d6bf187
|
@ -95,6 +95,7 @@ public class OutputModelWalker {
|
|||
st.add(modelArgName, omo);
|
||||
|
||||
// COMPUTE STs FOR EACH NESTED MODEL OBJECT MARKED WITH @ModelElement AND MAKE ST ATTRIBUTE
|
||||
Set<String> usedFieldNames = new HashSet<String>();
|
||||
Field fields[] = cl.getFields();
|
||||
for (Field fi : fields) {
|
||||
ModelElement annotation = fi.getAnnotation(ModelElement.class);
|
||||
|
@ -103,8 +104,15 @@ public class OutputModelWalker {
|
|||
}
|
||||
|
||||
String fieldName = fi.getName();
|
||||
|
||||
if (!usedFieldNames.add(fieldName)) {
|
||||
tool.errMgr.toolError(ErrorType.INTERNAL_ERROR, "Model object " + omo.getClass().getSimpleName() + " has multiple fields named '" + fieldName + "'");
|
||||
continue;
|
||||
}
|
||||
|
||||
// Just don't set @ModelElement fields w/o formal arg in target ST
|
||||
if ( formalArgs.get(fieldName)==null ) continue;
|
||||
|
||||
try {
|
||||
Object o = fi.get(omo);
|
||||
if ( o instanceof OutputModelObject ) { // SINGLE MODEL OBJECT?
|
||||
|
|
|
@ -46,7 +46,6 @@ public class LL1PlusBlock extends LL1Loop {
|
|||
public String loopCounterVar;
|
||||
public String[] exitLook;
|
||||
|
||||
@ModelElement public SrcOp loopExpr;
|
||||
@ModelElement public ThrowNoViableAlt error;
|
||||
|
||||
public LL1PlusBlock(OutputModelFactory factory, GrammarAST plusRoot, List<CodeBlockForAlt> alts) {
|
||||
|
|
Loading…
Reference in New Issue