Skip to content

Commit de419bb

Browse files
committed
Chg: Version Add
1 parent a458a20 commit de419bb

File tree

4 files changed

+35
-35
lines changed

4 files changed

+35
-35
lines changed

NeoLua.NuGet/common.targets

+1-1
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@
1414
<AssemblyVersion>5.3.0.0</AssemblyVersion>
1515
<FileVersion>1.3.14.0</FileVersion>
1616

17-
<VersionAdd>beta.0</VersionAdd>
17+
<VersionAdd>beta.1</VersionAdd>
1818
<SimpleVersionPattern>^(\d+)\.(\d+)\.(\d+)</SimpleVersionPattern>
1919
<SimpleVersion>$([System.Text.RegularExpressions.Regex]::Match($(FileVersion), $(SimpleVersionPattern)))</SimpleVersion>
2020

NeoLua.Test/Functions.cs

+27-24
Original file line numberDiff line numberDiff line change
@@ -364,42 +364,45 @@ public void TestFunctions62()
364364
public void TestForwardDeclaration()
365365
{
366366
TestCode(
367-
@"local f
368-
function f()
369-
return 'Hello'
370-
end
367+
@"local f
368+
function f()
369+
return 'Hello'
370+
end
371371

372-
return f()",
373-
"Hello");
372+
return f()",
373+
"Hello"
374+
);
374375
}
375376
[TestMethod]
376377
public void TestDoubleLocalFunction()
377378
{
378379
TestCode(
379-
@"local function f()
380-
return 'Hello'
381-
end
382-
local function f()
383-
return 'World'
384-
end
385-
return f()",
386-
"World");
380+
@"local function f()
381+
return 'Hello'
382+
end
383+
local function f()
384+
return 'World'
385+
end
386+
return f()",
387+
"World"
388+
);
387389
}
388390

389391
[TestMethod]
390392
public void TestLocalMutualRecursiveFunction()
391393
{
392394
TestCode(
393-
@"
394-
local f1, f2
395-
function f2()
396-
return f1()
397-
end
398-
function f1()
399-
return 'Hello'
400-
end
401-
return _G['f2'] == nil",
402-
true);
395+
@"
396+
local f1, f2
397+
function f2()
398+
return f1()
399+
end
400+
function f1()
401+
return 'Hello'
402+
end
403+
return _G['f2'] == nil",
404+
true
405+
);
403406
}
404407

405408
[TestMethod]

NeoLua/Parser.cs

+7-9
Original file line numberDiff line numberDiff line change
@@ -99,8 +99,7 @@ private void RegisterVariableOrConst(string name, Expression expr)
9999
public virtual Expression LookupExpression(string name, bool isLocalOnly = false)
100100
{
101101
// Lookup the current scope
102-
Expression p;
103-
if (scopeVariables != null && scopeVariables.TryGetValue(name, out p))
102+
if (scopeVariables != null && scopeVariables.TryGetValue(name, out var p))
104103
return p;
105104

106105
return parent != null && !isLocalOnly ? // lookup the parent scope
@@ -2181,17 +2180,16 @@ private static void ParseFunction(Scope scope, ILuaLexer code, bool isLocal)
21812180
{
21822181
var t = FetchToken(LuaToken.Identifier, code);
21832182

2184-
ParameterExpression funcVar = scope.LookupExpression(t.Value) as ParameterExpression;
2183+
var funcVar = scope.LookupExpression(t.Value) as ParameterExpression;
21852184
Expression exprFunction;
21862185
if (funcVar == null)
21872186
{
21882187
exprFunction = ParseLamdaDefinition(scope, code, t.Value, false,
2189-
typeDelegate => funcVar = scope.RegisterVariable(typeDelegate, t.Value));
2188+
typeDelegate => funcVar = scope.RegisterVariable(typeDelegate, t.Value)
2189+
);
21902190
}
21912191
else
2192-
{
21932192
exprFunction = ParseLamdaDefinition(scope, code, t.Value, false, null);
2194-
}
21952193

21962194
scope.AddExpression(Expression.Assign(funcVar, exprFunction));
21972195
}
@@ -2211,7 +2209,7 @@ private static void ParseFunction(Scope scope, ILuaLexer code, bool isLocal)
22112209
memberName = FetchToken(LuaToken.Identifier, code).Value;
22122210
}
22132211
// add a method to the table. methods get a hidden parameter and will bo marked
2214-
bool lMethodMember = false;
2212+
var isMemberMethod = false;
22152213
if (code.Current.Typ == LuaToken.Colon)
22162214
{
22172215
code.Next();
@@ -2220,7 +2218,7 @@ private static void ParseFunction(Scope scope, ILuaLexer code, bool isLocal)
22202218
assignee = ParseFunctionAddChain(scope, tCurrent, assignee, memberName);
22212219
// fetch the method name
22222220
memberName = FetchToken(LuaToken.Identifier, code).Value;
2223-
lMethodMember = true;
2221+
isMemberMethod = true;
22242222
}
22252223
else
22262224
{
@@ -2239,7 +2237,7 @@ private static void ParseFunction(Scope scope, ILuaLexer code, bool isLocal)
22392237
}
22402238

22412239
// generate lambda
2242-
scope.AddExpression(MemberSetExpression(scope.Runtime, tCurrent, assignee, memberName, lMethodMember, ParseLamdaDefinition(scope, code, memberName, lMethodMember, null)));
2240+
scope.AddExpression(MemberSetExpression(scope.Runtime, tCurrent, assignee, memberName, isMemberMethod, ParseLamdaDefinition(scope, code, memberName, isMemberMethod, null)));
22432241
}
22442242
} // proc ParseLamdaDefinition
22452243

todo.txt

-1
This file was deleted.

0 commit comments

Comments
 (0)