summaryrefslogtreecommitdiff
path: root/vm/type.go
diff options
context:
space:
mode:
authorMarc Vertes <mvertes@free.fr>2026-01-06 19:02:29 +0100
committerMarc Vertes <mvertes@free.fr>2026-01-06 19:02:29 +0100
commitbffc031ea83c7176aac3d3828de0060c6630140c (patch)
tree32e30f3bec94884936c2cfc2d53d3ae496e13d61 /vm/type.go
parentf07fc0178831432b68f1b9bd6c96b257aa2e9abe (diff)
fix: correct and simplify parsing of expressions.
The expressions were parsed from right to left, and it was incorrect and cumbersome. Now they are processed from left to right, with a simpler and correct handling of precedence rules. The vm function call syntax has been changed to set the function before the input arguments on the stack, as to follow the declaring order in languages.
Diffstat (limited to 'vm/type.go')
-rw-r--r--vm/type.go10
1 files changed, 10 insertions, 0 deletions
diff --git a/vm/type.go b/vm/type.go
index 644c106..3a8d901 100644
--- a/vm/type.go
+++ b/vm/type.go
@@ -104,3 +104,13 @@ func (t *Type) FieldIndex(name string) []int {
}
return nil
}
+
+// FieldType returns the type of struct field name.
+func (t *Type) FieldType(name string) *Type {
+ for _, f := range reflect.VisibleFields(t.Rtype) {
+ if f.Name == name {
+ return &Type{Name: f.Name, PkgPath: f.PkgPath, Rtype: f.Type}
+ }
+ }
+ return nil
+}