Fix parser bug for bonded<T> with forward declaration

A forward declaration is a valid type argument for bonded.
This commit is contained in:
Adam Sapek 2015-04-02 02:57:20 -07:00
Родитель f47fd52ae4
Коммит 91db1c4f12
3 изменённых файлов: 5 добавлений и 3 удалений

Просмотреть файл

@ -281,6 +281,7 @@ complexType =
_ -> scalarType t
validBondedType t = case t of
BT_TypeParam _ -> True
BT_UserDefined Forward {} _ -> True
_ -> structType t

Просмотреть файл

@ -1,6 +1,7 @@
namespace tests
struct Foo {}
struct Foo {};
struct Bar;
struct ComplexTypes
{
@ -10,5 +11,5 @@ struct ComplexTypes
3: nullable<float> nf;
4: map<string, wstring> msws;
5: bonded<Foo> bfoo;
6: map<double, list<vector<nullable<bonded<Foo>>>>> m;
6: map<double, list<vector<nullable<bonded<Bar>>>>> m;
}

Просмотреть файл

@ -1 +1 @@
{"namespaces":[{"name":["tests"]}],"imports":[],"declarations":[{"structBase":null,"tag":"Struct","structFields":[],"declParams":[],"declNamespaces":[{"name":["tests"]}],"declName":"Foo","declAttributes":[]},{"structBase":null,"tag":"Struct","structFields":[{"fieldModifier":"Optional","fieldDefault":null,"fieldType":{"type":"list","element":"int8"},"fieldName":"li8","fieldAttributes":[],"fieldOrdinal":0},{"fieldModifier":"Optional","fieldDefault":null,"fieldType":{"type":"set","element":"bool"},"fieldName":"sb","fieldAttributes":[],"fieldOrdinal":1},{"fieldModifier":"Optional","fieldDefault":null,"fieldType":{"type":"vector","element":"blob"},"fieldName":"vb","fieldAttributes":[],"fieldOrdinal":2},{"fieldModifier":"Optional","fieldDefault":null,"fieldType":{"type":"nullable","element":"float"},"fieldName":"nf","fieldAttributes":[],"fieldOrdinal":3},{"fieldModifier":"Optional","fieldDefault":null,"fieldType":{"key":"string","type":"map","element":"wstring"},"fieldName":"msws","fieldAttributes":[],"fieldOrdinal":4},{"fieldModifier":"Optional","fieldDefault":null,"fieldType":{"type":"bonded","element":{"declaration":{"structBase":null,"tag":"Struct","structFields":[],"declParams":[],"declNamespaces":[{"name":["tests"]}],"declName":"Foo","declAttributes":[]},"type":"user"}},"fieldName":"bfoo","fieldAttributes":[],"fieldOrdinal":5},{"fieldModifier":"Optional","fieldDefault":null,"fieldType":{"key":"double","type":"map","element":{"type":"list","element":{"type":"vector","element":{"type":"nullable","element":{"type":"bonded","element":{"declaration":{"structBase":null,"tag":"Struct","structFields":[],"declParams":[],"declNamespaces":[{"name":["tests"]}],"declName":"Foo","declAttributes":[]},"type":"user"}}}}}},"fieldName":"m","fieldAttributes":[],"fieldOrdinal":6}],"declParams":[],"declNamespaces":[{"name":["tests"]}],"declName":"ComplexTypes","declAttributes":[]}]}
{"namespaces":[{"name":["tests"]}],"imports":[],"declarations":[{"structBase":null,"tag":"Struct","structFields":[],"declParams":[],"declNamespaces":[{"name":["tests"]}],"declName":"Foo","declAttributes":[]},{"tag":"Forward","declParams":[],"declNamespaces":[{"name":["tests"]}],"declName":"Bar"},{"structBase":null,"tag":"Struct","structFields":[{"fieldModifier":"Optional","fieldDefault":null,"fieldType":{"type":"list","element":"int8"},"fieldName":"li8","fieldAttributes":[],"fieldOrdinal":0},{"fieldModifier":"Optional","fieldDefault":null,"fieldType":{"type":"set","element":"bool"},"fieldName":"sb","fieldAttributes":[],"fieldOrdinal":1},{"fieldModifier":"Optional","fieldDefault":null,"fieldType":{"type":"vector","element":"blob"},"fieldName":"vb","fieldAttributes":[],"fieldOrdinal":2},{"fieldModifier":"Optional","fieldDefault":null,"fieldType":{"type":"nullable","element":"float"},"fieldName":"nf","fieldAttributes":[],"fieldOrdinal":3},{"fieldModifier":"Optional","fieldDefault":null,"fieldType":{"key":"string","type":"map","element":"wstring"},"fieldName":"msws","fieldAttributes":[],"fieldOrdinal":4},{"fieldModifier":"Optional","fieldDefault":null,"fieldType":{"type":"bonded","element":{"declaration":{"structBase":null,"tag":"Struct","structFields":[],"declParams":[],"declNamespaces":[{"name":["tests"]}],"declName":"Foo","declAttributes":[]},"type":"user"}},"fieldName":"bfoo","fieldAttributes":[],"fieldOrdinal":5},{"fieldModifier":"Optional","fieldDefault":null,"fieldType":{"key":"double","type":"map","element":{"type":"list","element":{"type":"vector","element":{"type":"nullable","element":{"type":"bonded","element":{"declaration":{"tag":"Forward","declParams":[],"declNamespaces":[{"name":["tests"]}],"declName":"Bar"},"type":"user"}}}}}},"fieldName":"m","fieldAttributes":[],"fieldOrdinal":6}],"declParams":[],"declNamespaces":[{"name":["tests"]}],"declName":"ComplexTypes","declAttributes":[]}]}