Skip to content

Commit 124d583

Browse files
committed
#200 - static analysis
1 parent 023b6d4 commit 124d583

File tree

1 file changed

+10
-1
lines changed

1 file changed

+10
-1
lines changed

src/Application/HydraScript.Application.StaticAnalysis/Visitors/SemanticChecker.cs

Lines changed: 10 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -42,7 +42,8 @@ internal class SemanticChecker : VisitorBase<IAbstractSyntaxTreeNode, Type>,
4242
IVisitor<CallExpression, Type>,
4343
IVisitor<FunctionDeclaration, Type>,
4444
IVisitor<BlockStatement, Type>,
45-
IVisitor<OutputStatement, Type>
45+
IVisitor<OutputStatement, Type>,
46+
IVisitor<InputStatement, Type>
4647
{
4748
private readonly IDefaultValueForTypeCalculator _calculator;
4849
private readonly IFunctionWithUndefinedReturnStorage _functionStorage;
@@ -553,4 +554,12 @@ public Type Visit(OutputStatement visitable)
553554
visitable.Expression.Accept(This);
554555
return "undefined";
555556
}
557+
558+
public Type Visit(InputStatement visitable)
559+
{
560+
var idType = visitable.Destination.Accept(This);
561+
if (!idType.Equals("string"))
562+
throw new UnsupportedOperation(visitable.Segment, idType, "<<<");
563+
return "undefined";
564+
}
556565
}

0 commit comments

Comments
 (0)