1
1
mirror of https://github.com/github/semantic.git synced 2024-12-22 22:31:36 +03:00

Allow dictionaries to be identifiable

This commit is contained in:
joshvera 2017-01-09 15:20:36 -05:00
parent 57137db0cf
commit 98c5c41cfa
2 changed files with 3 additions and 2 deletions

View File

@ -62,6 +62,7 @@ identifiable term = isIdentifiable (unwrap term) term
S.Pair{} -> Identifiable S.Pair{} -> Identifiable
S.Struct{} -> Identifiable S.Struct{} -> Identifiable
S.Array ty _ -> if isJust ty then Identifiable else Unidentifiable S.Array ty _ -> if isJust ty then Identifiable else Unidentifiable
S.Object ty _ -> if isJust ty then Identifiable else Unidentifiable
S.BlockStatement{} -> Identifiable S.BlockStatement{} -> Identifiable
_ -> Unidentifiable _ -> Unidentifiable
@ -223,7 +224,7 @@ toTermName source term = case unwrap term of
S.Ternary expr _ -> toTermName' expr S.Ternary expr _ -> toTermName' expr
S.OperatorAssignment id _ -> toTermName' id S.OperatorAssignment id _ -> toTermName' id
S.Operator _ -> termNameFromSource term S.Operator _ -> termNameFromSource term
S.Object _ kvs -> "{ " <> Text.intercalate ", " (toTermName' <$> kvs) <> " }" S.Object ty kvs -> maybe ("{ " <> Text.intercalate ", " (toTermName' <$> kvs) <> " }") termNameFromSource ty
S.Pair k v -> toKeyName k <> toArgName v S.Pair k v -> toKeyName k <> toArgName v
S.Return children -> Text.intercalate ", " (termNameFromSource <$> children) S.Return children -> Text.intercalate ", " (termNameFromSource <$> children)
S.Yield children -> Text.intercalate ", " (termNameFromSource <$> children) S.Yield children -> Text.intercalate ", " (termNameFromSource <$> children)

View File

@ -214,7 +214,7 @@ categoryForGoName = \case
"type_conversion_expression" -> TypeConversion "type_conversion_expression" -> TypeConversion
"keyed_element" -> Pair "keyed_element" -> Pair
"struct_type" -> StructTy "struct_type" -> StructTy
"dictionary_type" -> DictionaryTy "map_type" -> DictionaryTy
"array_type" -> ArrayTy "array_type" -> ArrayTy
"implicit_length_array_type" -> ArrayTy "implicit_length_array_type" -> ArrayTy
s -> Other (toS s) s -> Other (toS s)