예제 #1
0
        /// <summary>
        /// Adds the body of another FluentMethodBuilder inside this one.
        /// </summary>
        public TThis Inline(FluentMethodBuilder action)
        {
            _CheckModifiable();
            action._CheckThread();

            if (action._parameters.Count > 0)
            {
                throw new ArgumentException("An action method should not have any parameters.", "actionMethod");
            }

            action._modifiable = false;

            foreach (var pair in action._locals)
            {
                if (!_method._locals.ContainsKey(pair.Key))
                {
                    _method._locals.Add(pair.Key, pair.Value);
                }
            }

            foreach (var pair in action._sharedVariables)
            {
                if (!_method._sharedVariables.Contains(pair))
                {
                    _method._sharedVariables.Add(pair);
                }
            }

            _statements.Add(action.Body);
            return(_this);
        }
예제 #2
0
 private void _CheckThread()
 {
     _method._CheckThread();
 }