private void addNestedName(SNode declaration, SNode nref, String name) { for (SNode ref : SLinkOperations.getTargets(nref, "role", true)) { if (eq_ixz87t_a0a0a0m9( SPropertyOperations.getString( SLinkOperations.getTarget(ref, "declaration", false), "name"), name)) { return; } } if (eq_ixz87t_a0c0m9( SPropertyOperations.getString( SLinkOperations.getTarget(nref, "declaration", false), "name"), name)) { ListSequence.fromList(SLinkOperations.getTargets(nref, "role", true)) .addElement( Generator.GENERATOR.createDeclarationReference( SNodeOperations.cast( SLinkOperations.getTarget(nref, "declaration", false), "jetbrains.mps.build.generictasks.structure.BuiltInTaskDeclaration"))); return; } SNode parentDeclaration = SNodeOperations.cast( SLinkOperations.getTarget(nref, "declaration", false), "jetbrains.mps.build.generictasks.structure.BuiltInTaskDeclaration"); SNode parentRef = Generator.GENERATOR.createDeclarationReference(parentDeclaration); SNode fake; if (SNodeOperations.isInstanceOf( parentDeclaration, "jetbrains.mps.build.generictasks.structure.TaskInterfaceDeclaration")) { fake = Generator.GENERATOR.createInterfaceDeclaration( name, SPropertyOperations.getString(parentDeclaration, "classname"), SPropertyOperations.getBoolean(parentDeclaration, "depracated")); ListSequence.fromList(SLinkOperations.getTargets(fake, "interfaces", true)) .addElement(parentRef); } else { fake = Generator.GENERATOR.createDeclaration( name, SPropertyOperations.getString(parentDeclaration, "classname"), SPropertyOperations.getBoolean(parentDeclaration, "abstract"), SPropertyOperations.getBoolean(parentDeclaration, "canHaveInternalText"), SPropertyOperations.getBoolean(parentDeclaration, "depracated")); SLinkOperations.setTarget(fake, "parentRef", parentRef, true); } SPropertyOperations.set(fake, "fake", "" + (true)); ListSequence.fromList(SLinkOperations.getTargets(nref, "role", true)) .addElement(Generator.GENERATOR.createDeclarationReference(fake)); ListSequence.fromList(SLinkOperations.getTargets(declaration, "fakeDeclaration", true)) .addElement(fake); }
@Override public SNode createDeclaration(ClassInfo ci) { String classname = ci.getDeclarationClass().getName(); String name = this.myNamesMap.getNameForClass(ci.getDeclarationClass()); if (ci.isInterface()) { SNode decl = Generator.GENERATOR.createInterfaceDeclaration(name, classname, ci.isDeprecated()); myModel.addRootNode(decl); return decl; } SNode decl = Generator.GENERATOR.createDeclaration( name, classname, ci.isAbstract(), ci.canHaveInternalText(), ci.isDeprecated()); myModel.addRootNode(decl); return decl; }
private void createAttribute(SNode decl, ClassInfo.MyAttribute att) { SNode attrDecl = Generator.GENERATOR.createAttributeDeclaration( att.getName(), Generator.Builder.getType(att.getType())); SPropertyOperations.set(attrDecl, "deprecated", "" + (att.isDeprecated())); this.addEnum(attrDecl, att.getEnumValues()); ListSequence.fromList(SLinkOperations.getTargets(decl, "attributesDecl", true)) .addElement(attrDecl); }
@Override public void addInterface(SNode declaration, SNode interfaceDeclaration) { for (SNode in : SLinkOperations.getTargets(declaration, "interfaces", true)) { if (eq_ixz87t_a0a0a0f9( SPropertyOperations.getString( SLinkOperations.getTarget(in, "declaration", false), "name"), SPropertyOperations.getString(interfaceDeclaration, "name"))) { return; } } SNode ref = Generator.GENERATOR.createDeclarationReference(interfaceDeclaration); ListSequence.fromList(SLinkOperations.getTargets(declaration, "interfaces", true)) .addElement(ref); }
@Override public void addParent(SNode declaration, SNode parent) { SLinkOperations.setTarget( declaration, "parentRef", Generator.GENERATOR.createDeclarationReference(parent), true); }