forked from ServiceStack/ServiceStack
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathJsStatement.cs
More file actions
89 lines (72 loc) · 3.4 KB
/
Copy pathJsStatement.cs
File metadata and controls
89 lines (72 loc) · 3.4 KB
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
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
using System;
using System.Collections.Generic;
namespace ServiceStack.Script
{
public abstract class JsStatement
{
}
public class JsFilterExpressionStatement : JsStatement
{
public PageVariableFragment FilterExpression { get; }
public JsFilterExpressionStatement(ReadOnlyMemory<char> originalText, JsToken expr, List<JsCallExpression> filters)
{
FilterExpression = new PageVariableFragment(originalText, expr, filters);
}
public JsFilterExpressionStatement(string originalText, JsToken expr, params JsCallExpression[] filters)
{
FilterExpression = new PageVariableFragment(originalText.AsMemory(), expr, new List<JsCallExpression>(filters));
}
protected bool Equals(JsFilterExpressionStatement other) => Equals(FilterExpression, other.FilterExpression);
public override bool Equals(object obj)
{
if (ReferenceEquals(null, obj)) return false;
if (ReferenceEquals(this, obj)) return true;
if (obj.GetType() != this.GetType()) return false;
return Equals((JsFilterExpressionStatement) obj);
}
public override int GetHashCode() => (FilterExpression != null ? FilterExpression.GetHashCode() : 0);
}
public class JsBlockStatement : JsStatement
{
public JsStatement[] Statements { get; }
public JsBlockStatement(JsStatement[] statements) => Statements = statements;
public JsBlockStatement(JsStatement statement) => Statements = new[]{ statement };
protected bool Equals(JsBlockStatement other) => Statements.EquivalentTo(other.Statements);
public override bool Equals(object obj)
{
if (ReferenceEquals(null, obj)) return false;
if (ReferenceEquals(this, obj)) return true;
if (obj.GetType() != this.GetType()) return false;
return Equals((JsBlockStatement) obj);
}
public override int GetHashCode() => (Statements != null ? Statements.GetHashCode() : 0);
}
public class JsExpressionStatement : JsStatement
{
public JsToken Expression { get; }
public JsExpressionStatement(JsToken expression) => Expression = expression;
protected bool Equals(JsExpressionStatement other) => Equals(Expression, other.Expression);
public override bool Equals(object obj)
{
if (ReferenceEquals(null, obj)) return false;
if (ReferenceEquals(this, obj)) return true;
if (obj.GetType() != this.GetType()) return false;
return Equals((JsExpressionStatement) obj);
}
public override int GetHashCode() => (Expression != null ? Expression.GetHashCode() : 0);
}
public class JsPageBlockFragmentStatement : JsStatement
{
public PageBlockFragment Block { get; }
public JsPageBlockFragmentStatement(PageBlockFragment block) => Block = block;
protected bool Equals(JsPageBlockFragmentStatement other) => Equals(Block, other.Block);
public override bool Equals(object obj)
{
if (ReferenceEquals(null, obj)) return false;
if (ReferenceEquals(this, obj)) return true;
if (obj.GetType() != this.GetType()) return false;
return Equals((JsPageBlockFragmentStatement) obj);
}
public override int GetHashCode() => (Block != null ? Block.GetHashCode() : 0);
}
}