public override void Visit(JsConditionalCompilationIf node) { if (node != null) { // increment the conditional comment level and then recurse the condition ++m_conditionalCommentLevel; base.Visit(node); } }
public void Visit(JsConditionalCompilationIf node) { // starts with a '@if', so we don't care }
private void DoConditionalCompilationIf(JsConditionalCompilationIf node) { if (m_parser.Settings.IsModificationAllowed(JsTreeModifications.EvaluateNumericExpressions)) { // if the if-condition is a constant, we can eliminate one of the two branches JsConstantWrapper constantCondition = node.Condition as JsConstantWrapper; if (constantCondition != null) { // instead, replace the condition with a 1 if it's always true or a 0 if it's always false if (constantCondition.IsNotOneOrPositiveZero) { try { node.Condition = new JsConstantWrapper(constantCondition.ToBoolean() ? 1 : 0, JsPrimitiveType.Number, node.Condition.Context, m_parser); } catch (InvalidCastException) { // ignore any invalid cast exceptions } } } } }
public override void Visit(JsConditionalCompilationIf node) { if (node != null) { // depth-first base.Visit(node); DoConditionalCompilationIf(node); } }
public void Visit(JsConditionalCompilationIf node) { // invalid! ignore IsValid = false; }
public void Visit(JsConditionalCompilationIf node) { // not applicable; terminate }
public void Visit(JsConditionalCompilationIf node) { // preprocessor nodes are handled outside the real JavaScript parsing }
public void Visit(JsConditionalCompilationIf node) { // nothing to do }
public void Visit(JsConditionalCompilationIf node) { if (node != null) { var symbol = StartSymbol(node); Output("@if("); MarkSegment(node, null, node.Context); SetContextOutputPosition(node.Context); m_startOfStatement = false; if (node.Condition != null) { node.Condition.Accept(this); } OutputPossibleLineBreak(')'); EndSymbol(symbol); } }