diff --git a/pkg/symbol/table.go b/pkg/symbol/table.go index f5cdfd93..e36cc230 100644 --- a/pkg/symbol/table.go +++ b/pkg/symbol/table.go @@ -168,19 +168,6 @@ func (t *Table) insert(sym *Symbol) error { t.unlinks[sym.ID()] = unlinks } - for name, locations := range t.linked[sym.ID()] { - p1, ok := sym.Port(name) - if !ok { - continue - } - for _, location := range locations { - ref := t.symbols[location.ID] - if p2, ok := ref.Port(location.Port); ok { - p1.Link(p2) - } - } - } - if err := t.load(sym); err != nil { return err } diff --git a/pkg/symbol/table_test.go b/pkg/symbol/table_test.go index 5da48a8d..7214063f 100644 --- a/pkg/symbol/table_test.go +++ b/pkg/symbol/table_test.go @@ -3,6 +3,7 @@ package symbol import ( "testing" + "github.com/go-faker/faker/v4" "github.com/oklog/ulid/v2" "github.com/siyul-park/uniflow/pkg/node" "github.com/siyul-park/uniflow/pkg/scheme" @@ -267,3 +268,23 @@ func TestTable_LookupByID(t *testing.T) { assert.True(t, ok) assert.Equal(t, sym, r) } + +func TestTable_LookupByName(t *testing.T) { + tb := NewTable() + defer tb.Close() + + n := node.NewOneToOneNode(node.OneToOneNodeConfig{}) + defer n.Close() + spec := &scheme.SpecMeta{ + ID: n.ID(), + Namespace: scheme.NamespaceDefault, + Name: faker.Word(), + } + sym := &Symbol{Node: n, Spec: spec} + + _ = tb.Insert(sym) + + r, ok := tb.LookupByName(spec.GetNamespace(), spec.GetName()) + assert.True(t, ok) + assert.Equal(t, sym, r) +}