170b7156d4563022157732cecf076d76516ebd6f5cushon/* 270b7156d4563022157732cecf076d76516ebd6f5cushon * Copyright 2016 Google Inc. All Rights Reserved. 370b7156d4563022157732cecf076d76516ebd6f5cushon * 470b7156d4563022157732cecf076d76516ebd6f5cushon * Licensed under the Apache License, Version 2.0 (the "License"); 570b7156d4563022157732cecf076d76516ebd6f5cushon * you may not use this file except in compliance with the License. 670b7156d4563022157732cecf076d76516ebd6f5cushon * You may obtain a copy of the License at 770b7156d4563022157732cecf076d76516ebd6f5cushon * 870b7156d4563022157732cecf076d76516ebd6f5cushon * http://www.apache.org/licenses/LICENSE-2.0 970b7156d4563022157732cecf076d76516ebd6f5cushon * 1070b7156d4563022157732cecf076d76516ebd6f5cushon * Unless required by applicable law or agreed to in writing, software 1170b7156d4563022157732cecf076d76516ebd6f5cushon * distributed under the License is distributed on an "AS IS" BASIS, 1270b7156d4563022157732cecf076d76516ebd6f5cushon * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 1370b7156d4563022157732cecf076d76516ebd6f5cushon * See the License for the specific language governing permissions and 1470b7156d4563022157732cecf076d76516ebd6f5cushon * limitations under the License. 1570b7156d4563022157732cecf076d76516ebd6f5cushon */ 1670b7156d4563022157732cecf076d76516ebd6f5cushon 1770b7156d4563022157732cecf076d76516ebd6f5cushonpackage com.google.turbine.binder.bound; 1870b7156d4563022157732cecf076d76516ebd6f5cushon 1970b7156d4563022157732cecf076d76516ebd6f5cushonimport com.google.common.collect.ImmutableMap; 2070b7156d4563022157732cecf076d76516ebd6f5cushonimport com.google.turbine.binder.sym.ClassSymbol; 2170b7156d4563022157732cecf076d76516ebd6f5cushonimport com.google.turbine.model.TurbineTyKind; 2270b7156d4563022157732cecf076d76516ebd6f5cushonimport com.google.turbine.tree.Tree; 2370b7156d4563022157732cecf076d76516ebd6f5cushon 2470b7156d4563022157732cecf076d76516ebd6f5cushon/** A {@link BoundClass} that corresponds to a source file being compiled. */ 2570b7156d4563022157732cecf076d76516ebd6f5cushonpublic class SourceBoundClass implements BoundClass { 26e00231e80f0b3822babc5d34d2ac776c08bd235fcushon private final ClassSymbol sym; 2770b7156d4563022157732cecf076d76516ebd6f5cushon private final ClassSymbol owner; 2870b7156d4563022157732cecf076d76516ebd6f5cushon private final ImmutableMap<String, ClassSymbol> children; 292f66fb86c5de3e13b58b1a521ffc307c8cef1f50cushon private final int access; 30e00231e80f0b3822babc5d34d2ac776c08bd235fcushon private final Tree.TyDecl decl; 3170b7156d4563022157732cecf076d76516ebd6f5cushon 3270b7156d4563022157732cecf076d76516ebd6f5cushon public SourceBoundClass( 33e00231e80f0b3822babc5d34d2ac776c08bd235fcushon ClassSymbol sym, 3470b7156d4563022157732cecf076d76516ebd6f5cushon ClassSymbol owner, 352f66fb86c5de3e13b58b1a521ffc307c8cef1f50cushon ImmutableMap<String, ClassSymbol> children, 36e00231e80f0b3822babc5d34d2ac776c08bd235fcushon int access, 37e00231e80f0b3822babc5d34d2ac776c08bd235fcushon Tree.TyDecl decl) { 38e00231e80f0b3822babc5d34d2ac776c08bd235fcushon this.sym = sym; 3970b7156d4563022157732cecf076d76516ebd6f5cushon this.owner = owner; 4070b7156d4563022157732cecf076d76516ebd6f5cushon this.children = children; 412f66fb86c5de3e13b58b1a521ffc307c8cef1f50cushon this.access = access; 42e00231e80f0b3822babc5d34d2ac776c08bd235fcushon this.decl = decl; 4370b7156d4563022157732cecf076d76516ebd6f5cushon } 4470b7156d4563022157732cecf076d76516ebd6f5cushon 4570b7156d4563022157732cecf076d76516ebd6f5cushon public Tree.TyDecl decl() { 4670b7156d4563022157732cecf076d76516ebd6f5cushon return decl; 4770b7156d4563022157732cecf076d76516ebd6f5cushon } 4870b7156d4563022157732cecf076d76516ebd6f5cushon 4970b7156d4563022157732cecf076d76516ebd6f5cushon @Override 5070b7156d4563022157732cecf076d76516ebd6f5cushon public TurbineTyKind kind() { 51e00231e80f0b3822babc5d34d2ac776c08bd235fcushon return decl().tykind(); 5270b7156d4563022157732cecf076d76516ebd6f5cushon } 5370b7156d4563022157732cecf076d76516ebd6f5cushon 5470b7156d4563022157732cecf076d76516ebd6f5cushon @Override 5570b7156d4563022157732cecf076d76516ebd6f5cushon public ClassSymbol owner() { 5670b7156d4563022157732cecf076d76516ebd6f5cushon return owner; 5770b7156d4563022157732cecf076d76516ebd6f5cushon } 5870b7156d4563022157732cecf076d76516ebd6f5cushon 5970b7156d4563022157732cecf076d76516ebd6f5cushon @Override 602f66fb86c5de3e13b58b1a521ffc307c8cef1f50cushon public int access() { 612f66fb86c5de3e13b58b1a521ffc307c8cef1f50cushon return access; 622f66fb86c5de3e13b58b1a521ffc307c8cef1f50cushon } 632f66fb86c5de3e13b58b1a521ffc307c8cef1f50cushon 642f66fb86c5de3e13b58b1a521ffc307c8cef1f50cushon @Override 6570b7156d4563022157732cecf076d76516ebd6f5cushon public ImmutableMap<String, ClassSymbol> children() { 6670b7156d4563022157732cecf076d76516ebd6f5cushon return children; 6770b7156d4563022157732cecf076d76516ebd6f5cushon } 68e00231e80f0b3822babc5d34d2ac776c08bd235fcushon 69e00231e80f0b3822babc5d34d2ac776c08bd235fcushon public ClassSymbol sym() { 70e00231e80f0b3822babc5d34d2ac776c08bd235fcushon return sym; 71e00231e80f0b3822babc5d34d2ac776c08bd235fcushon } 7270b7156d4563022157732cecf076d76516ebd6f5cushon} 73