public virtual IAnalysisSet BinaryOperation(BinaryOperator node, AnalysisUnit unit, IAnalysisSet value) {
     return SelfSet.Union(value);
 }
        public override bool Walk(BinaryOperator node)
        {
            if (node.OperatorToken == JSToken.Assign) {
                if (node.Operand1 is Lookup) {
                    var declScope = _curUnit.Environment;
                    var prevScope = declScope.HasChildren ? declScope.Children.Last() : null;
                    StatementEnvironmentRecord prevStmtScope;
                    if ((prevStmtScope = prevScope as StatementEnvironmentRecord) != null) {
                        prevStmtScope.EndIndex = node.GetStartIndex(_tree.LocationResolver);
                    }

                    var nameExpr = node.Operand1 as Lookup;
                    PushDefiniteAssignmentEnvironmentRecord(node, nameExpr.Name);

                    _scope.AddVariable(nameExpr.Name, CreateVariableInDeclaredScope(nameExpr));
                } else {
                    UpdateChildRanges(node);
                }
            } else if (node.OperatorToken > JSToken.Assign && node.OperatorToken <= JSToken.LastAssign) {
                UpdateChildRanges(node);
            }
            return true;
        }
Пример #3
0
 public override bool Walk(BinaryOperator node) { AddNode(node); return true; }
 public virtual void AugmentAssign(BinaryOperator node, AnalysisUnit unit, IAnalysisSet value) {
 }
        public override bool Walk(BinaryOperator node)
        {
            if (node != null)
            {
                if (node.Operand1 != null)
                {
                    node.Operand1.Walk(this);
                }

                if (node.Operand2 != null)
                {
                    node.Operand2.Walk(this);
                }
            }
            return false;
        }
        /// <summary>
        /// Performs the specified operation on the value.
        /// </summary>
        public static IAnalysisSet BinaryOperation(this IAnalysisSet self, BinaryOperator node, AnalysisUnit unit, IAnalysisSet value) {
            var res = AnalysisSet.Empty;
            foreach (var ns in self) {
                res = res.Union(ns.Value.BinaryOperation(node, unit, value));
            }

            return res;
        }
 /// <summary>
 /// Performs an augmented assignment propagating the value into the
 /// object.
 /// </summary>
 public static void AugmentAssign(this IAnalysisSet self, BinaryOperator node, AnalysisUnit unit, IAnalysisSet value) {
     foreach (var ns in self) {
         ns.Value.AugmentAssign(node, unit, value);
     }
 }
Пример #8
0
 public override IAnalysisSet BinaryOperation(BinaryOperator node, AnalysisUnit unit, IAnalysisSet value) {
     if (node.OperatorToken == JSToken.Plus) {
         return _analyzer._emptyStringValue.SelfSet;
     }
     return base.BinaryOperation(node, unit, value);
 }
Пример #9
0
        public override bool Walk(BinaryOperator node) {
            node.Operand1.Walk(this);

            ReplaceFollowingWhiteSpace(
                node.Operand1.GetEndIndex(_tree.LocationResolver),
                _options.SpaceBeforeAndAfterBinaryOperator ? " " : null
            );

            ReplacePreceedingWhiteSpace(
                node.Operand2.GetStartIndex(_tree.LocationResolver),
                _options.SpaceBeforeAndAfterBinaryOperator ? " " : null,
                null,
                _newlines
            );

            node.Operand2.Walk(this);

            return false;
        }