@@ -96,37 +96,34 @@ private class ConsPath extends Path, TConsPath {
9696private string pathRegex ( ) { result = "(.*)(?:/|^)(([^/]*?)(\\.([^.]*))?)" }
9797
9898/**
99- * A string value that represents a (relative or absolute) file system path.
100- *
101- * Each path string is associated with one or more root folders relative to
102- * which the path may be resolved. For instance, paths inside a module are
103- * usually resolved relative to the module's folder, with a default
104- * lookup path as the fallback.
99+ * Providers helper predicates for extracting parts of a path string.
105100 */
106- abstract class PathString extends string {
101+ class StringAsPath extends string {
107102 bindingset [ this ]
108- PathString ( ) { any ( ) }
109-
110- /** Gets a root folder relative to which this path can be resolved. */
111- abstract Folder getARootFolder ( ) ;
103+ StringAsPath ( ) { any ( ) }
112104
113105 /** Gets the `i`th component of this path. */
106+ bindingset [ this ]
114107 string getComponent ( int i ) { result = this .splitAt ( "/" , i ) }
115108
116109 /** Gets the number of components of this path. */
110+ bindingset [ this ]
117111 int getNumComponent ( ) { result = count ( int i | exists ( this .getComponent ( i ) ) ) }
118112
119113 /** Gets the base name of the folder or file this path refers to. */
114+ bindingset [ this ]
120115 string getBaseName ( ) { result = this .regexpCapture ( pathRegex ( ) , 2 ) }
121116
122117 /**
123118 * Gets stem of the folder or file this path refers to, that is, the prefix of its base name
124119 * up to (but not including) the last dot character if there is one, or the entire
125120 * base name if there is not
126121 */
122+ bindingset [ this ]
127123 string getStem ( ) { result = this .regexpCapture ( pathRegex ( ) , 3 ) }
128124
129125 /** Gets the path of the parent folder of the folder or file this path refers to. */
126+ bindingset [ this ]
130127 string getDirName ( ) { result = this .regexpCapture ( pathRegex ( ) , 1 ) }
131128
132129 /**
@@ -135,8 +132,26 @@ abstract class PathString extends string {
135132 *
136133 * Has no result if the base name does not contain a dot.
137134 */
135+ bindingset [ this ]
138136 string getExtension ( ) { result = this .regexpCapture ( pathRegex ( ) , 4 ) }
139137
138+ }
139+
140+ /**
141+ * A string value that represents a (relative or absolute) file system path.
142+ *
143+ * Each path string is associated with one or more root folders relative to
144+ * which the path may be resolved. For instance, paths inside a module are
145+ * usually resolved relative to the module's folder, with a default
146+ * lookup path as the fallback.
147+ */
148+ abstract class PathString extends StringAsPath {
149+ bindingset [ this ]
150+ PathString ( ) { any ( ) }
151+
152+ /** Gets a root folder relative to which this path can be resolved. */
153+ abstract Folder getARootFolder ( ) ;
154+
140155 /**
141156 * Gets the absolute path that the sub-path consisting of the first `n`
142157 * components of this path refers to when resolved relative to the
0 commit comments