fix residual globals mapping

This commit is contained in:
Renaud Pawlak 2020-06-03 16:43:41 +02:00
parent f1a4036fa8
commit 1b4948e625
3 changed files with 9 additions and 1 deletions

View File

@ -1051,6 +1051,13 @@ public class JSweetContext extends Context {
globalsMapping.put(from, to); globalsMapping.put(from, to);
} }
/**
* Clear globals mappings.
*/
public void clearGlobalsMappings() {
globalsMapping.clear();;
}
/** /**
* Returns the TypeScript string for globals mapping. * Returns the TypeScript string for globals mapping.
*/ */

View File

@ -1052,6 +1052,7 @@ public class JSweetTranspiler implements JSweetOptions {
logger.info("created " + outputFilePath); logger.info("created " + outputFilePath);
} finally { } finally {
context.clearHeaders(); context.clearHeaders();
context.clearGlobalsMappings();
context.clearFooterStatements(); context.clearFooterStatements();
} }

View File

@ -5783,7 +5783,7 @@ public class Java2TypeScriptTranslator extends AbstractTreePrinter {
print(exprStr, expr); print(exprStr, expr);
if (checkFirstArrayElement) if (checkFirstArrayElement)
print("[0]"); print("[0]");
print(").length == " + context.getFunctionalTypeParameterCount(type)); print(").length === " + context.getFunctionalTypeParameterCount(type));
} }
} else { } else {
print(exprStr, expr); print(exprStr, expr);