(idx, is_return, kwarg_only)
| 6152 | return result; |
| 6153 | } |
| 6154 | parseArgument(idx, is_return, kwarg_only) { |
| 6155 | const L = this.L; |
| 6156 | const type_parser = this.type_parser; |
| 6157 | let [fake_type, real_type, alias_info] = type_parser.parseFakeAndRealType(); |
| 6158 | let N = null; |
| 6159 | if (L.nextIf('[')) { |
| 6160 | fake_type = torch.ListType.create(fake_type); |
| 6161 | real_type = torch.ListType.create(real_type); |
| 6162 | if (L.cur().kind === '#') { |
| 6163 | N = Number(L.cur().text()); |
| 6164 | L.next(); |
| 6165 | } |
| 6166 | L.expect(']'); |
| 6167 | let container = type_parser.parseAliasAnnotation(); |
| 6168 | if (alias_info) { |
| 6169 | if (!container) { |
| 6170 | container = new torch._C.AliasInfo(); |
| 6171 | container.is_write = alias_info.is_write; |
| 6172 | } |
| 6173 | container.addContainedType(alias_info); |
| 6174 | } |
| 6175 | alias_info = container; |
| 6176 | if (L.nextIf('?')) { |
| 6177 | fake_type = torch.OptionalType.create(fake_type); |
| 6178 | real_type = torch.OptionalType.create(real_type); |
| 6179 | } |
| 6180 | } |
| 6181 | let name = null; |
| 6182 | /* eslint-disable no-undef-init */ |
| 6183 | let default_value = undefined; |
| 6184 | /* eslint-enable no-undef-init */ |
| 6185 | if (is_return) { |
| 6186 | kwarg_only = false; |
| 6187 | if (L.cur().kind === 'id') { |
| 6188 | name = L.next().text(); |
| 6189 | } else { |
| 6190 | name = ''; |
| 6191 | } |
| 6192 | } else { |
| 6193 | name = L.expect('id').text(); |
| 6194 | if (L.nextIf('=')) { |
| 6195 | default_value = this.parseDefaultValue(fake_type, fake_type.kind(), real_type, N); |
| 6196 | } |
| 6197 | } |
| 6198 | return new torch.Argument(name, fake_type, real_type, N, default_value, kwarg_only, alias_info); |
| 6199 | } |
| 6200 | parseDefaultValue(arg_type, kind, real_type, arg_N) { |
| 6201 | // auto range = L.cur().range; |
| 6202 | const L = this.L; |
no test coverage detected