-
Notifications
You must be signed in to change notification settings - Fork 28
/
Copy pathFunctionDeclarationContext.cs
41 lines (31 loc) · 1.46 KB
/
FunctionDeclarationContext.cs
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
// ------------------------------------------------------------------------------
// <copyright file="FunctionDeclarationContext.cs" company="Drake53">
// Licensed under the MIT license.
// See the LICENSE file in the project root for more information.
// </copyright>
// ------------------------------------------------------------------------------
using System.Collections.Generic;
using System.Collections.Immutable;
using War3Net.CodeAnalysis.Jass.Syntax;
namespace War3Net.CodeAnalysis.Decompilers
{
internal sealed class FunctionDeclarationContext
{
public FunctionDeclarationContext(JassFunctionDeclarationSyntax functionDeclaration, IEnumerable<JassCommentSyntax> comments)
{
FunctionDeclaration = functionDeclaration;
Comments = comments.ToImmutableList();
if (functionDeclaration.FunctionDeclarator.ParameterList.Parameters.IsEmpty)
{
IsActionsFunction = functionDeclaration.FunctionDeclarator.ReturnType == JassTypeSyntax.Nothing;
IsConditionsFunction = functionDeclaration.FunctionDeclarator.ReturnType == JassTypeSyntax.Boolean;
}
Handled = false;
}
public JassFunctionDeclarationSyntax FunctionDeclaration { get; }
public ImmutableList<JassCommentSyntax> Comments { get; }
public bool IsActionsFunction { get; }
public bool IsConditionsFunction { get; }
public bool Handled { get; set; }
}
}