fix error in FML parser parsing parameters
This commit is contained in:
parent
bf00cc17b4
commit
96469972de
|
@ -1335,7 +1335,7 @@ public class Element extends Base {
|
|||
|
||||
for (Property p : property.getChildProperties(this.name, type)) {
|
||||
if (p.getName().equals(name)) {
|
||||
if (!p.isList()) {
|
||||
if (!p.isList() && hasChild(name)) {
|
||||
throw new Error(name+" on "+this.name+" is not a list, so can't add an element");
|
||||
}
|
||||
Element ne = new Element(name, p);
|
||||
|
|
|
@ -571,7 +571,9 @@ public class FmlParser extends ParserBase {
|
|||
private void parseParameter(Element ref, FHIRLexer lexer) throws FHIRLexerException, FHIRFormatError {
|
||||
boolean r5 = VersionUtilities.isR5Plus(context.getVersion());
|
||||
String name = r5 ? "parameter" : "variable";
|
||||
if (!lexer.isConstant()) {
|
||||
if (ref.hasChildren(name) && !ref.getChildByName(name).isList()) {
|
||||
throw lexer.error("variable on target is not a list, so can't add an element");
|
||||
} else if (!lexer.isConstant()) {
|
||||
ref.addElement(name).markLocation(lexer.getCurrentLocation()).makeElement(r5 ? "valueId" : "value").setValue(lexer.take());
|
||||
} else if (lexer.isStringConstant())
|
||||
ref.addElement(name).markLocation(lexer.getCurrentLocation()).makeElement(r5 ? "valueString" : "value").setValue(lexer.readConstant("??"));
|
||||
|
|
Loading…
Reference in New Issue