tint: Add abstract AInt and AFloat typedefs

Add ProgramBuilder expression helpers for these.

Bug: tint:1504
Change-Id: I921dc4ebe0b97a5e451d98a19ad97df7f60384b3
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/89032
Reviewed-by: Dan Sinclair <dsinclair@chromium.org>
Commit-Queue: Ben Clayton <bclayton@google.com>
Kokoro: Kokoro <noreply+kokoro@google.com>
diff --git a/src/tint/number.h b/src/tint/number.h
index f77f5b3..a4bd369 100644
--- a/src/tint/number.h
+++ b/src/tint/number.h
@@ -72,6 +72,11 @@
     return Number<A>(a) == b;
 }
 
+/// `AInt` is a type alias to `Number<int64_t>`.
+using AInt = Number<int64_t>;
+/// `AFloat` is a type alias to `Number<double>`.
+using AFloat = Number<double>;
+
 /// `i32` is a type alias to `Number<int32_t>`.
 using i32 = Number<int32_t>;
 /// `u32` is a type alias to `Number<uint32_t>`.
@@ -83,6 +88,16 @@
 
 namespace tint::number_suffixes {
 
+/// Literal suffix for abstract integer literals
+inline AInt operator"" _a(unsigned long long int value) {  // NOLINT
+    return AInt(static_cast<int64_t>(value));
+}
+
+/// Literal suffix for abstract float literals
+inline AFloat operator"" _a(long double value) {  // NOLINT
+    return AFloat(static_cast<double>(value));
+}
+
 /// Literal suffix for i32 literals
 inline i32 operator"" _i(unsigned long long int value) {  // NOLINT
     return i32(static_cast<int32_t>(value));
diff --git a/src/tint/program_builder.h b/src/tint/program_builder.h
index 2cd0ff2..7dd2c81 100644
--- a/src/tint/program_builder.h
+++ b/src/tint/program_builder.h
@@ -1006,6 +1006,35 @@
 
     /// @param source the source information
     /// @param value the integer value
+    /// @return an unsuffixed IntLiteralExpression for the AInt value
+    const ast::IntLiteralExpression* Expr(const Source& source, AInt value) {
+        return create<ast::IntLiteralExpression>(source, value,
+                                                 ast::IntLiteralExpression::Suffix::kNone);
+    }
+
+    /// @param value the integer value
+    /// @return an unsuffixed IntLiteralExpression for the AInt value
+    const ast::IntLiteralExpression* Expr(AInt value) {
+        return create<ast::IntLiteralExpression>(value, ast::IntLiteralExpression::Suffix::kNone);
+    }
+
+    /// @param source the source information
+    /// @param value the integer value
+    /// @return an unsuffixed FloatLiteralExpression for the AFloat value
+    const ast::FloatLiteralExpression* Expr(const Source& source, AFloat value) {
+        return create<ast::FloatLiteralExpression>(source, value.value,
+                                                   ast::FloatLiteralExpression::Suffix::kNone);
+    }
+
+    /// @param value the integer value
+    /// @return an unsuffixed FloatLiteralExpression for the AFloat value
+    const ast::FloatLiteralExpression* Expr(AFloat value) {
+        return create<ast::FloatLiteralExpression>(value.value,
+                                                   ast::FloatLiteralExpression::Suffix::kNone);
+    }
+
+    /// @param source the source information
+    /// @param value the integer value
     /// @return a signed 'i'-suffixed IntLiteralExpression for the i32 value
     const ast::IntLiteralExpression* Expr(const Source& source, i32 value) {
         return create<ast::IntLiteralExpression>(source, value,