Ejemplo n.º 1
0
        public static JTokenType ConvertInterpreterArrayTypeIntoJTokenType(IConstruct l)
        {
            string expectedValueType = l.GetType().Name;

            if (expectedValueType == "Variable")
            {
                Variable v = l as Variable;
                return(ConvertInterpreterArrayTypeIntoJTokenType(v.Value));
            }
            else if (expectedValueType == "Array")
            {
                var a = (l as HiSystems.Interpreter.Array).ToList();
                if (a.Count > 0)
                {
                    return(ConvertInterpreterTypeIntoJTokenType(a[0]));
                }
                else
                {
                    throw new System.ArgumentException($"ConvertInterpreterArrayTypeIntoJTokenType() cannot infer the type of the array because the array is empty, l:{l.ToString()} ");
                }
            }
            else
            {
                throw new System.ArgumentException($"ConvertInterpreterArrayTypeIntoJTokenType() requires an array as first parameter, received:${l.ToString()}");
            }
        }
Ejemplo n.º 2
0
 public void Visit(IConstruct construct)
 {
     if (construct.GetType().Name.CompareTo("CfnFunction") == 0)
     {
         ((CfnResource)construct).AddPropertyOverride("Runtime", "nodejs12.x");
     }
 }
Ejemplo n.º 3
0
        public static JTokenType ConvertInterpreterTypeIntoJTokenType(IConstruct l)
        {
            string expectedValueType = l.GetType().Name;

            if (expectedValueType == "Variable")
            {
                Variable v = l as Variable;
                return(ConvertInterpreterTypeIntoJTokenType(v.Value));
            }
            if (expectedValueType == "Operation")
            {
                var r = l.Transform();
                return(ConvertInterpreterTypeIntoJTokenType(r));
            }
            if (expectedValueType == "FunctionOperation")
            {
                return(ConvertInterpreterTypeIntoJTokenType(l.Transform()));
            }
            if (expectedValueType == "Array")
            {
                return(JTokenType.Array);
            }
            if (expectedValueType == "Number")
            {
                return(JTokenType.Float);
            }
            if (expectedValueType == "Text")
            {
                return(JTokenType.String);
            }
            if (expectedValueType == "DateTime")
            {
                return(JTokenType.Date);
            }
            if (expectedValueType == "Boolean")
            {
                return(JTokenType.Boolean);
            }
            if (expectedValueType == "Null")
            {
                return(JTokenType.Null);
            }
            if (expectedValueType == "Array")
            {
                return(JTokenType.Array);
            }
            return(JTokenType.Undefined);
        }