Skip to content

Commit

Permalink
WI TypeCobolTeam#1301 GetType return empty list if dataType Cob85
Browse files Browse the repository at this point in the history
GetType is intented fot find a TypeDefinition.
TypeDefinition is from Cobol2002 or above so there is no need to
search for a TypeDefinition if the dataType is Cobol85.
  • Loading branch information
osmedile committed Mar 10, 2019
1 parent 15a2cb9 commit 93d5f72
Showing 1 changed file with 10 additions and 2 deletions.
12 changes: 10 additions & 2 deletions TypeCobol/Compiler/CodeModel/SymbolTable.cs
Original file line number Diff line number Diff line change
Expand Up @@ -892,20 +892,28 @@ public void AddDataDefinitionsUnderType([NotNull] DataDefinition data)
}
}

public IList<TypeDefinition> EmptyTypeDefinitionList = new List<TypeDefinition>();
[NotNull]
public IList<TypeDefinition> GetType(DataDefinition symbol)
{
return GetType(symbol.DataType);
}

[NotNull]
public List<TypeDefinition> GetType(SymbolReference symbolReference)
{
return GetType(symbolReference.URI);
}



public List<TypeDefinition> GetType(DataType dataType, string pgmName = null)
[NotNull]
public IList<TypeDefinition> GetType(DataType dataType, string pgmName = null)
{
if (dataType.CobolLanguageLevel == CobolLanguageLevel.Cobol85)
{
return EmptyTypeDefinitionList;
}

var uri = new URI(dataType.Name);
var types = GetType(uri);
if (types.Count > 0)
Expand Down

0 comments on commit 93d5f72

Please sign in to comment.