public DeclareSyntaxElement(LexicalElement lexAtStart, string identifier, VariableStorage.FieldProperty property, ExpressionSyntaxElement initialValue)
     : base(lexAtStart)
 {
     this.Identifier   = identifier;
     this.InitialValue = initialValue;
     this.Property     = property;
 }
Esempio n. 2
0
        protected override MultiDeclareSyntaxElement ReturnDeclare(Selection <FixedList <LexicalElement, Optional <LexicalElement> >, LexicalElement> readonlyAnd_OptOfVar_OrVar, IdentifierSyntaxElement identifier, Optional <FixedList <LexicalElement, ExpressionSyntaxElement> > optOfEqualAndExpression, FixedList <LexicalElement, IdentifierSyntaxElement, Optional <FixedList <LexicalElement, ExpressionSyntaxElement> > >[] repeatOfCommaAndIdentifierAnd_OptOfEqualAndExpression)
        {
            LexicalElement head = new LexicalElement();

            VariableStorage.FieldProperty property = new VariableStorage.FieldProperty();
            if (readonlyAnd_OptOfVar_OrVar.Element1.HasValue)
            {
                head = readonlyAnd_OptOfVar_OrVar.Element1.Value.Element1;
                property.Readonly = true;
            }
            else
            {
                head = readonlyAnd_OptOfVar_OrVar.Element2.Value;
            }
            List <DeclareSyntaxElement> varList = new List <DeclareSyntaxElement>();

            if (optOfEqualAndExpression.HasValue)
            {
                DeclareSyntaxElement var1 = new DeclareSyntaxElement(identifier.LexAtStart, identifier.Identifier, property, optOfEqualAndExpression.Value.Element2);
                varList.Add(var1);
            }
            else
            {
                DeclareSyntaxElement var1 = new DeclareSyntaxElement(identifier.LexAtStart, identifier.Identifier, property);
                varList.Add(var1);
            }
            foreach (var declare in repeatOfCommaAndIdentifierAnd_OptOfEqualAndExpression)
            {
                DeclareSyntaxElement    var2;
                IdentifierSyntaxElement identifier2 = declare.Element2;
                if (declare.Element3.HasValue)
                {
                    ExpressionSyntaxElement expression2 = declare.Element3.Value.Element2;
                    var2 = new DeclareSyntaxElement(identifier2.LexAtStart, identifier2.Identifier, property, expression2);
                }
                else
                {
                    var2 = new DeclareSyntaxElement(identifier2.LexAtStart, identifier2.Identifier, property);
                }
                varList.Add(var2);
            }
            return(new MultiDeclareSyntaxElement(head, property, varList));
        }
 public MultiDeclareSyntaxElement(LexicalElement lexAtStart, VariableStorage.FieldProperty property, IList <DeclareSyntaxElement> declarations)
     : base(lexAtStart)
 {
     this.Declarations = declarations.ToArray();
     this.Property     = property;
 }
 public DeclareSyntaxElement(LexicalElement lexAtStart, string identifier, VariableStorage.FieldProperty property) : this(lexAtStart, identifier, property, null)
 {
 }