diff --git a/src/MoonSharp.Interpreter/Tree/Expressions/IndexExpression.cs b/src/MoonSharp.Interpreter/Tree/Expressions/IndexExpression.cs index 07b26a9e..ff337eee 100644 --- a/src/MoonSharp.Interpreter/Tree/Expressions/IndexExpression.cs +++ b/src/MoonSharp.Interpreter/Tree/Expressions/IndexExpression.cs @@ -10,7 +10,6 @@ class IndexExpression : Expression, IVariable Expression m_BaseExp; Expression m_IndexExp; string m_Name; - private Token nameToken; private bool inc; private bool dec; private bool nilCheck; @@ -125,7 +124,7 @@ public void CompileAssignment(ByteCode bc, Operator op, int stackofs, int tuplei { if (isLength) { - throw new SyntaxErrorException(nameToken, "Cannot assign to readonly property .length"); + throw new SyntaxErrorException(null, "Cannot assign to readonly property .length"); } if (op != Operator.NotAnOperator) { diff --git a/src/MoonSharp.Interpreter/Tree/Lexer/Lexer.cs b/src/MoonSharp.Interpreter/Tree/Lexer/Lexer.cs index 85776255..67ffb58d 100755 --- a/src/MoonSharp.Interpreter/Tree/Lexer/Lexer.cs +++ b/src/MoonSharp.Interpreter/Tree/Lexer/Lexer.cs @@ -851,9 +851,7 @@ private Token ReadHashBang(int fromLine, int fromCol) private Token ReadCMultilineComment(int fromLine, int fromCol) { StringBuilder text = new StringBuilder(32); - - bool extraneousFound = false; - + for (char c = CursorChar(); ; c = CursorCharNext()) { if (c == '\r') continue; @@ -894,7 +892,6 @@ private Token ReadComment(int fromLine, int fromCol) } else if (c == '\n') { - extraneousFound = true; CursorCharNext(); return CreateToken(TokenType.Comment, fromLine, fromCol, text.ToString()); } diff --git a/src/MoonSharp.Interpreter/Tree/Statements/FunctionDefinitionStatement.cs b/src/MoonSharp.Interpreter/Tree/Statements/FunctionDefinitionStatement.cs index e1e51339..27e2ace3 100644 --- a/src/MoonSharp.Interpreter/Tree/Statements/FunctionDefinitionStatement.cs +++ b/src/MoonSharp.Interpreter/Tree/Statements/FunctionDefinitionStatement.cs @@ -11,14 +11,14 @@ class FunctionDefinitionStatement : Statement internal class FunctionParamRef { public string Name { get; set; } - public Expression? DefaultValue { get; set; } + public Expression DefaultValue { get; set; } public FunctionParamRef(string name) { Name = name; } - public FunctionParamRef(string name, Expression? defaultValue) + public FunctionParamRef(string name, Expression defaultValue) { Name = name; DefaultValue = defaultValue;