/// <summary> /// Injects to the node statements a function declaration for 'withQualifier' /// </summary> /// <remarks> /// The created function has the following shape: /// /// <code> /// @@public /// export declare function withQualifier(newQualifier: typeof qualifier) : typeof namespaceName; /// </code> /// /// All nodes are created with the module block starting position and with a length of 1. They are also all flagged with /// NodeFlags.ScriptInjectedNode. This is in order to avoid the checker to think that the node is missing. /// /// The identifier count and node count that the parser mantains is not updated! But nobody is consuming that information so far. /// /// Note that a source file should be passed explicitely, because <see cref="NodeStructureExtensions.GetSourceFile"/> will return null /// when the file get's parsed but not bound (and this is exactly the case for this function: it is called during parsing phase when the <see cref="INode.Parent"/> is still null). /// </remarks> public static void AddWithQualifierFunction(this IModuleBlock node, IIdentifier namespaceName, ISourceFile sourceFile) { Contract.Requires(node != null); Contract.Requires(namespaceName != null); Contract.Requires(sourceFile != null); var withQualifier = CreateWithQualifierFunction(namespaceName, node.Pos, sourceFile); node.Statements.Add(withQualifier); }
public static void AddWithQualifierFunction(this IModuleBlock node, IIdentifier namespaceName) { throw new NotSupportedException("Please use AddWithQualifierFunction that takes a source file."); }