ast: Remove expression constructors that don't take a Source

Parsers need fixing up.

Bug: tint:396
Bug: tint:390
Change-Id: I7f823e2489101b43c1b21a6b89c248695a3f35b7
Reviewed-on: https://dawn-review.googlesource.com/c/tint/+/35160
Commit-Queue: Ben Clayton <bclayton@google.com>
Reviewed-by: dan sinclair <dsinclair@chromium.org>
This commit is contained in:
Ben Clayton
2020-12-12 01:38:13 +00:00
committed by Commit Bot service account
parent 5ed161b2d9
commit 1ff59cd0e2
133 changed files with 3646 additions and 2969 deletions

View File

@@ -50,6 +50,7 @@ TEST_F(ValidateControlBlockTest, SwitchSelectorExpressionNoneIntegerType_Fail) {
&f32, // type
false, // is_const
create<ast::ScalarConstructorExpression>(
Source{},
create<ast::SintLiteral>(Source{}, &f32, 3.14f)), // constructor
ast::VariableDecorationList{}); // decorations
@@ -84,11 +85,12 @@ TEST_F(ValidateControlBlockTest, SwitchWithoutDefault_Fail) {
&i32, // type
false, // is_const
create<ast::ScalarConstructorExpression>(
Source{},
create<ast::SintLiteral>(Source{}, &i32, 2)), // constructor
ast::VariableDecorationList{}); // decorations
auto* cond =
create<ast::IdentifierExpression>(mod()->RegisterSymbol("a"), "a");
auto* cond = create<ast::IdentifierExpression>(
Source{}, mod()->RegisterSymbol("a"), "a");
ast::CaseSelectorList csl;
csl.push_back(create<ast::SintLiteral>(Source{}, &i32, 1));
ast::CaseStatementList body;
@@ -122,12 +124,13 @@ TEST_F(ValidateControlBlockTest, SwitchWithTwoDefault_Fail) {
&i32, // type
false, // is_const
create<ast::ScalarConstructorExpression>(
Source{},
create<ast::SintLiteral>(Source{}, &i32, 2)), // constructor
ast::VariableDecorationList{}); // decorations
ast::CaseStatementList switch_body;
auto* cond =
create<ast::IdentifierExpression>(mod()->RegisterSymbol("a"), "a");
auto* cond = create<ast::IdentifierExpression>(
Source{}, mod()->RegisterSymbol("a"), "a");
ast::CaseSelectorList default_csl_1;
auto* block_default_1 = create<ast::BlockStatement>();
@@ -172,12 +175,13 @@ TEST_F(ValidateControlBlockTest,
&i32, // type
false, // is_const
create<ast::ScalarConstructorExpression>(
Source{},
create<ast::SintLiteral>(Source{}, &i32, 2)), // constructor
ast::VariableDecorationList{}); // decorations
ast::CaseStatementList switch_body;
auto* cond =
create<ast::IdentifierExpression>(mod()->RegisterSymbol("a"), "a");
auto* cond = create<ast::IdentifierExpression>(
Source{}, mod()->RegisterSymbol("a"), "a");
ast::CaseSelectorList csl;
csl.push_back(create<ast::UintLiteral>(Source{}, &u32, 1));
@@ -215,12 +219,13 @@ TEST_F(ValidateControlBlockTest,
&u32, // type
false, // is_const
create<ast::ScalarConstructorExpression>(
Source{},
create<ast::UintLiteral>(Source{}, &u32, 2)), // constructor
ast::VariableDecorationList{}); // decorations
ast::CaseStatementList switch_body;
auto* cond =
create<ast::IdentifierExpression>(mod()->RegisterSymbol("a"), "a");
auto* cond = create<ast::IdentifierExpression>(
Source{}, mod()->RegisterSymbol("a"), "a");
ast::CaseSelectorList csl;
csl.push_back(create<ast::SintLiteral>(Source{}, &i32, -1));
@@ -257,12 +262,13 @@ TEST_F(ValidateControlBlockTest, NonUniqueCaseSelectorValueUint_Fail) {
&u32, // type
false, // is_const
create<ast::ScalarConstructorExpression>(
Source{},
create<ast::UintLiteral>(Source{}, &u32, 3)), // constructor
ast::VariableDecorationList{}); // decorations
ast::CaseStatementList switch_body;
auto* cond =
create<ast::IdentifierExpression>(mod()->RegisterSymbol("a"), "a");
auto* cond = create<ast::IdentifierExpression>(
Source{}, mod()->RegisterSymbol("a"), "a");
ast::CaseSelectorList csl_1;
csl_1.push_back(create<ast::UintLiteral>(Source{}, &u32, 0));
@@ -305,12 +311,13 @@ TEST_F(ValidateControlBlockTest, NonUniqueCaseSelectorValueSint_Fail) {
&i32, // type
false, // is_const
create<ast::ScalarConstructorExpression>(
Source{},
create<ast::SintLiteral>(Source{}, &i32, 2)), // constructor
ast::VariableDecorationList{}); // decorations
ast::CaseStatementList switch_body;
auto* cond =
create<ast::IdentifierExpression>(mod()->RegisterSymbol("a"), "a");
auto* cond = create<ast::IdentifierExpression>(
Source{}, mod()->RegisterSymbol("a"), "a");
ast::CaseSelectorList csl_1;
csl_1.push_back(create<ast::SintLiteral>(Source{}, &i32, 10));
@@ -353,11 +360,12 @@ TEST_F(ValidateControlBlockTest, LastClauseLastStatementIsFallthrough_Fail) {
&i32, // type
false, // is_const
create<ast::ScalarConstructorExpression>(
Source{},
create<ast::SintLiteral>(Source{}, &i32, 2)), // constructor
ast::VariableDecorationList{}); // decorations
auto* cond =
create<ast::IdentifierExpression>(mod()->RegisterSymbol("a"), "a");
auto* cond = create<ast::IdentifierExpression>(
Source{}, mod()->RegisterSymbol("a"), "a");
ast::CaseSelectorList default_csl;
auto* block_default = create<ast::BlockStatement>();
block_default->append(
@@ -390,11 +398,12 @@ TEST_F(ValidateControlBlockTest, SwitchCase_Pass) {
&i32, // type
false, // is_const
create<ast::ScalarConstructorExpression>(
Source{},
create<ast::SintLiteral>(Source{}, &i32, 2)), // constructor
ast::VariableDecorationList{}); // decorations
auto* cond =
create<ast::IdentifierExpression>(mod()->RegisterSymbol("a"), "a");
auto* cond = create<ast::IdentifierExpression>(
Source{}, mod()->RegisterSymbol("a"), "a");
ast::CaseSelectorList default_csl;
auto* block_default = create<ast::BlockStatement>();
ast::CaseStatementList body;
@@ -430,11 +439,12 @@ TEST_F(ValidateControlBlockTest, SwitchCaseAlias_Pass) {
&my_int, // type
false, // is_const
create<ast::ScalarConstructorExpression>(
Source{},
create<ast::SintLiteral>(Source{}, &u32, 2)), // constructor
ast::VariableDecorationList{}); // decorations
auto* cond =
create<ast::IdentifierExpression>(mod()->RegisterSymbol("a"), "a");
auto* cond = create<ast::IdentifierExpression>(
Source{}, mod()->RegisterSymbol("a"), "a");
ast::CaseSelectorList default_csl;
auto* block_default = create<ast::BlockStatement>();
ast::CaseStatementList body;