diff --git a/cli/asc.js b/cli/asc.js index eba383f20c..d8f61b3674 100644 --- a/cli/asc.js +++ b/cli/asc.js @@ -644,7 +644,7 @@ exports.main = function main(argv, options, callback) { let sourcePath = String(filename).replace(/\\/g, "/").replace(extension.re, "").replace(/[\\/]$/, ""); // Setting the path to relative path - sourcePath = path.isAbsolute(sourcePath) ? path.relative(baseDir, sourcePath) : sourcePath; + sourcePath = path.isAbsolute(sourcePath) ? path.relative(baseDir, sourcePath).replace(/\\/g, "/") : sourcePath; // Try entryPath.ext, then entryPath/index.ext let sourceText = readFile(sourcePath + extension.ext, baseDir); diff --git a/tests/asconfig/entry-points/assembly/data.ts b/tests/asconfig/entry-points/assembly/data.ts new file mode 100644 index 0000000000..e036d95db7 --- /dev/null +++ b/tests/asconfig/entry-points/assembly/data.ts @@ -0,0 +1 @@ +export let forty_one = 41; diff --git a/tests/asconfig/entry-points/assembly/globalTwo.ts b/tests/asconfig/entry-points/assembly/globalTwo.ts new file mode 100644 index 0000000000..1257bb5b36 --- /dev/null +++ b/tests/asconfig/entry-points/assembly/globalTwo.ts @@ -0,0 +1,5 @@ +// @ts-ignore +@global + const ONE = 1; + +assert(ONE); diff --git a/tests/asconfig/entry-points/assembly/globals.ts b/tests/asconfig/entry-points/assembly/globals.ts index ef2ca6b2f9..f11182fb35 100644 --- a/tests/asconfig/entry-points/assembly/globals.ts +++ b/tests/asconfig/entry-points/assembly/globals.ts @@ -1,3 +1,7 @@ +import { forty_one } from "./data"; +import "./globalTwo"; + // @ts-ignore: decorator -@global const answerToLife = 42; -assert(answerToLife); +@global function answerToLife(): i32 { return forty_one + ONE; } + +assert(answerToLife()); diff --git a/tests/asconfig/entry-points/assembly/index.ts b/tests/asconfig/entry-points/assembly/index.ts index 8d57706af7..dce221e650 100644 --- a/tests/asconfig/entry-points/assembly/index.ts +++ b/tests/asconfig/entry-points/assembly/index.ts @@ -1,2 +1 @@ - -assert(answerToLife == 42); +assert(answerToLife() == 42); diff --git a/tests/asconfig/entry-points/nested/assembly/index.ts b/tests/asconfig/entry-points/nested/assembly/index.ts index 48b64eeb05..dce221e650 100644 --- a/tests/asconfig/entry-points/nested/assembly/index.ts +++ b/tests/asconfig/entry-points/nested/assembly/index.ts @@ -1 +1 @@ -assert(answerToLife == 42); +assert(answerToLife() == 42); diff --git a/tests/asconfig/entry-points/node-resolution/assembly/index.ts b/tests/asconfig/entry-points/node-resolution/assembly/index.ts index 48b64eeb05..dce221e650 100644 --- a/tests/asconfig/entry-points/node-resolution/assembly/index.ts +++ b/tests/asconfig/entry-points/node-resolution/assembly/index.ts @@ -1 +1 @@ -assert(answerToLife == 42); +assert(answerToLife() == 42); diff --git a/tests/asconfig/entry-points/node-resolution/node_modules/entry-points/asconfig.json b/tests/asconfig/entry-points/node-resolution/node_modules/entry-points/asconfig.json index f83851ac73..33954ea9fd 100644 --- a/tests/asconfig/entry-points/node-resolution/node_modules/entry-points/asconfig.json +++ b/tests/asconfig/entry-points/node-resolution/node_modules/entry-points/asconfig.json @@ -1,3 +1,3 @@ { - "entries": ["assembly/globals.ts"] + "extends": "../../../asconfig.json" } diff --git a/tests/asconfig/entry-points/node-resolution/node_modules/entry-points/assembly/globals.ts b/tests/asconfig/entry-points/node-resolution/node_modules/entry-points/assembly/globals.ts deleted file mode 100644 index ef2ca6b2f9..0000000000 --- a/tests/asconfig/entry-points/node-resolution/node_modules/entry-points/assembly/globals.ts +++ /dev/null @@ -1,3 +0,0 @@ -// @ts-ignore: decorator -@global const answerToLife = 42; -assert(answerToLife); diff --git a/tests/asconfig/entry-points/node-resolution/node_modules/entry-points/assembly/index.ts b/tests/asconfig/entry-points/node-resolution/node_modules/entry-points/assembly/index.ts deleted file mode 100644 index 8d57706af7..0000000000 --- a/tests/asconfig/entry-points/node-resolution/node_modules/entry-points/assembly/index.ts +++ /dev/null @@ -1,2 +0,0 @@ - -assert(answerToLife == 42);