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 org.jetbrains.annotations.NotNull; 008 009 public interface JsNode { 010 /** 011 * Causes this object to have the visitor visit itself and its children. 012 * 013 * @param visitor the visitor that should traverse this node 014 */ 015 void accept(JsVisitor visitor); 016 017 void acceptChildren(JsVisitor visitor); 018 019 /** 020 * Return the source info associated with this object. 021 */ 022 Object getSource(); 023 024 /** 025 * Set the source info associated with this object. 026 * 027 * @param info 028 */ 029 void setSource(Object info); 030 031 JsNode source(Object info); 032 033 @NotNull 034 JsNode deepCopy(); 035 036 /** 037 * Causes this object to have the visitor visit itself and its children. 038 * 039 * @param visitor the visitor that should traverse this node 040 * @param ctx the context of an existing traversal 041 */ 042 void traverse(JsVisitorWithContext visitor, JsContext ctx); 043 }