diff options
| author | Rob Mensching <rob@firegiant.com> | 2017-11-11 01:40:34 -0800 |
|---|---|---|
| committer | Rob Mensching <rob@firegiant.com> | 2017-11-11 01:40:34 -0800 |
| commit | 414bf166e07703056ad186fa8ec23a4119dd9993 (patch) | |
| tree | 960aa302bcc3b7d80db3f2cdd87462251790f091 /src/WixToolset.Data/IntermediateTuple.cs | |
| parent | 69b15d96cebdbb7201b1849b4f62786633d70b8d (diff) | |
| download | wix-414bf166e07703056ad186fa8ec23a4119dd9993.tar.gz wix-414bf166e07703056ad186fa8ec23a4119dd9993.tar.bz2 wix-414bf166e07703056ad186fa8ec23a4119dd9993.zip | |
Additional IR updates
Diffstat (limited to 'src/WixToolset.Data/IntermediateTuple.cs')
| -rw-r--r-- | src/WixToolset.Data/IntermediateTuple.cs | 21 |
1 files changed, 19 insertions, 2 deletions
diff --git a/src/WixToolset.Data/IntermediateTuple.cs b/src/WixToolset.Data/IntermediateTuple.cs index 36cee2aa..0f1e5965 100644 --- a/src/WixToolset.Data/IntermediateTuple.cs +++ b/src/WixToolset.Data/IntermediateTuple.cs | |||
| @@ -30,12 +30,17 @@ namespace WixToolset.Data | |||
| 30 | 30 | ||
| 31 | internal static IntermediateTuple Deserialize(ITupleDefinitionCreator creator, JsonObject jsonObject) | 31 | internal static IntermediateTuple Deserialize(ITupleDefinitionCreator creator, JsonObject jsonObject) |
| 32 | { | 32 | { |
| 33 | var definitionName = jsonObject.GetValueOrDefault<string>("def"); | 33 | var definitionName = jsonObject.GetValueOrDefault<string>("type"); |
| 34 | var idJson = jsonObject.GetValueOrDefault<JsonObject>("id"); | ||
| 35 | var sourceLineNumbersJson = jsonObject.GetValueOrDefault<JsonObject>("ln"); | ||
| 34 | var fieldsJson = jsonObject.GetValueOrDefault<JsonArray>("fields"); | 36 | var fieldsJson = jsonObject.GetValueOrDefault<JsonArray>("fields"); |
| 35 | 37 | ||
| 36 | creator.TryGetTupleDefinitionByName(definitionName, out var definition); // TODO: this isn't sufficient. | 38 | creator.TryGetTupleDefinitionByName(definitionName, out var definition); // TODO: this isn't sufficient. |
| 37 | var tuple = definition.CreateTuple(); | 39 | var tuple = definition.CreateTuple(); |
| 38 | 40 | ||
| 41 | tuple.Id = (idJson == null) ? null : Identifier.Deserialize(idJson); | ||
| 42 | tuple.SourceLineNumbers = (sourceLineNumbersJson == null) ? null : SourceLineNumber.Deserialize(sourceLineNumbersJson); | ||
| 43 | |||
| 39 | for (var i = 0; i < fieldsJson.Count; ++i) | 44 | for (var i = 0; i < fieldsJson.Count; ++i) |
| 40 | { | 45 | { |
| 41 | if (tuple.Fields.Length > i && fieldsJson[i] is JsonObject fieldJson) | 46 | if (tuple.Fields.Length > i && fieldsJson[i] is JsonObject fieldJson) |
| @@ -51,9 +56,21 @@ namespace WixToolset.Data | |||
| 51 | { | 56 | { |
| 52 | var jsonObject = new JsonObject | 57 | var jsonObject = new JsonObject |
| 53 | { | 58 | { |
| 54 | { "def", this.Definition.Name } | 59 | { "type", this.Definition.Name } |
| 55 | }; | 60 | }; |
| 56 | 61 | ||
| 62 | var idJson = this.Id?.Serialize(); | ||
| 63 | if (idJson != null) | ||
| 64 | { | ||
| 65 | jsonObject.Add("id", idJson); | ||
| 66 | } | ||
| 67 | |||
| 68 | var lnJson = this.SourceLineNumbers?.Serialize(); | ||
| 69 | if (lnJson != null) | ||
| 70 | { | ||
| 71 | jsonObject.Add("ln", lnJson); | ||
| 72 | } | ||
| 73 | |||
| 57 | var fieldsJson = new JsonArray(this.Fields.Length); | 74 | var fieldsJson = new JsonArray(this.Fields.Length); |
| 58 | 75 | ||
| 59 | foreach (var field in this.Fields) | 76 | foreach (var field in this.Fields) |
