예제 #1
0
        public void Visit(ReturnAstNode visitable)
        {
            if (!_functionExpectReturn)
            {
                throw new SemanticException("Unexpected return statement");
            }

            Visit(visitable.ReturnValue);
            _functionHasReturn     = true;
            _functionAllPathReturn = true;
            if (_functionExpectReturn && _exprType != _functionReturnType)
            {
                throw new WrongTypeException(
                          $"Function should return {_functionReturnType}, but {_exprType} actually");
            }
        }
예제 #2
0
 public override InoTypeEnum Visit(ReturnAstNode node)
 {
     CurrentReturnType = Visit(node.ReturnExpression);
     return(InoTypeEnum.undefined);
 }
 public void Visit(ReturnAstNode visitable)
 {
     throw new System.NotImplementedException();
 }
예제 #4
0
 public void TestReturn(ReturnAstNode expect, ReturnAstNode actual,
                        string traceMessage)
 {
     TestGeneral(expect.ReturnValue, actual.ReturnValue,
                 traceMessage + " -> Return");
 }
예제 #5
0
 public override string Visit(ReturnAstNode node)
 {
     return($"return {Visit(node.ReturnExpression)};");
 }