コード例 #1
0
        /// <summary>
        ///     Adds an <see cref="ILSLReadOnlyCodeStatement" /> to the <see cref="LSLCodeSegment" /> object.
        /// </summary>
        /// <param name="statement">The <see cref="ILSLReadOnlyCodeStatement" /> to add.</param>
        /// <exception cref="ArgumentNullException"><paramref name="statement"/> is <c>null</c>.</exception>
        public virtual void AddStatement(ILSLReadOnlyCodeStatement statement)
        {
            if (statement == null)
            {
                throw new ArgumentNullException("statement");
            }

            EndNode = statement;
            if (StartNode == null)
            {
                StartNode = statement;

                if (statement.SourceRangesAvailable)
                {
                    SourceRange          = new LSLSourceCodeRange(statement);
                    SourceRangeAvailable = true;
                }
                else
                {
                    SourceRangeAvailable = false;
                }


                _statementNodes.Add(statement);
            }
            else
            {
                _statementNodes.Add(statement);

                if (SourceRangeAvailable)
                {
                    SourceRange = new LSLSourceCodeRange(SourceRange, EndNode.SourceRange);
                }
            }
        }
コード例 #2
0
        /// <summary>
        ///     Construct an <see cref="LSLConstantJumpDescription" /> from another <see cref="LSLConstantJumpDescription" /> and
        ///     an <see cref="ILSLReadOnlyCodeStatement" /> that represents the actual jump statement in the syntax tree. <para/>
        ///     <see cref="DeterminingJump"/> in the constructed object is set to <paramref name="originalJump"/>.DeterminingJump. <para/>
        ///     <see cref="EffectiveJumpStatement"/> in the constructed object is set to the <paramref name="effectiveJumpStatement"/> parameter.
        /// </summary>
        /// <param name="originalJump">The <see cref="LSLConstantJumpDescription"/> to copy the DeterminingJump property from.</param>
        /// <param name="effectiveJumpStatement">
        ///     The <see cref="ILSLReadOnlyCodeStatement" /> that represents the jump statement in
        ///     the syntax tree.
        /// </param>
        /// <exception cref="ArgumentNullException"><paramref name="originalJump"/> or <paramref name="effectiveJumpStatement"/> is <c>null</c>.</exception>
        public LSLConstantJumpDescription(LSLConstantJumpDescription originalJump,
                                          ILSLReadOnlyCodeStatement effectiveJumpStatement)
        {
            if (originalJump == null)
            {
                throw new ArgumentNullException("originalJump");
            }
            if (effectiveJumpStatement == null)
            {
                throw new ArgumentNullException("effectiveJumpStatement");
            }

            DeterminingJump        = originalJump.DeterminingJump;
            EffectiveJumpStatement = effectiveJumpStatement;
        }
コード例 #3
0
 /// <summary>
 ///     Constructs an <see cref="LSLConstantJumpDescription" /> from an ILSLJumpStatement node by
 ///     setting the DeterminingJump property of this object to the effectiveJumpStatement parameter, and
 ///     the EffectiveJumpStatement of this object to the effectiveJumpStatement parameter.
 /// </summary>
 /// <param name="effectiveJumpStatement">The <see cref="ILSLReadOnlyCodeStatement" /> to set EffectiveJumpStatement to.</param>
 /// <param name="determiningJump">The <see cref="ILSLJumpStatementNode" /> to set DeterminingJump to.</param>
 public LSLConstantJumpDescription(ILSLReadOnlyCodeStatement effectiveJumpStatement,
                                   ILSLJumpStatementNode determiningJump)
 {
     DeterminingJump        = determiningJump;
     EffectiveJumpStatement = effectiveJumpStatement;
 }