Esempio n. 1
0
        internal void CheckValueType(RenderContext context, TypeCheckerTypeCode typeCode)
        {
            var valBind = GetBinding(nameof(Value));

            if (valBind != null)
            {
                valBind.GetTypedPath(context, typeCode);
            }
        }
Esempio n. 2
0
        String TypeCodeToString(TypeCheckerTypeCode code)
        {
            switch (code)
            {
            case TypeCheckerTypeCode.Boolean:
            case TypeCheckerTypeCode.String:
                return(code.ToString().ToLowerInvariant());

            default:
                return(code.ToString());
            }
        }
Esempio n. 3
0
        public void CheckTypedXamlExpression(String expression, TypeCheckerTypeCode typeCode)
        {
            var type = CalcExpression(expression)?.Type;

            if (type == null)
            {
                return;
            }
            var codeString = TypeCodeToString(typeCode);

            if (type.TypeName != codeString)
            {
                throw new TypeCheckerException($"Xaml. Path='{expression}'. Incompatible types. Expected:'{codeString}', Actual:'{type.TypeName}'");
            }
        }
Esempio n. 4
0
        internal String GetTypedNormalizedPath(String path, TypeCheckerTypeCode typeCode, Boolean isWrapped = false)
        {
            // check for invert
            if (path == null)
            {
                path = String.Empty;
            }
            if (path.StartsWith("!"))
            {
                return("!" + GetNormalizedPathInternal(path.Substring(1)));
            }

            if (_typeChecker != null && typeCode != TypeCheckerTypeCode.Skip)
            {
                _typeChecker.CheckTypedXamlExpression(GetExpressionForChecker(path), typeCode);
            }

            return(GetNormalizedPathInternal(path, isWrapped));
        }
Esempio n. 5
0
 public String GetTypedPath(RenderContext context, TypeCheckerTypeCode typeCode)
 {
     return(context.GetTypedNormalizedPath(Path, typeCode));
 }