Skip to content

Commit 3500740

Browse files
committed
parsers/source: Fix local interface support, write tests
1 parent 18ead01 commit 3500740

File tree

3 files changed

+8
-4
lines changed

3 files changed

+8
-4
lines changed

fusion/core/parsers/source.lua

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -135,6 +135,7 @@ handlers['interface'] = function(self, node)
135135
names[i] = {name = v, {type = "boolean", true}}
136136
end
137137
return self:transform({type="assignment";
138+
is_local = node.is_local;
138139
variable_list = {node.name};
139140
expression_list = {{
140141
type = "table";

spec/in/class.fuse

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -45,7 +45,9 @@ class ExampleThree extends ExampleToo {
4545

4646
-- interface
4747

48-
interface IScope {
48+
interface X {}
49+
50+
local interface IScope {
4951
close;
5052
}
5153

@@ -63,7 +65,7 @@ class IO implements IScope {
6365

6466
-- extension of implemented interface, inherits close()
6567

66-
class File extends IO implements IScope {
68+
local class File extends IO implements IScope {
6769
__new(...)=>
6870
@file = io.open(...);
6971
}

spec/out/source/class.lua

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -40,7 +40,8 @@ ExampleThree = class({
4040
ExampleToo.__init(self,a,b)
4141
end);
4242
}, {extends = ExampleToo}, "ExampleThree")
43-
IScope = {
43+
X = {}
44+
local IScope = {
4445
close = true;
4546
}
4647
IO = class({
@@ -53,7 +54,7 @@ IO = class({
5354
self.file:close()
5455
end);
5556
}, {implements = IScope}, "IO")
56-
File = class({
57+
local File = class({
5758
__new = (function(self, ...)
5859
self.file = io.open(...)
5960
end);

0 commit comments

Comments
 (0)