diff options
| author | Shlomo Hecht <shlomo@twine-s.com> | 2020-04-21 16:04:12 +0300 |
|---|---|---|
| committer | Shlomo Hecht <shlomo@twine-s.com> | 2020-04-21 16:04:12 +0300 |
| commit | 78430d37ac1dd07d5b5d731698da6761884d4cd5 (patch) | |
| tree | ac46b2870e21e3ddbc7a7d0732340a93e4e774e2 /Software/Visual_Studio/Scripting/Tango.Scripting | |
| parent | bd2e83f3d46414d756f59c2f70cc561718a3022e (diff) | |
| parent | 97a784b6ce43960bdb92465b08f26d3562a4f202 (diff) | |
| download | Tango-78430d37ac1dd07d5b5d731698da6761884d4cd5.tar.gz Tango-78430d37ac1dd07d5b5d731698da6761884d4cd5.zip | |
Merge branch 'master' of https://twinetfs.visualstudio.com/Tango/_git/Tango
Diffstat (limited to 'Software/Visual_Studio/Scripting/Tango.Scripting')
| -rw-r--r-- | Software/Visual_Studio/Scripting/Tango.Scripting/Parsing/ScriptParser.cs | 16 |
1 files changed, 15 insertions, 1 deletions
diff --git a/Software/Visual_Studio/Scripting/Tango.Scripting/Parsing/ScriptParser.cs b/Software/Visual_Studio/Scripting/Tango.Scripting/Parsing/ScriptParser.cs index 15760c950..7accdbb83 100644 --- a/Software/Visual_Studio/Scripting/Tango.Scripting/Parsing/ScriptParser.cs +++ b/Software/Visual_Studio/Scripting/Tango.Scripting/Parsing/ScriptParser.cs @@ -258,7 +258,21 @@ namespace Tango.Scripting.Parsing { SyntaxTree tree = CSharpSyntaxTree.ParseText(code); CompilationUnitSyntax root = tree.GetCompilationUnitRoot(); - return root.DescendantNodes().OfType<ObjectCreationExpressionSyntax>().FirstOrDefault(); + var creationSyntax = root.DescendantNodes().OfType<ObjectCreationExpressionSyntax>().FirstOrDefault(); + return creationSyntax; + } + + public MethodDeclarationSyntax GetCurrentConstructionExpressionAlt(String code) + { + if (code.Contains("=") && code.Contains("new")) + { + SyntaxTree tree = CSharpSyntaxTree.ParseText(code); + CompilationUnitSyntax root = tree.GetCompilationUnitRoot(); + var creationSyntax = root.DescendantNodes().OfType<MethodDeclarationSyntax>().FirstOrDefault(); + return creationSyntax; + } + + return null; } public T GetExpressionFirst<T>(String line) where T : CSharpSyntaxNode |
