001    // Copyright (c) 2011, the Dart project authors.  Please see the AUTHORS file
002    // for details. All rights reserved. Use of this source code is governed by a
003    // BSD-style license that can be found in the LICENSE file.
004    
005    package com.google.dart.compiler.backend.js.ast;
006    
007    import com.google.dart.compiler.util.AstUtil;
008    import org.jetbrains.annotations.NotNull;
009    
010    public final class JsPrefixOperation extends JsUnaryOperation {
011        public JsPrefixOperation(JsUnaryOperator op) {
012            this(op, null);
013        }
014    
015        public JsPrefixOperation(JsUnaryOperator op, JsExpression arg) {
016            super(op, arg);
017        }
018    
019        @Override
020        public void accept(JsVisitor v) {
021            v.visitPrefixOperation(this);
022        }
023    
024        @Override
025        public void traverse(JsVisitorWithContext v, JsContext ctx) {
026            if (v.visit(this, ctx)) {
027                super.traverse(v, ctx);
028            }
029            v.endVisit(this, ctx);
030        }
031    
032        @NotNull
033        @Override
034        public JsPrefixOperation deepCopy() {
035            return new JsPrefixOperation(getOperator(), AstUtil.deepCopy(getArg())).withMetadataFrom(this);
036        }
037    }