コード例 #1
0
        public SwitchAction(ParseInfo parseInfo, Scope scope, Switch switchContext)
        {
            // Get the expression.
            Expression = parseInfo.GetExpression(scope, switchContext.Expression);

            paths    = GetSections(ResolveElements(parseInfo.SetBreakHandler(this), scope, switchContext));
            pathInfo = new PathInfo[paths.Length];

            for (int i = 0; i < pathInfo.Length; i++)
            {
                pathInfo[i] = new PathInfo(paths[i].Block, paths[i].ErrorRange, paths[i].IsDefault);
            }
        }
コード例 #2
0
        public SwitchAction(ParseInfo parseInfo, Scope scope, DeltinScriptParser.SwitchContext switchContext)
        {
            // Get the expression.
            if (switchContext.expr() == null)
            {
                parseInfo.Script.Diagnostics.Error("Expected expression.", DocRange.GetRange(switchContext.RIGHT_PAREN()));
            }
            else
            {
                Expression = parseInfo.GetExpression(scope, switchContext.expr());
            }

            paths    = GetSections(ResolveElements(parseInfo.SetBreakHandler(this), scope, switchContext));
            pathInfo = new PathInfo[paths.Length];

            for (int i = 0; i < pathInfo.Length; i++)
            {
                pathInfo[i] = new PathInfo(paths[i].Block, paths[i].ErrorRange, paths[i].IsDefault);
            }
        }