Bug 198077 - [WHLSL] Struct fields named "length" get wrong codegen
Summary: [WHLSL] Struct fields named "length" get wrong codegen
Status: RESOLVED WONTFIX
Alias: None
Product: WebKit
Classification: Unclassified
Component: WebGPU (show other bugs)
Version: Other
Hardware: Unspecified Unspecified
: P2 Normal
Assignee: Myles C. Maxfield
URL:
Keywords: InRadar
Depends on:
Blocks:
 
Reported: 2019-05-21 11:31 PDT by Myles C. Maxfield
Modified: 2020-05-05 00:42 PDT (History)
2 users (show)

See Also:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Myles C. Maxfield 2019-05-21 11:31:17 PDT
Inside WHLSLNativeFunctionWriter.cpp, we special case "operator.length" which is wrong for automatically generated getters for user-authored fields named "length" inside structs.
Comment 1 Radar WebKit Bug Importer 2019-05-21 15:13:54 PDT
<rdar://problem/51002694>
Comment 2 Myles C. Maxfield 2019-05-22 22:13:53 PDT
Consider the following:

struct Foo {
    int length;
}

synthesizeStructureAccessors() will create a getter for that field (just like it would create a getter for any other field) and this new getter will be named "operator.length". It will be a NativeFunctionDeclaration because it's being generated by synthesizeStructureAccessors(). Then, this code will recognize the name, and erroneously treat it as if it was .length on an array reference.
Comment 3 Myles C. Maxfield 2020-05-05 00:42:27 PDT
WHLSL is no longer relevant.