Exemple #1
0
 public void AddCustomTupleDefinition(IntermediateTupleDefinition definition)
 {
     if (!this.CustomDefinitionByName.TryGetValue(definition.Name, out var existing) || definition.Revision > existing.Revision)
     {
         this.CustomDefinitionByName[definition.Name] = definition;
     }
 }
Exemple #2
0
 public IntermediateTuple(IntermediateTupleDefinition definition, SourceLineNumber sourceLineNumber, Identifier id = null)
 {
     this.Definition        = definition;
     this.Fields            = new IntermediateField[definition.FieldDefinitions.Length];
     this.SourceLineNumbers = sourceLineNumber;
     this.Id = id;
 }
Exemple #3
0
        public bool TryGetTupleDefinitionByName(string name, out IntermediateTupleDefinition tupleDefinition)
        {
            tupleDefinition = TupleDefinitions.ByName(name);

            if (tupleDefinition == null)
            {
                tupleDefinition = this.CustomDefinitionByName.GetValueOrDefault(name);
            }

            return(tupleDefinition != null);
        }
Exemple #4
0
        /// <summary>
        /// Loads custom definitions in intermediate json into the creator.
        /// </summary>
        /// <param name="json">Json version of intermediate.</param>
        /// <param name="creator">ITupleDefinitionCreator to use when reconstituting the intermediate.</param>
        private static void LoadDefinitions(JsonObject json, ITupleDefinitionCreator creator)
        {
            var definitionsJson = json.GetValueOrDefault <JsonArray>("definitions");

            if (definitionsJson != null)
            {
                foreach (JsonObject definitionJson in definitionsJson)
                {
                    var definition = IntermediateTupleDefinition.Deserialize(definitionJson);
                    creator.AddCustomTupleDefinition(definition);
                }
            }
        }
Exemple #5
0
 public IntermediateTuple(IntermediateTupleDefinition definition) : this(definition, null, null)
 {
 }