mirror of
https://github.com/sigmasternchen/xtext-core
synced 2025-03-16 08:48:55 +00:00
[grammar][serializer] Terminal fragments don’t allow return types
This commit is contained in:
parent
014e623b6b
commit
c2dd4765a6
2 changed files with 6 additions and 1 deletions
|
@ -54,7 +54,7 @@ public class XtextTransientValueService extends DefaultTransientValueService {
|
|||
}
|
||||
} else if (rule instanceof TerminalRule) {
|
||||
final TypeRef returnType = rule.getType();
|
||||
return returnType == null || EcorePackage.eINSTANCE.getEString().equals(rule.getType().getClassifier());
|
||||
return ((TerminalRule) rule).isFragment() || returnType == null || EcorePackage.eINSTANCE.getEString().equals(rule.getType().getClassifier());
|
||||
}
|
||||
}
|
||||
else if (feature == XtextPackage.eINSTANCE.getCrossReference_Terminal()) {
|
||||
|
|
|
@ -60,6 +60,11 @@ public class XtextTransientValueService2 extends TransientValueService {
|
|||
final TypeRef returnType = rule.getType();
|
||||
if (returnType == null)
|
||||
return YES;
|
||||
if (rule instanceof TerminalRule) {
|
||||
if (((TerminalRule) rule).isFragment()) {
|
||||
return YES;
|
||||
}
|
||||
}
|
||||
if (EcorePackage.eINSTANCE.getEString().equals(rule.getType().getClassifier()))
|
||||
return PREFERABLY;
|
||||
return NO;
|
||||
|
|
Loading…
Reference in a new issue