(parser)
| 6152 | return { type, conversion }; |
| 6153 | } |
| 6154 | static parse(parser) { |
| 6155 | if (!parser.matchToken("fetch")) return; |
| 6156 | parser.pushFollow("as"); |
| 6157 | try { |
| 6158 | var url = parser.parseURLOrExpression(); |
| 6159 | } finally { |
| 6160 | parser.popFollow(); |
| 6161 | } |
| 6162 | if (parser.matchToken("as")) { |
| 6163 | var conversionInfo = _FetchCommand.parseConversionInfo(parser); |
| 6164 | } |
| 6165 | if (parser.matchToken("with") && parser.currentToken().value !== "{") { |
| 6166 | var argExprs = parser.parseElement("nakedNamedArgumentList"); |
| 6167 | } else { |
| 6168 | var argExprs = parser.parseElement("objectLiteral"); |
| 6169 | } |
| 6170 | if (conversionInfo == null && parser.matchToken("as")) { |
| 6171 | conversionInfo = _FetchCommand.parseConversionInfo(parser); |
| 6172 | } |
| 6173 | var dontThrow = false; |
| 6174 | if (parser.matchToken("do")) { |
| 6175 | parser.requireToken("not"); |
| 6176 | parser.requireToken("throw"); |
| 6177 | dontThrow = true; |
| 6178 | } else if (parser.currentToken().value === "don" && parser.token(1).value === "'" && parser.token(2).value === "t" && parser.token(1).start === parser.currentToken().end && parser.token(2).start === parser.token(1).end) { |
| 6179 | parser.consumeToken(); |
| 6180 | parser.consumeToken(); |
| 6181 | parser.consumeToken(); |
| 6182 | parser.requireToken("throw"); |
| 6183 | dontThrow = true; |
| 6184 | } |
| 6185 | var type = conversionInfo ? conversionInfo.type : "text"; |
| 6186 | var conversion = conversionInfo ? conversionInfo.conversion : null; |
| 6187 | return new _FetchCommand(url, argExprs, type, conversion, dontThrow); |
| 6188 | } |
| 6189 | resolve(context, { url, options }) { |
| 6190 | var detail = options || {}; |
| 6191 | detail.sender = context.me; |
nothing calls this directly
no test coverage detected