1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
|
module static-semantics/types/type-extensions
imports
static-semantics/actions/functions
static-semantics/types/built-ins
static-semantics/webdsl-entities
static-semantics/webdsl-native
static-semantics/webdsl-types
static-semantics/webdsl
rules
defOk(, TypeDef(, defs)) :- {}
builtInType(s, name) == BUILTINTYPE(name, _) | error $[Type [name] is not a built-in type],
new s_type, s_type -DEF-> s,
declareExtendScope(s, name, s_type), // declare s_type to be linked to other scopes from type name
extendScopes(resolveExtendScope(s, name), s_type),
typeElementsOk(s, s_type, defs).
typeElementsOk maps typeElementOk(*, *, list(*))
: scope * scope * TypeElement
typeElementOk(s, s_type, TypeFunction(function)) :-
nativeClassFunctionOk(s, s_type, function).
typeElementOk(s, s_type, TypeFunctionFromStatic(NCFunctionFromStatic(_, function))) :-
nativeClassFunctionOk(s, s_type, function).
rules // typing of expressions
typeOfCall(s, BUILTINTYPE(_, s_type), f, args) = typeOfFunctionCallInternal(s, f, args, funSigs) :-
funSigs == resolveEntityFunction(s_type, f).
typeOfCall(s, STATICBUILTINTYPE(_, s_type), f, args) = typeOfFunctionCallInternal(s, f, args, funSigs) :-
funSigs == resolveStaticEntityFunction(s_type, f).
|