private AST createFromNodeName(string nodeTypeName) { AST newNode = null; ASTNodeCreator creator = (ASTNodeCreator)typename2creator_[nodeTypeName]; if (creator != null) { newNode = creator.Create(); if (newNode == null) { throw new ArgumentException("Unable to create AST Node Type: '" + nodeTypeName + "'"); } } else { newNode = createFromNodeTypeObject(loadNodeTypeObject(nodeTypeName)); } return(newNode); }
private AST createFromAST(AST node) { AST newNode = null; Type nodeAsTypeObj = node.GetType(); ASTNodeCreator creator = (ASTNodeCreator)typename2creator_[nodeAsTypeObj.FullName]; if (creator != null) { newNode = creator.Create(); if (newNode == null) { throw new ArgumentException("Unable to create AST Node Type: '" + nodeAsTypeObj.FullName + "'"); } } else { newNode = createFromNodeTypeObject(nodeAsTypeObj); } return(newNode); }