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

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

            default:
                return(code.ToString());
            }
        }
Exemplo 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}'");
            }
        }
Exemplo 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));
        }
Exemplo n.º 5
0
 public String GetTypedPath(RenderContext context, TypeCheckerTypeCode typeCode)
 {
     return(context.GetTypedNormalizedPath(Path, typeCode));
 }