[263773] Incorporated review comments

This commit is contained in:
Sebastian Zarnekow 2015-08-13 10:35:52 +02:00
parent 9572595662
commit 6627e289a7
2 changed files with 5 additions and 3 deletions

View file

@ -194,9 +194,11 @@ public class GrammarUtil {
public static boolean isEObjectRule(EObject grammarElement) {
if (grammarElement instanceof ParserRule) {
ParserRule rule = (ParserRule) grammarElement;
if (rule.isWildcard()) {
return true;
}
TypeRef type = rule.getType();
// wildcard fragments are considered to be EObjectRules, too
return type == null || type.getClassifier() instanceof EClass;
return type != null && type.getClassifier() instanceof EClass;
}
return false;
}

View file

@ -278,6 +278,6 @@ public class GrammarParserTest extends AbstractEnumRulesTest {
assertEquals(grammar.eResource().getErrors().toString(), 1, grammar.eResource().getErrors().size());
TransformationDiagnostic diag = (TransformationDiagnostic) grammar.eResource().getErrors().get(0);
int offset = diag.getOffset();
assertEquals(modelAsString.lastIndexOf("enum ExistingEnum"), offset);
assertEquals(modelAsString.lastIndexOf("ExistingEnum"), offset);
}
}