@Test public void testClone() throws Exception { final File vert = temporaryFolder.newFile("a.vert"); FileUtils.writeStringToFile(vert, "void main() { }", StandardCharsets.UTF_8); final TranslationUnit vertTu = ParseHelper.parse(vert); assertEquals(ShaderKind.VERTEX, vertTu.getShaderKind()); assertEquals(ShaderKind.VERTEX, vertTu.clone().getShaderKind()); }
@Override public TranslationUnit clone() { return new TranslationUnit(shaderKind, shadingLanguageVersion, topLevelDeclarations.stream().map(x -> x.clone()).collect(Collectors.toList())); }
TranslationUnit implements IAstNode { @Override public TranslationUnit clone() { return new TranslationUnit(shaderKind, shadingLanguageVersion, topLevelDeclarations.stream().map(x -> x.clone()).collect(Collectors.toList())); } }
TranslationUnit implements IAstNode { @Override public TranslationUnit clone() { return new TranslationUnit(shaderKind, shadingLanguageVersion, topLevelDeclarations.stream().map(x -> x.clone()).collect(Collectors.toList())); } TranslationUnit(ShaderKind shaderKind,
                         Optional<ShadingLanguageVersion> shadingLanguageVersion,
                         List<Declaration> topLevelDeclarations);  TranslationUnit(Optional<ShadingLanguageVersion> shadingLanguageVersion,
                         List<Declaration> topLevelDeclarations); }
TranslationUnit implements IAstNode { @Override public TranslationUnit clone() { return new TranslationUnit(shaderKind, shadingLanguageVersion, topLevelDeclarations.stream().map(x -> x.clone()).collect(Collectors.toList())); } TranslationUnit(ShaderKind shaderKind,
                         Optional<ShadingLanguageVersion> shadingLanguageVersion,
                         List<Declaration> topLevelDeclarations);  TranslationUnit(Optional<ShadingLanguageVersion> shadingLanguageVersion,
                         List<Declaration> topLevelDeclarations); boolean hasMainFunction(); FunctionDefinition getMainFunction(); ShaderKind getShaderKind(); void setShaderKind(ShaderKind shaderKind); List<Declaration> getTopLevelDeclarations(); boolean hasShadingLanguageVersion(); ShadingLanguageVersion getShadingLanguageVersion(); void setShadingLanguageVersion(ShadingLanguageVersion shadingLanguageVersion); void setTopLevelDeclarations(List<Declaration> topLevelDeclarations); @Override void accept(IAstVisitor visitor); void addDeclaration(Declaration decl); void addDeclarationBefore(Declaration newDecl, Declaration existingDecl); void updateTopLevelDeclaration(Declaration newDecl, Declaration existingDecl); void removeTopLevelDeclaration(int index); void removeTopLevelDeclaration(Declaration declaration); @Override TranslationUnit clone(); List<VariableDeclInfo> getGlobalVarDeclInfos(); List<VariablesDeclaration> getGlobalVariablesDeclarations(); List<VariablesDeclaration> getUniformDecls(); VariablesDeclaration getUniformDeclaration(String name); boolean hasUniformDeclaration(String name); List<StructDefinitionType> getStructDefinitions(); StructDefinitionType getStructDefinition(StructNameType type); }
TranslationUnit implements IAstNode { @Override public TranslationUnit clone() { return new TranslationUnit(shaderKind, shadingLanguageVersion, topLevelDeclarations.stream().map(x -> x.clone()).collect(Collectors.toList())); } TranslationUnit(ShaderKind shaderKind,
                         Optional<ShadingLanguageVersion> shadingLanguageVersion,
                         List<Declaration> topLevelDeclarations);  TranslationUnit(Optional<ShadingLanguageVersion> shadingLanguageVersion,
                         List<Declaration> topLevelDeclarations); boolean hasMainFunction(); FunctionDefinition getMainFunction(); ShaderKind getShaderKind(); void setShaderKind(ShaderKind shaderKind); List<Declaration> getTopLevelDeclarations(); boolean hasShadingLanguageVersion(); ShadingLanguageVersion getShadingLanguageVersion(); void setShadingLanguageVersion(ShadingLanguageVersion shadingLanguageVersion); void setTopLevelDeclarations(List<Declaration> topLevelDeclarations); @Override void accept(IAstVisitor visitor); void addDeclaration(Declaration decl); void addDeclarationBefore(Declaration newDecl, Declaration existingDecl); void updateTopLevelDeclaration(Declaration newDecl, Declaration existingDecl); void removeTopLevelDeclaration(int index); void removeTopLevelDeclaration(Declaration declaration); @Override TranslationUnit clone(); List<VariableDeclInfo> getGlobalVarDeclInfos(); List<VariablesDeclaration> getGlobalVariablesDeclarations(); List<VariablesDeclaration> getUniformDecls(); VariablesDeclaration getUniformDeclaration(String name); boolean hasUniformDeclaration(String name); List<StructDefinitionType> getStructDefinitions(); StructDefinitionType getStructDefinition(StructNameType type);  }