@@ -120,57 +120,53 @@ parseProtocolListFromFile(StringRef protocolListFilePath,
120
120
return true ;
121
121
}
122
122
123
- static std::shared_ptr<CompileTimeValue>
124
- extractCompileTimeValue (Expr *expr) {
123
+ static std::shared_ptr<CompileTimeValue> extractCompileTimeValue (Expr *expr) {
125
124
if (expr) {
126
125
switch (expr->getKind ()) {
127
- case ExprKind::Array:
128
- case ExprKind::Dictionary:
129
- case ExprKind::Tuple:
130
-
131
- case ExprKind::BooleanLiteral:
132
- case ExprKind::FloatLiteral:
133
- case ExprKind::IntegerLiteral:
134
- case ExprKind::NilLiteral:
135
- case ExprKind::StringLiteral:
136
- {
137
- std::string literalOutput;
138
- llvm::raw_string_ostream OutputStream (literalOutput);
139
- expr->printConstExprValue (&OutputStream, nullptr );
140
- if (!literalOutput.empty ()) {
141
- return std::make_shared<RawLiteralValue>(literalOutput);
142
- }
143
- break ;
126
+ case ExprKind::Array:
127
+ case ExprKind::Dictionary:
128
+ case ExprKind::Tuple:
129
+
130
+ case ExprKind::BooleanLiteral:
131
+ case ExprKind::FloatLiteral:
132
+ case ExprKind::IntegerLiteral:
133
+ case ExprKind::NilLiteral:
134
+ case ExprKind::StringLiteral: {
135
+ std::string literalOutput;
136
+ llvm::raw_string_ostream OutputStream (literalOutput);
137
+ expr->printConstExprValue (&OutputStream, nullptr );
138
+ if (!literalOutput.empty ()) {
139
+ return std::make_shared<RawLiteralValue>(literalOutput);
144
140
}
141
+ break ;
142
+ }
145
143
146
- case ExprKind::Call:
147
- {
148
- auto callExpr = cast<CallExpr>(expr);
149
- if (callExpr->getFn ()->getKind () == ExprKind::ConstructorRefCall) {
150
- std::vector<FunctionParameter> parameters;
151
- const auto args = callExpr->getArgs ();
152
- for (auto arg : *args) {
153
- auto argExpr = arg.getExpr ();
154
- const auto label = arg.getLabel ().str ().str ();
155
- const auto type = argExpr->getType ();
156
- if (auto defaultArgument = dyn_cast<DefaultArgumentExpr>(argExpr)) {
157
- auto *decl = defaultArgument->getParamDecl ();
158
- if (decl->hasDefaultExpr ()) {
159
- argExpr = decl->getTypeCheckedDefaultExpr ();
160
- }
144
+ case ExprKind::Call: {
145
+ auto callExpr = cast<CallExpr>(expr);
146
+ if (callExpr->getFn ()->getKind () == ExprKind::ConstructorRefCall) {
147
+ std::vector<FunctionParameter> parameters;
148
+ const auto args = callExpr->getArgs ();
149
+ for (auto arg : *args) {
150
+ auto argExpr = arg.getExpr ();
151
+ const auto label = arg.getLabel ().str ().str ();
152
+ const auto type = argExpr->getType ();
153
+ if (auto defaultArgument = dyn_cast<DefaultArgumentExpr>(argExpr)) {
154
+ auto *decl = defaultArgument->getParamDecl ();
155
+ if (decl->hasDefaultExpr ()) {
156
+ argExpr = decl->getTypeCheckedDefaultExpr ();
161
157
}
162
- parameters.push_back ({label, type, extractCompileTimeValue (argExpr)});
163
158
}
164
- auto name = toFullyQualifiedTypeNameString (callExpr->getType ());
165
- return std::make_shared<InitCallValue>(name, parameters);
159
+ parameters.push_back ({label, type, extractCompileTimeValue (argExpr)});
166
160
}
167
- break ;
161
+ auto name = toFullyQualifiedTypeNameString (callExpr->getType ());
162
+ return std::make_shared<InitCallValue>(name, parameters);
168
163
}
164
+ break ;
165
+ }
169
166
170
- default :
171
- {
172
- break ;
173
- }
167
+ default : {
168
+ break ;
169
+ }
174
170
}
175
171
}
176
172
return std::make_shared<RuntimeValue>();
0 commit comments