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 /** 010 * One independently loadable fragment of a {@link JsProgram}. 011 */ 012 public class JsProgramFragment extends SourceInfoAwareJsNode { 013 private final JsGlobalBlock globalBlock; 014 015 public JsProgramFragment() { 016 globalBlock = new JsGlobalBlock(); 017 } 018 019 public JsBlock getGlobalBlock() { 020 return globalBlock; 021 } 022 023 @Override 024 public void accept(JsVisitor v) { 025 v.visitProgramFragment(this); 026 } 027 028 @Override 029 public void acceptChildren(JsVisitor visitor) { 030 visitor.accept(globalBlock); 031 } 032 033 @Override 034 public void traverse(JsVisitorWithContext v, JsContext ctx) { 035 if (v.visit(this, ctx)) { 036 v.acceptStatement(globalBlock); 037 } 038 v.endVisit(this, ctx); 039 } 040 041 @NotNull 042 @Override 043 public JsProgramFragment deepCopy() { 044 throw new UnsupportedOperationException(); 045 } 046 }