Skip to content

Commit 5011a82

Browse files
committed
fixed: [ ] was calling vector instead of list.
1 parent 9a38c8b commit 5011a82

File tree

3 files changed

+7
-5
lines changed

3 files changed

+7
-5
lines changed

charon-runtime.lua

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -288,9 +288,9 @@ local Table = {
288288
__tostring = function(self)
289289
local paired = '';
290290
for k, v in pairs(self) do
291-
paired = paired .. tostring(k) .. ' ' .. tostring(v) .. ', ';
291+
paired = paired .. tostring(k) .. ' ' .. tostring(v) .. ' ';
292292
end
293-
return '{ ' .. paired .. ' }';
293+
return '{ ' .. paired .. '}';
294294
end,
295295
__concat = strcat
296296
}
@@ -387,6 +387,8 @@ function charon.object_new(proto)
387387
end
388388

389389
function charon.object_get(object, key)
390+
assert(object ~= nil, "Cannot get '" .. tostring(key) .. "' from nothing!");
391+
assert(object ~= charon.Unit, "Cannot get '" .. tostring(key) .. "' from unit!");
390392
local field = object[key];
391393
if field == nil then return charon.Unit; end
392394
return field;

package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "charon",
3-
"version": "0.8.0",
3+
"version": "0.8.1",
44
"preview": true,
55
"description": "Charon language compiler",
66
"main": "dist/index.js",

src/Compiler.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -220,7 +220,7 @@ Please do not hesitate to provide additional steps for reproduction.
220220
case '#let':
221221
return this.genLet(invoke);
222222
case '#three-dots':
223-
return `charon.vector{...}`;
223+
return `charon.list{...}`;
224224
case '#if': {
225225
const condition = this.genTerm(args[0]);
226226
const then = this.genTerm(args[1]);
@@ -698,7 +698,7 @@ Please do not hesitate to provide additional steps for reproduction.
698698
}
699699

700700
private genVector(vector: ast.Vector): string {
701-
return `charon.vector{ ${vector.list.map(this.genTerm.bind(this)).join()} }`
701+
return `charon.list{ ${vector.list.map(this.genTerm.bind(this)).join()} }`
702702
}
703703

704704
private genSymbol(symbol: ast.SYMBOL): string {

0 commit comments

Comments
 (0)