(parser)
| 7619 | } |
| 7620 | } |
| 7621 | static parse(parser) { |
| 7622 | if (!parser.matchToken("add")) return; |
| 7623 | var classRef = parser.parseElement("classRef"); |
| 7624 | var attributeRef = null; |
| 7625 | var cssDeclaration = null; |
| 7626 | var valueExpr = null; |
| 7627 | if (classRef == null) { |
| 7628 | attributeRef = parser.parseElement("attributeRef"); |
| 7629 | if (attributeRef == null) { |
| 7630 | cssDeclaration = parser.parseElement("styleLiteral"); |
| 7631 | if (cssDeclaration == null) { |
| 7632 | parser.pushFollow("to"); |
| 7633 | try { |
| 7634 | valueExpr = parser.parseElement("expression"); |
| 7635 | } finally { |
| 7636 | parser.popFollow(); |
| 7637 | } |
| 7638 | if (valueExpr == null || !parser.currentToken() || parser.currentToken().value !== "to") { |
| 7639 | parser.raiseError("Expected either a class reference or attribute expression"); |
| 7640 | } |
| 7641 | } |
| 7642 | } |
| 7643 | } else { |
| 7644 | var classRefs = [classRef]; |
| 7645 | while (classRef = parser.parseElement("classRef")) { |
| 7646 | classRefs.push(classRef); |
| 7647 | } |
| 7648 | } |
| 7649 | if (parser.matchToken("to")) { |
| 7650 | var toExpr = parser.requireElement("expression"); |
| 7651 | } else { |
| 7652 | var toExpr = parser.requireElement("implicitMeTarget"); |
| 7653 | } |
| 7654 | if (parser.matchToken("when")) { |
| 7655 | var when = parser.requireElement("expression"); |
| 7656 | } |
| 7657 | if (classRefs) { |
| 7658 | return new _AddCommand("class", classRefs, null, null, toExpr, when); |
| 7659 | } else if (attributeRef) { |
| 7660 | return new _AddCommand("attribute", null, attributeRef, null, toExpr, when); |
| 7661 | } else if (cssDeclaration) { |
| 7662 | return new _AddCommand("css", null, null, cssDeclaration, toExpr, null); |
| 7663 | } else { |
| 7664 | return new _AddCommand("collection", null, null, null, toExpr, null, valueExpr); |
| 7665 | } |
| 7666 | } |
| 7667 | resolve(context, { to, classRefs, css, value }) { |
| 7668 | var runtime2 = context.meta.runtime; |
| 7669 | var cmd = this; |
nothing calls this directly
no test coverage detected