func (linker *_Linker) linkTableNewObj(script *ast.Script, table *ast.Table, args *ast.ArgsTable) { if args.Named { for _, arg := range args.Args() { namedArg := arg.(*ast.NamedArg) _, ok := table.Field(namedArg.Name()) if !ok { linker.errorf(ErrFieldName, arg, "unknown table(%s) field(%s)", table, namedArg) } //TODO : check if field type match the arg expr } return } if len(table.Fields) != args.Count() { linker.errorf(ErrNewObj, args, "wrong newobj args num for table(%s) : expect %d but got %d", table, len(table.Fields), args.Count()) //TODO : check if field type match the arg expr } }
func (linker *_Linker) linkArgsTable(script *ast.Script, argsTable *ast.ArgsTable) { for _, arg := range argsTable.Args() { linker.linkExpr(script, arg) } }