@@ -248,6 +248,23 @@ ProcedureRef::~ProcedureRef() {}
248
248
249
249
void ProcedureRef::Deleter (ProcedureRef *p) { delete p; }
250
250
251
+ // We don't know the dummy argument info (e.g., procedure with implicit
252
+ // interface
253
+ static void DetermineCopyInOutArgument (
254
+ const characteristics::Procedure &procInfo, ActualArgument &actual) {
255
+
256
+ // Only check that actual argument is contiguous
257
+ // For non-contiguous, do copy-in
258
+ }
259
+
260
+ static void DetermineCopyInOutArgument (
261
+ const characteristics::Procedure &procInfo,
262
+ ActualArgument &actual, characteristics::DummyArgument &dummy) {
263
+
264
+ // TODO: assert? procInfo.HasExplicitInterface()
265
+
266
+ }
267
+
251
268
void ProcedureRef::DetermineCopyInOut () {
252
269
if (!proc_.GetSymbol ()) {
253
270
return ;
@@ -261,6 +278,50 @@ void ProcedureRef::DetermineCopyInOut() {
261
278
}
262
279
// TODO: at this point have dummy arguments as procInfo->dummyArguments
263
280
// and have actual arguments via arguments_
281
+
282
+ // TODO: implicitly declared procedure may not have any information about
283
+ // its dummy args. Handle this case.
284
+
285
+ // Don't change anything about actual or dummy arguments, except for
286
+ // computing copy-in/copy-out information. If detect something wrong with
287
+ // the arguments, stop processing and let semantic analysis generate the
288
+ // error messages.
289
+ size_t index{0 };
290
+ std::set<std::string> processedKeywords;
291
+ bool seenKeyword{false };
292
+ for (auto &actual : arguments_) {
293
+ if (!actual) {
294
+ continue ;
295
+ }
296
+ if (index >= procInfo->dummyArguments .size ()) {
297
+ // More actual arguments than dummy arguments. Semantic analysis will
298
+ // deal with the error.
299
+ return ;
300
+ }
301
+ if (actual->keyword ()) {
302
+ seenKeyword = true ;
303
+ auto actualName = actual->keyword ()->ToString ();
304
+ if (processedKeywords.find (actualName) != processedKeywords.end ()) {
305
+ // Actual arguments with duplicate keywords. Semantic analysis will
306
+ // deal with the error.
307
+ return ;
308
+ }
309
+ else {
310
+ processedKeywords.insert (actualName);
311
+
312
+ }
313
+ }
314
+ else if (seenKeyword) {
315
+ // Non-keyword actual argument after have seen at least one keyword
316
+ // actual argument. Semantic analysis will deal with the error.
317
+ return ;
318
+ }
319
+ else {
320
+ // Positional argument processing
321
+ }
322
+
323
+ ++index;
324
+ }
264
325
}
265
326
266
327
} // namespace Fortran::evaluate
0 commit comments