Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Move tests to another format #43

Merged
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
31 changes: 7 additions & 24 deletions internal/tlcodegen/qt_meta.qtpl
Original file line number Diff line number Diff line change
Expand Up @@ -95,30 +95,30 @@ func CreateObjectFromName(name string) Object {
}

func CreateFunctionBytes(tag uint32) Function {
if item := FactoryItemByTLTagBytes(tag); item != nil && item.createFunctionBytes != nil {
if item := FactoryItemByTLTag(tag); item != nil && item.createFunctionBytes != nil {
return item.createFunctionBytes()
}
return nil
}

func CreateObjectBytes(tag uint32) Object {
if item := FactoryItemByTLTagBytes(tag); item != nil && item.createObjectBytes != nil {
if item := FactoryItemByTLTag(tag); item != nil && item.createObjectBytes != nil {
return item.createObjectBytes()
}
return nil
}

// name can be in any of 3 forms "ch_proxy.insert#7cf362ba", "ch_proxy.insert" or "#7cf362ba"
func CreateFunctionFromNameBytes(name string) Function {
if item := FactoryItemByTLNameBytes(name); item != nil && item.createFunctionBytes != nil {
if item := FactoryItemByTLName(name); item != nil && item.createFunctionBytes != nil {
return item.createFunctionBytes()
}
return nil
}

// name can be in any of 3 forms "ch_proxy.insert#7cf362ba", "ch_proxy.insert" or "#7cf362ba"
func CreateObjectFromNameBytes(name string) Object {
if item := FactoryItemByTLNameBytes(name); item != nil && item.createObjectBytes != nil {
if item := FactoryItemByTLName(name); item != nil && item.createObjectBytes != nil {
return item.createObjectBytes()
}
return nil
Expand Down Expand Up @@ -235,23 +235,10 @@ func FactoryItemByTLName(name string) *TLItem {
return itemsByName[name]
}

func FactoryItemByTLTagBytes(tag uint32) *TLItem {
return itemsBytesByTag[tag]
}

func FactoryItemByTLNameBytes(name string) *TLItem {
return itemsBytesByName[name]
}


var itemsByTag = map[uint32]*TLItem {}

var itemsByName = map[string]*TLItem {}

var itemsBytesByTag = map[uint32]*TLItem {}

var itemsBytesByName = map[string]*TLItem {}

func SetGlobalFactoryCreateForFunction(itemTag uint32, createObject func() Object, createFunction func() Function, createFunctionLong func() Function) {
item := itemsByTag[itemTag]
if item == nil {
Expand Down Expand Up @@ -279,7 +266,7 @@ func SetGlobalFactoryCreateForEnumElement(itemTag uint32) {
}

func SetGlobalFactoryCreateForFunctionBytes(itemTag uint32, createObject func() Object, createFunction func() Function, createFunctionLong func() Function) {
item := itemsBytesByTag[itemTag]
item := itemsByTag[itemTag]
if item == nil {
panic(fmt.Sprintf("factory cannot find function tag #%08x to set", itemTag))
}
Expand All @@ -289,15 +276,15 @@ func SetGlobalFactoryCreateForFunctionBytes(itemTag uint32, createObject func()
}

func SetGlobalFactoryCreateForObjectBytes(itemTag uint32, createObject func() Object) {
item := itemsBytesByTag[itemTag]
item := itemsByTag[itemTag]
if item == nil {
panic(fmt.Sprintf("factory cannot find item tag #%08x to set", itemTag))
}
item.createObjectBytes = createObject
}

func SetGlobalFactoryCreateForEnumElementBytes(itemTag uint32) {
item := itemsBytesByTag[itemTag]
item := itemsByTag[itemTag]
if item == nil {
panic(fmt.Sprintf("factory cannot find enum tag #%08x to set", itemTag))
}
Expand Down Expand Up @@ -325,10 +312,6 @@ func fillObject(n1 string, n2 string, item *TLItem) {
itemsByName[item.tlName] = item
itemsByName[n1] = item
itemsByName[n2] = item
itemsBytesByTag[item.tag] = item
itemsBytesByName[item.tlName] = item
itemsBytesByName[n1] = item
itemsBytesByName[n2] = item
item.createObject = pleaseImportFactoryObject
item.createObjectBytes = pleaseImportFactoryBytesObject
// code below is as fast, but allocates some extra strings which are already in binary const segment due to JSON code
Expand Down
31 changes: 7 additions & 24 deletions internal/tlcodegen/qt_meta.qtpl.go

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Loading
Loading