Browse Source

GENERATED prop: Simplify determining the language of a source file

This simplification will help the later following structural changes of
class `cmSourceFile`.
Deniz Bahadir 5 years ago
parent
commit
b14fe704f8
1 changed files with 7 additions and 9 deletions
  1. 7 9
      Source/cmSourceFile.cxx

+ 7 - 9
Source/cmSourceFile.cxx

@@ -55,16 +55,14 @@ std::string const& cmSourceFile::GetOrDetermineLanguage()
   }
 
   // Perform computation needed to get the language if necessary.
-  if (this->FullPath.empty() && this->Language.empty()) {
-    // If a known extension is given or a known full path is given
-    // then trust that the current extension is sufficient to
-    // determine the language.  This will fail only if the user
-    // specifies a full path to the source but leaves off the
-    // extension, which is kind of weird.
-    if (this->Location.ExtensionIsAmbiguous() &&
+  if (this->Language.empty()) {
+    // If a known extension is given or a known full path is given then trust
+    // that the current extension is sufficient to determine the language. This
+    // will fail only if the user specifies a full path to the source but
+    // leaves off the extension, which is kind of weird.
+    if (this->FullPath.empty() && this->Location.ExtensionIsAmbiguous() &&
         this->Location.DirectoryIsAmbiguous()) {
-      // Finalize the file location to get the extension and set the
-      // language.
+      // Finalize the file location to get the extension and set the language.
       this->ResolveFullPath();
     } else {
       // Use the known extension to get the language if possible.