function deriveConcreteClass(context, type, parameters, scope) {
    var templateNode = type.resolvedType.pointerTo ? type.resolvedType.pointerTo.symbol.node : type.resolvedType.symbol.node;
    var templateName = templateNode.stringValue;
    var typeName = templateNode.stringValue + ("<" + parameters[0].stringValue + ">");
    var rename = templateNode.stringValue + ("_" + parameters[0].stringValue);
    var symbol = scope.parent.findNested(typeName, scope_1.ScopeHint.NORMAL, scope_1.FindNested.NORMAL);
    if (symbol) {
        // resolve(context, type.firstChild.firstChild, scope.parent);
        var genericSymbol = scope.parent.findNested(type.firstChild.firstChild.stringValue, scope_1.ScopeHint.NORMAL, scope_1.FindNested.NORMAL);
        type.firstChild.firstChild.symbol = genericSymbol;
        if (genericSymbol.resolvedType.pointerTo) {
            type.firstChild.firstChild.resolvedType = genericSymbol.resolvedType.pointerType();
        }
        else {
            type.firstChild.firstChild.resolvedType = genericSymbol.resolvedType;
        }
        type.symbol = symbol;
        if (type.resolvedType.pointerTo) {
            type.resolvedType = symbol.resolvedType.pointerType();
        }
        else {
            type.resolvedType = symbol.resolvedType;
        }
        return;
    }
    var node = templateNode.clone();
    // node.parent = templateNode.parent;
    node.stringValue = typeName;
    cloneChildren(templateNode.firstChild.nextSibling, node, parameters, templateName, typeName);
    node.offset = null; //FIXME: we cannot take offset from class template node
    initialize(context, node, scope.parent, CheckMode.NORMAL);
    resolve(context, node, scope.parent);
    node.symbol.flags |= symbol_1.SYMBOL_FLAG_USED;
    node.constructorFunctionNode.symbol.flags |= symbol_1.SYMBOL_FLAG_USED;
    type.symbol = node.symbol;
    node.symbol.rename = rename;
    if (type.resolvedType.pointerTo) {
        type.resolvedType = node.symbol.resolvedType.pointerType();
    }
    else {
        type.resolvedType = node.symbol.resolvedType;
    }
    if (templateNode.parent) {
        templateNode.replaceWith(node);
    }
    else {
        var prevNode = templateNode.derivedNodes[templateNode.derivedNodes.length - 1];
        prevNode.parent.insertChildAfter(prevNode, node);
    }
    if (templateNode.derivedNodes === undefined) {
        templateNode.derivedNodes = [];
    }
    templateNode.derivedNodes.push(node);
    //Leave the parameter for the emitter to identify the type
    type.firstChild.firstChild.kind = node_1.NodeKind.NAME;
    resolve(context, type.firstChild.firstChild, scope.parent);
    type.stringValue = node.symbol.name;
    return;
}
Derive a concrete class from class template type
@param context
@param type
@param parameters
@param scope
@returns {Symbol}