| 27 | } |
| 28 | |
| 29 | @Override |
| 30 | protected Expr opt(final CompileContext cc) { |
| 31 | final Expr key = arg(0), value = arg(1); |
| 32 | |
| 33 | final Type type; |
| 34 | if(key instanceof final Str str && key.seqType().eq(Types.STRING_O)) { |
| 35 | final TokenObjectMap<RecordField> fields = new TokenObjectMap<>(1); |
| 36 | fields.put(str.string(), new RecordField(value.seqType())); |
| 37 | type = cc.qc.shared.record(new RecordType(fields)); |
| 38 | } else { |
| 39 | final BasicType kt = key.seqType().type.atomic(); |
| 40 | type = MapType.get(kt != null ? kt : BasicType.ANY_ATOMIC_TYPE, value.seqType()); |
| 41 | } |
| 42 | exprType.assign(type); |
| 43 | return this; |
| 44 | } |
| 45 | |
| 46 | @Override |
| 47 | public long structSize() { |