mirror of
https://github.com/encounter/dawn-cmake.git
synced 2025-12-12 06:45:16 +00:00
tint/resolver: Use the intrinsic table for type const dispatch
Use the @const annotations to more efficently dispatch to the right method of the ConstEval class. Reduces a whole lot of dynamic casting logic. Change-Id: I6791aac51b935b46d63af29abd1e577b3306a0ff Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/95950 Commit-Queue: Antonio Maiorano <amaiorano@google.com> Reviewed-by: Antonio Maiorano <amaiorano@google.com>
This commit is contained in:
committed by
Dawn LUCI CQ
parent
30d672963c
commit
6a80ce6c66
@@ -329,7 +329,14 @@ func (r *resolver) intrinsic(
|
||||
if constEvalFn := a.Attributes.Take("const"); constEvalFn != nil {
|
||||
switch len(constEvalFn.Values) {
|
||||
case 0:
|
||||
overload.ConstEvalFunction = overload.Decl.Name
|
||||
switch overload.Decl.Kind {
|
||||
case ast.Builtin, ast.Operator:
|
||||
overload.ConstEvalFunction = overload.Decl.Name
|
||||
case ast.Constructor:
|
||||
overload.ConstEvalFunction = "Ctor"
|
||||
case ast.Converter:
|
||||
overload.ConstEvalFunction = "Conv"
|
||||
}
|
||||
case 1:
|
||||
overload.ConstEvalFunction = constEvalFn.Values[0]
|
||||
default:
|
||||
|
||||
Reference in New Issue
Block a user