Skip to content

Commit

Permalink
Merge pull request #121 from ConsenSys/file_remapping_nit
Browse files Browse the repository at this point in the history
File remapping nit
  • Loading branch information
blitz-1306 authored May 24, 2022
2 parents 1465af7 + 0a9d3df commit 0ac89ba
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 4 deletions.
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@
"build-type-parser": "tspegjs -o src/types/typeStrings/typeString_parser.ts --custom-header-file src/types/typeStrings/typeString_parser_header.ts --cache src/types/typeStrings/typeString_grammar.pegjs",
"build-file-level-definitions-parser": "tspegjs -o src/compile/inference/file_level_definitions_parser.ts --custom-header-file src/compile/inference/file_level_definitions_parser_header.ts --cache src/compile/inference/file_level_definitions.pegjs",
"build-parsers": "npm run build-type-parser && npm run build-file-level-definitions-parser",
"build": "npm run clean && npm run build-parsers && npm run transpile",
"build": "npm run clean && npm run build-parsers && npm run transpile && chmod u+x dist/bin/compile.js",
"lint": "eslint src/ test/ --ext=ts",
"lint:fix": "eslint src/ test/ --ext=ts --fix",
"test": "NODE_OPTIONS='--max-old-space-size=2048' nyc mocha",
Expand Down
8 changes: 5 additions & 3 deletions src/compile/utils.ts
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,8 @@ export interface CompileResult {
* Map from file-names appearing in the `files` map, to the
* actual resolved paths on disk (if any).
*
* For `compileJSONData()` this map is empty (since nothing was resolved on disk).
* For `compileJSONData()` this maps each unit absolutePath to itself as no resolution is done.
*
*/
resolvedFileNames: Map<string, string>;

Expand Down Expand Up @@ -364,6 +365,7 @@ export async function compileJsonData(
}

const sources: { [fileName: string]: any } = data.sources;
const resolvedFileNames = new Map<string, string>(Object.keys(sources).map((x) => [x, x]));

if (consistentlyContainsOneOf(sources, "ast", "legacyAST", "AST")) {
const compilerVersion = undefined;
Expand All @@ -379,7 +381,7 @@ export async function compileJsonData(
data,
compilerVersion,
files,
resolvedFileNames: new Map(),
resolvedFileNames,
inferredRemappings: new Map()
};
}
Expand Down Expand Up @@ -409,7 +411,7 @@ export async function compileJsonData(
data: compileData,
compilerVersion,
files,
resolvedFileNames: new Map(),
resolvedFileNames,
inferredRemappings: new Map()
};
}
Expand Down

0 comments on commit 0ac89ba

Please sign in to comment.