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 org.jetbrains.kotlin.js.backend.ast;
006
007 import org.jetbrains.kotlin.js.common.Symbol;
008 import org.jetbrains.annotations.NotNull;
009
010 /**
011 * A JavaScript parameter.
012 */
013 public final class JsParameter extends SourceInfoAwareJsNode implements HasName {
014 @NotNull
015 private JsName name;
016
017 public JsParameter(@NotNull JsName name) {
018 this.name = name;
019 }
020
021 @Override
022 @NotNull
023 public JsName getName() {
024 return name;
025 }
026
027 @Override
028 public void setName(@NotNull JsName name) {
029 this.name = name;
030 }
031
032 @Override
033 @NotNull
034 public Symbol getSymbol() {
035 return name;
036 }
037
038 @Override
039 public void accept(JsVisitor v) {
040 v.visitParameter(this);
041 }
042
043 @Override
044 public void traverse(JsVisitorWithContext v, JsContext ctx) {
045 v.visit(this, ctx);
046 v.endVisit(this, ctx);
047 }
048
049 @NotNull
050 @Override
051 public JsParameter deepCopy() {
052 return new JsParameter(name).withMetadataFrom(this);
053 }
054 }