diff options
| author | Jean-Philippe Bruyère <jp_bruyere@hotmail.com> | 2017-01-20 16:27:38 +0100 |
|---|---|---|
| committer | Jean-Philippe Bruyère <jp_bruyere@hotmail.com> | 2017-01-20 16:27:38 +0100 |
| commit | bf810209745cc2f90bb5f60164efaa1b6259a31f (patch) | |
| tree | a934dea13ceb29f563d55a7f26f017cbcee0b675 /src/CompilerServices/CompilerServices.cs | |
| parent | 3491fb025162f176d10216e2f960cbad42b3bba2 (diff) | |
code clean and comments
Diffstat (limited to 'src/CompilerServices/CompilerServices.cs')
| -rw-r--r-- | src/CompilerServices/CompilerServices.cs | 38 |
1 files changed, 2 insertions, 36 deletions
diff --git a/src/CompilerServices/CompilerServices.cs b/src/CompilerServices/CompilerServices.cs index 86dbd66a..c626a6e2 100644 --- a/src/CompilerServices/CompilerServices.cs +++ b/src/CompilerServices/CompilerServices.cs @@ -648,7 +648,7 @@ namespace Crow il.Emit (OpCodes.Ldarg_0); //load sender ref onto the stack, the current node if (lopParts.Length > 1) { - NodeAddress lopNA = getNodeAdressFromBindingExp (currentNode, ref operandes [0]); + NodeAddress lopNA = currentNode.ResolveExpression (ref operandes [0]); CompilerServices.emitGetInstance (il, currentNode, lopNA); lopType = lopNA.NodeType; } @@ -772,7 +772,7 @@ namespace Crow il.Emit (OpCodes.Ldarg_0); //load sender ref onto the stack if (lopParts.Length > 1) { - NodeAddress lopNA = getNodeAdressFromBindingExp (currentNode, ref operandes [0]); + NodeAddress lopNA = currentNode.ResolveExpression (ref operandes [0]); CompilerServices.emitGetInstance (il, currentNode, lopNA); lopType = lopNA.NodeType; } @@ -876,40 +876,6 @@ namespace Crow exps.Add(expression); return exps.ToArray (); } - - /// <summary> - /// Gets the node adress from binding expression starting at sourceAddr - /// and return in expression remaining part - /// </summary> - internal static NodeAddress getNodeAdressFromBindingExp(NodeAddress sourceAddr, ref string expression){ - int ptr = sourceAddr.Count - 1; - string[] splitedExp = expression.Split ('/'); - - if (splitedExp.Length < 2)//dataSource binding - return null; - - if (string.IsNullOrEmpty (splitedExp [0]) || splitedExp [0] == ".") {//search template root - ptr--; - while (ptr >= 0) { - if (typeof(TemplatedControl).IsAssignableFrom (sourceAddr [ptr].CrowType)) - break; - ptr--; - } - } else if (splitedExp [0] == "..") { //search starting at current node - int levelUp = splitedExp.Length - 1; - if (levelUp > ptr + 1) - throw new Exception ("Binding error: try to bind outside IML source"); - ptr -= levelUp; - } - expression = splitedExp [splitedExp.Length - 1]; - //TODO:change Template special address identified with Nodecount = 0 to something not using array count to 0, - //here linq is working without limits checking in compile option - //but defining a 0 capacity array with limits cheking enabled, cause 'out of memory' error - return new NodeAddress (sourceAddr.Take(ptr+1).ToArray());//[ptr+1]; - //Array.Copy (sourceAddr.ToArray (), targetNode, ptr + 1); - //return new NodeAddress (targetNode); - } - } } |