Skip to content

Commit 475dc9f

Browse files
Merge pull request livecode#1824 from runrevmark/feature-lcb_type_exports
[[ LCB ]] Ensure types are exported in the interface module.
2 parents c6cf993 + 6da284d commit 475dc9f

File tree

2 files changed

+25
-0
lines changed

2 files changed

+25
-0
lines changed

libscript/src/script-module.cpp

Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1135,8 +1135,27 @@ bool MCScriptWriteInterfaceOfModule(MCScriptModuleRef self, MCStreamRef stream)
11351135
switch(t_type -> kind)
11361136
{
11371137
case kMCScriptTypeKindForeign:
1138+
{
11381139
__writeln(stream, "foreign type %@", t_def_name);
1140+
}
1141+
break;
1142+
case kMCScriptTypeKindHandler:
1143+
{
1144+
MCAutoStringRef t_sig;
1145+
type_to_string(self, static_cast<MCScriptTypeDefinition *>(t_def) -> type, &t_sig);
1146+
__writeln(stream, "handler type %@%@", t_def_name, *t_sig);
1147+
}
1148+
break;
1149+
case kMCScriptTypeKindRecord:
1150+
// TODO - Records not yet supported
11391151
break;
1152+
default:
1153+
{
1154+
MCAutoStringRef t_sig;
1155+
type_to_string(self, static_cast<MCScriptTypeDefinition *>(t_def) -> type, &t_sig);
1156+
__writeln(stream, "type %@ is %@", t_def_name, *t_sig);
1157+
}
1158+
break;
11401159
}
11411160
}
11421161
break;

toolchain/lc-compile/src/grammar.g

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -180,6 +180,12 @@
180180
'rule' ImportDefinition(-> type(Position, public, Id, foreign(Position, ""))):
181181
"foreign" @(-> Position) "type" Identifier(-> Id)
182182
183+
'rule' ImportDefinition(-> type(Position, public, Id, handler(Position, Signature))):
184+
"handler" @(-> Position) "type" Identifier(-> Id) Signature(-> Signature)
185+
186+
'rule' ImportDefinition(-> type(Position, public, Id, Type)):
187+
"type" @(-> Position) Identifier(-> Id) "is" Type(-> Type)
188+
183189
'rule' ImportDefinition(-> constant(Position, public, Id, nil)):
184190
"constant" @(-> Position) Identifier(-> Id)
185191

0 commit comments

Comments
 (0)