Inheritance: Expression
        public SimpleAssignmentExpression(LeftValue/*!*/ left, Expression/*!*/ right, string operation, SourceSpan location)
            : base(operation, location) {
            Assert.NotNull(left, right);

            _left = left;
            _right = right;
        }
Exemple #2
0
 public CompoundLeftValue(LeftValue/*!*/[]/*!*/ leftValues, int unsplattedValueIndex) 
     : base(SourceSpan.None) {
     Assert.NotNullItems(leftValues);
     Debug.Assert(unsplattedValueIndex >= 0 && unsplattedValueIndex <= leftValues.Length);
     _leftValues = leftValues;
     _unsplattedValueIndex = unsplattedValueIndex;
 }
Exemple #3
0
 public RescueClause(Expression/*!*/ type, LeftValue target, List<Expression> statements, SourceSpan location)
     : base(location) {
     Assert.NotNull(type);
     _types = CollectionUtils.MakeList(type);
     _target = target;
     _statements = statements;
 }
Exemple #4
0
 public RescueClause(CompoundRightValue type, LeftValue target, Statements statements, SourceSpan location)
     : base(location) {
     _types = type.RightValues;
     _splatType = type.SplattedValue;
     _target = target;
     _statements = statements;
 }
Exemple #5
0
 public RescueClause(LeftValue target, List <Expression> statements, SourceSpan location)
     : base(location)
 {
     _target     = target;
     _types      = Expression.EmptyList;
     _statements = statements;
 }
Exemple #6
0
 public RescueClause(Expression/*!*/ type, LeftValue target, Statements statements, SourceSpan location)
     : base(location) {
     Assert.NotNull(type);
     _types = new Expression[] { type };
     _target = target;
     _statements = statements;
 }
        public CompoundLeftValue(List<LeftValue>/*!*/ leftValues, LeftValue unsplattedValue, SourceSpan location)
            : base(location) {
            Assert.NotNull(leftValues);

            _leftValues = leftValues;
            _unsplattedValue = unsplattedValue;
        }
        public SimpleAssignmentExpression(LeftValue /*!*/ left, Expression /*!*/ right, string operation, SourceSpan location)
            : base(operation, location)
        {
            Assert.NotNull(left, right);

            _left  = left;
            _right = right;
        }
Exemple #9
0
        private readonly Expression[] _types; // might be empty, might include SplattedArgument expressions

        #endregion Fields

        #region Constructors

        public RescueClause(Expression/*!*/[]/*!*/ types, LeftValue target, Statements statements, SourceSpan location)
            : base(location)
        {
            Assert.NotNullItems(types);
            _types = types;
            _target = target;
            _statements = statements;
        }
Exemple #10
0
 public RescueClause(Expression /*!*/ type, LeftValue target, List <Expression> statements, SourceSpan location)
     : base(location)
 {
     Assert.NotNull(type);
     _types      = CollectionUtils.MakeList(type);
     _target     = target;
     _statements = statements;
 }
Exemple #11
0
 public RescueClause(CompoundRightValue type, LeftValue target, List <Expression> statements, SourceSpan location)
     : base(location)
 {
     _types      = type.RightValues;
     _splatType  = type.SplattedValue;
     _target     = target;
     _statements = statements;
 }
Exemple #12
0
 public RescueClause(Expression /*!*/ type, LeftValue target, Statements statements, SourceSpan location)
     : base(location)
 {
     Assert.NotNull(type);
     _types      = new Expression[] { type };
     _target     = target;
     _statements = statements;
 }
        public CompoundLeftValue(List <LeftValue> /*!*/ leftValues, LeftValue unsplattedValue, SourceSpan location)
            : base(location)
        {
            Assert.NotNull(leftValues);

            _leftValues      = leftValues;
            _unsplattedValue = unsplattedValue;
        }
Exemple #14
0
 public RescueClause(Expression /*!*/[] /*!*/ types, LeftValue target, Statements statements, SourceSpan location)
     : base(location)
 {
     Assert.NotNullItems(types);
     _types      = types;
     _target     = target;
     _statements = statements;
 }
Exemple #15
0
        public Parameters(LeftValue /*!*/[] mandatory, int leadingMandatoryCount, SimpleAssignmentExpression /*!*/[] optional, LeftValue unsplat, LocalVariable block, SourceSpan location)
            : base(location)
        {
            mandatory = mandatory ?? LeftValue.EmptyArray;
            optional  = optional ?? SimpleAssignmentExpression.EmptyArray;

            Debug.Assert(leadingMandatoryCount >= 0 && leadingMandatoryCount <= mandatory.Length);
            Debug.Assert(leadingMandatoryCount == mandatory.Length || optional != null || unsplat != null);

            _mandatory             = mandatory;
            _leadingMandatoryCount = leadingMandatoryCount;
            _optional = optional;
            _unsplat  = unsplat;
            _block    = block;
        }
Exemple #16
0
        public Parameters(LeftValue/*!*/[] mandatory, int leadingMandatoryCount, SimpleAssignmentExpression/*!*/[] optional, LeftValue unsplat, LocalVariable block, SourceSpan location)
            : base(location) {

            mandatory = mandatory ?? LeftValue.EmptyArray;
            optional = optional ?? SimpleAssignmentExpression.EmptyArray;

            Debug.Assert(leadingMandatoryCount >= 0 && leadingMandatoryCount <= mandatory.Length);
            Debug.Assert(leadingMandatoryCount == mandatory.Length || optional != null || unsplat != null);

            _mandatory = mandatory;
            _leadingMandatoryCount = leadingMandatoryCount;
            _optional = optional;
            _unsplat = unsplat;
            _block = block;
        }
Exemple #17
0
        internal static string assignmentVar(LeftValue lval, NodeParent parent)
        {
            if (lval is LocalVariable)
            {
                var method = parent.OfType<MethodDefinition>().ToArray();
                if (method.Length > 0 && method[0].Parameters != null
                    && method[0].Parameters.Mandatory.Where(p => p.ToString() == ((LocalVariable)lval).Name).Count() > 0)
                {
                    return "$" + Mangling.RubyIdentifierToPHP(((LocalVariable)lval).Name);
                }
                if (parent.OfType<ClassDefinition>().Count() == 0)
                {
                    return "$_locals->" + Mangling.RubyIdentifierToPHP(((LocalVariable)lval).Name);
                }
            }

            return ((Variable)lval).ToPHPVariable();
        }
Exemple #18
0
 public RescueClause(LeftValue target, Statements statements, SourceSpan location)
     : base(location) {
     _target = target;
     _types = Expression.EmptyArray;
     _statements = statements;
 }
Exemple #19
0
 public CompoundLeftValue(LeftValue/*!*/[]/*!*/ leftValues)
     : this(leftValues, leftValues.Length) {
 }