mirror of
https://github.com/tinygo-org/tinygo.git
synced 2026-08-13 07:23:39 +00:00
reflect: address Copilot review feedback
This commit is contained in:
committed by
Damian Gryski
parent
1c0c26b8b7
commit
7fa50a55cf
@@ -754,8 +754,7 @@ func (t *RawType) FieldAlign() int {
|
|||||||
return t.Align()
|
return t.Align()
|
||||||
}
|
}
|
||||||
|
|
||||||
// ConvertibleTo returns wheather a value of type t can be converted to a variable of of type u
|
// ConvertibleTo returns whether a value of type t can be converted to a variable of type u
|
||||||
|
|
||||||
func (r *RawType) ConvertibleTo(u *RawType) bool {
|
func (r *RawType) ConvertibleTo(u *RawType) bool {
|
||||||
|
|
||||||
// This logic is mostly copied from Value.CanConvert
|
// This logic is mostly copied from Value.CanConvert
|
||||||
|
|||||||
@@ -1494,9 +1494,9 @@ func convertOp(src Value, typ Type) (Value, bool) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
case Complex64, Complex128:
|
case Complex64, Complex128:
|
||||||
switch src.Kind() {
|
switch rtype := typ.(*RawType); rtype.Kind() {
|
||||||
case Complex64, Complex128:
|
case Complex64, Complex128:
|
||||||
return cvtComplex(src, typ.(*RawType)), true
|
return cvtComplex(src, rtype), true
|
||||||
}
|
}
|
||||||
|
|
||||||
case Slice:
|
case Slice:
|
||||||
@@ -1543,7 +1543,7 @@ func convertOp(src Value, typ Type) (Value, bool) {
|
|||||||
|
|
||||||
case Pointer:
|
case Pointer:
|
||||||
rtype := typ.(*RawType)
|
rtype := typ.(*RawType)
|
||||||
if rtype.Kind() == Pointer && !rtype.isNamed() {
|
if rtype.Kind() == Pointer && !src.typecode.isNamed() && !rtype.isNamed() && src.typecode.elem().underlying() == rtype.elem().underlying() {
|
||||||
return cvtDirect(src, rtype), true
|
return cvtDirect(src, rtype), true
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -1708,9 +1708,6 @@ func makeComplex(flags valueFlags, f complex128, t *RawType) Value {
|
|||||||
return v
|
return v
|
||||||
}
|
}
|
||||||
|
|
||||||
//go:linkname stringFromUnicode runtime.stringFromUnicode
|
|
||||||
func stringFromUnicode(x rune) string
|
|
||||||
|
|
||||||
func cvtIntString(v Value, t *RawType) Value {
|
func cvtIntString(v Value, t *RawType) Value {
|
||||||
s := "\uFFFD"
|
s := "\uFFFD"
|
||||||
if x := v.Int(); int64(rune(x)) == x {
|
if x := v.Int(); int64(rune(x)) == x {
|
||||||
|
|||||||
Reference in New Issue
Block a user