@@ -120,57 +120,53 @@ parseProtocolListFromFile(StringRef protocolListFilePath,
120120 return true ;
121121}
122122
123- static std::shared_ptr<CompileTimeValue>
124- extractCompileTimeValue (Expr *expr) {
123+ static std::shared_ptr<CompileTimeValue> extractCompileTimeValue (Expr *expr) {
125124 if (expr) {
126125 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);
144140 }
141+ break ;
142+ }
145143
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 ();
161157 }
162- parameters.push_back ({label, type, extractCompileTimeValue (argExpr)});
163158 }
164- auto name = toFullyQualifiedTypeNameString (callExpr->getType ());
165- return std::make_shared<InitCallValue>(name, parameters);
159+ parameters.push_back ({label, type, extractCompileTimeValue (argExpr)});
166160 }
167- break ;
161+ auto name = toFullyQualifiedTypeNameString (callExpr->getType ());
162+ return std::make_shared<InitCallValue>(name, parameters);
168163 }
164+ break ;
165+ }
169166
170- default :
171- {
172- break ;
173- }
167+ default : {
168+ break ;
169+ }
174170 }
175171 }
176172 return std::make_shared<RuntimeValue>();
0 commit comments