Skip to content
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -227,7 +227,14 @@ public Edits rascalRenameSymbol(loc cursorLoc, list[Tree] cursor, str newName, s
ms = rascalTModelForNames([mname], ccfg, dummy_compile1);

<found, tm, ms> = getTModelForModule(mname, ms);
if (!found) throw "No TModel for module \'<mname>\'";
if (!found) {
if (ms.status[mname]?) {
// If a module is annotated with `@ignoreCompiler`, silently skip it
if (MStatus::ignored() in ms.status[mname]) return tmodel();
throw "No TModel for module \'<mname>\'";
}
throw "No TModel for module \'<mname>\'";
}
return tm;
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -77,3 +77,10 @@ test bool incrementalTypeCheck() {
remove(procLoc);
return res;
}

test bool ignoredModule() = testRenameOccurrences({
byText("Ignored", "
'import Main;
'int quz() = foo();", {}, annotations = "@ignoreCompiler{For test purposes.}"),
byText("Main", "int foo() = 8;", {0})
});
Original file line number Diff line number Diff line change
Expand Up @@ -57,7 +57,7 @@ import util::Util;


//// Fixtures and utility functions
data TestModule = byText(str name, str body, set[int] nameOccs, str newName = name, set[int] skipCursors = {})
data TestModule = byText(str name, str body, set[int] nameOccs, str newName = name, set[int] skipCursors = {}, str annotations = "")
| byLoc(str name, loc file, set[int] nameOccs, str newName = name, set[int] skipCursors = {});

data RenameException
Expand Down Expand Up @@ -134,7 +134,7 @@ bool testRenameOccurrences(set[TestModule] modules, str oldName = "foo", str new
}

pcfg = getTestPathConfig(testDir);
modulesByLocation = {mByLoc | m <- modules, mByLoc := (m is byLoc ? m : byLoc(m.name, storeTestModule(testDir, m.name, m.body), m.nameOccs, newName = m.newName, skipCursors = m.skipCursors))};
modulesByLocation = {mByLoc | m <- modules, mByLoc := (m is byLoc ? m : byLoc(m.name, storeTestModule(testDir, m.name, m.body, annotations = m.annotations), m.nameOccs, newName = m.newName, skipCursors = m.skipCursors))};

for (m <- modulesByLocation) {
try {
Expand Down Expand Up @@ -391,9 +391,9 @@ private tuple[loc, list[Tree]] findCursor(loc f, str id, int occ) {
return <cl, computeFocusList(m, cl.begin.line, cl.begin.column + 1)>;
}

private loc storeTestModule(loc dir, str name, str body) {
private loc storeTestModule(loc dir, str name, str body, str annotations = "") {
str moduleStr = "
'module <name>
'<annotations> module <name>
'<body>
";

Expand Down
Loading