Skip to content

Commit 4f1b5cf

Browse files
committed
has-key indicates what is being had
1 parent 423d56c commit 4f1b5cf

16 files changed

Lines changed: 25 additions & 25 deletions

PLUGINS/BACKEND/C/std-c-compile-global.lsts

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -6,10 +6,10 @@ let std-c-force-import-clib(lib: CString): Nil = (
66
);
77

88
let std-c-finish-forced-imports(): S = (
9-
(if std-c-force-imports.has(c"stdlib.h") then SAtom(c"#include <stdlib.h>\n") else SNil()) +
10-
(if std-c-force-imports.has(c"stdio.h") then SAtom(c"#include <stdio.h>\n") else SNil()) +
11-
(if std-c-force-imports.has(c"regex.h") then SAtom(c"#include <regex.h>\n") else SNil()) +
12-
(if std-c-force-imports.has(c"string.h") then SAtom(c"#include <string.h>\n") else SNil()) +
9+
(if std-c-force-imports.has-key(c"stdlib.h") then SAtom(c"#include <stdlib.h>\n") else SNil()) +
10+
(if std-c-force-imports.has-key(c"stdio.h") then SAtom(c"#include <stdio.h>\n") else SNil()) +
11+
(if std-c-force-imports.has-key(c"regex.h") then SAtom(c"#include <regex.h>\n") else SNil()) +
12+
(if std-c-force-imports.has-key(c"string.h") then SAtom(c"#include <string.h>\n") else SNil()) +
1313
(SAtom(c"#include <malloc.h>\n")) +
1414
(SAtom(c"#include <unistd.h>\n"))
1515
);

PLUGINS/FRONTEND/C/c-ast-to-lm-ast.lsts

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,7 @@ let std-c-declare(t: CTerm): Nil = (
1919
))
2020
);
2121
);
22-
CIdentifier{name2=value} => (if not(std-c-declare-dedup-index.has(name2)) {
22+
CIdentifier{name2=value} => (if not(std-c-declare-dedup-index.has-key(name2)) {
2323
std-c-declare-dedup-index = std-c-declare-dedup-index.bind(name2, true);
2424
if can-unify( t1(c"C",t0(c"typedef")), return-type ) {
2525
std-c-typedef-name-index = std-c-typedef-name-index.bind(name2, true);
@@ -36,7 +36,7 @@ let std-c-declare(t: CTerm): Nil = (
3636
});
3737
CUnaryPrefix{op:"Declarator(", arg=arg} => (
3838
(let name3, let body) = std-c-sig-of-declarator(return-type, arg, ta, (None : Maybe<CTerm>)());
39-
if not(std-c-declare-dedup-index.has(name3.into(type(String)))) {
39+
if not(std-c-declare-dedup-index.has-key(name3.into(type(String)))) {
4040
std-c-declare-dedup-index = std-c-declare-dedup-index.bind(name3.into(type(String)), true);
4141
if can-unify( t1(c"C",t0(c"typedef")), return-type ) {
4242
std-c-typedef-name-index = std-c-typedef-name-index.bind(name3.into(type(String)), true);
@@ -48,7 +48,7 @@ let std-c-declare(t: CTerm): Nil = (
4848
);
4949
CBinaryOp{op:"Declarator(", arg1=arg1, arg2=arg2 } => (
5050
(let name4, let body) = std-c-sig-of-declarator(return-type, arg1, ta, Some(arg2));
51-
if not(std-c-declare-dedup-index.has(name4.into(type(String)))) {
51+
if not(std-c-declare-dedup-index.has-key(name4.into(type(String)))) {
5252
std-c-declare-dedup-index = std-c-declare-dedup-index.bind(name4.into(type(String)), true);
5353
if can-unify( t1(c"C",t0(c"typedef")), return-type ) {
5454
std-c-typedef-name-index = std-c-typedef-name-index.bind(name4.into(type(String)), true);
@@ -61,7 +61,7 @@ let std-c-declare(t: CTerm): Nil = (
6161
CBinaryOp{op:"Declarator*", ptr=arg1, arg2:CBinaryOp{op:"Declarator(", arg1=arg1, arg2=arg2 } } => (
6262
return-type = std-c-decorate-pointer(return-type, ptr);
6363
(let name5, let body) = std-c-sig-of-declarator(return-type, arg1, ta, Some(arg2));
64-
if not(std-c-declare-dedup-index.has(name5.into(type(String)))) {
64+
if not(std-c-declare-dedup-index.has-key(name5.into(type(String)))) {
6565
std-c-declare-dedup-index = std-c-declare-dedup-index.bind(name5.into(type(String)), true);
6666
if can-unify( t1(c"C",t0(c"typedef")), return-type ) {
6767
std-c-typedef-name-index = std-c-typedef-name-index.bind(name5.into(type(String)), true);
@@ -72,7 +72,7 @@ let std-c-declare(t: CTerm): Nil = (
7272
}
7373
);
7474
CBinaryOp{op:"Declarator*", ptr=arg1, arg2:CIdentifier{name6=value} } => (
75-
if not(std-c-declare-dedup-index.has(name6)) {
75+
if not(std-c-declare-dedup-index.has-key(name6)) {
7676
std-c-declare-dedup-index = std-c-declare-dedup-index.bind(name6, true);
7777
if can-unify( t1(c"C",t0(c"typedef")), return-type ) {
7878
std-c-typedef-name-index = std-c-typedef-name-index.bind(name6, true);

PLUGINS/FRONTEND/C/c-parse.lsts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -157,7 +157,7 @@ let std-c-has-class(tks: String, cls: String): Bool = (
157157
"floating" => tk == r/^[0-9]+([.][0-9]+)?([eE][0-9]+)?[fF]?/ # decimal constant
158158
or tk == r/^[0][x][0-9a-fA-F]+([.][0-9a-fA-F]+)?([eE][0-9a-fA-F]+)?([pP][0-9]+)[fF]?/; # hexadecimal constant
159159
"string" => tk == r/^[RLuU8]*["]([^"\\]|([\\].))*["]/;
160-
"enumeration" => std-c-enumeration-constant-index.has(tks);
160+
"enumeration" => std-c-enumeration-constant-index.has-key(tks);
161161
_ => tks == cls;
162162
}
163163
);
@@ -704,7 +704,7 @@ std-c-typedef-name-index = std-c-typedef-name-index.bind("__builtin_va_list", tr
704704

705705
let std-c-parse-typedef-name(tokens: List<Token>): Tuple<Maybe<CTerm>,List<Token>> = (
706706
let no = (None : Maybe<CTerm>)();
707-
if non-zero(tokens) and std-c-typedef-name-index.has(head(tokens).skey) {
707+
if non-zero(tokens) and std-c-typedef-name-index.has-key(head(tokens).skey) {
708708
Tuple( Some(CType1(head(tokens).skey)), tail(tokens) )
709709
} else Tuple( no, tokens )
710710
);

SRC/ascript-datatype-index.lsts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@ let .is-datatype(tt: Type): Bool = (
1414
);
1515
_ => (
1616
let gta = tt.ground-tag-and-arity;
17-
datatype-index.has(gta)
17+
datatype-index.has-key(gta)
1818
);
1919
}
2020
);

SRC/prop-is-phi-type.lsts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,5 +2,5 @@
22
let phi-type-index = {} : Hashtable<(CString,U64),Bool>;
33

44
let .is-phi-type(tt: Type): Bool = (
5-
phi-type-index.has(tt.ground-tag-and-arity)
5+
phi-type-index.has-key(tt.ground-tag-and-arity)
66
);

SRC/prop-tctx-apply.lsts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,7 @@ let .apply(tctx: TypeContext?, fname: CString, ft: Type, at: Type, blame: AST, r
1818
# Assert that all equal type variables also have equal datatype
1919
let apply-type-variables = {} : Hashtable<CString,Type>;
2020
for list tr in apply-tctx.get-or-panic.tctx {
21-
if apply-type-variables.has(tr.key-or-zero) {
21+
if apply-type-variables.has-key(tr.key-or-zero) {
2222
let previous-seen-tt = apply-type-variables.lookup(tr.key-or-zero, ta).datatype;
2323
let current-seen-tt = tr.direct-type.datatype;
2424
if previous-seen-tt != current-seen-tt {

SRC/tctx-phi-append.lsts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@ let .phi-append-dead-on-arrival(tctx-primary: TypeContext?, tctx-secondary: Type
1010
let .phi-append(tctx-primary: List<PhiContextRow>, tctx-secondary: List<PhiContextRow>, dead-on-arrival: Bool): List<PhiContextRow> = (
1111
let seen = {} : Hashtable<CString,Bool>;
1212
for list pr1 in tctx-secondary {
13-
if not(seen.has(pr1.phi-id-or-zero)) {
13+
if not(seen.has-key(pr1.phi-id-or-zero)) {
1414
let pr2 = tctx-primary.lookup(pr1.phi-id-or-zero);
1515
if dead-on-arrival then pr1 = PhiContextRow(pr1.phi-id-or-zero, pr1.phi-tt-or-zero, pr1.blame-or-zero, dead-on-arrival, pr1.is-global-or-zero);
1616
if not(is(pr1,pr2)) and not(dead-on-arrival and non-zero(pr2)) {

SRC/tctx-phi-move-all.lsts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
let .phi-move-all(tctx: TypeContext?): TypeContext? = (
33
let seen = {} : Hashtable<CString,Bool>;
44
for list pr in tctx.get-or(mk-tctx()).pctx {
5-
if not(seen.has(pr.phi-id-or-zero)) {
5+
if not(seen.has-key(pr.phi-id-or-zero)) {
66
if pr.phi-tt-or-zero.is-linear-live {
77
tctx = tctx.bind-phi(pr.phi-id-or-zero, pr.phi-tt-or-zero.move-linear, pr.blame-or-zero);
88
};

SRC/typecheck-accept-interface.lsts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@ let .should-accept-interface(tt: Type): Bool = (
1212
for vector c in conjugate { result = result and c.should-accept-interface };
1313
result
1414
);
15-
TGround{tag=tag} => interface-index.has(tt.ground-tag-and-arity);
15+
TGround{tag=tag} => interface-index.has-key(tt.ground-tag-and-arity);
1616
_ => false;
1717
}
1818
);

SRC/typecheck-index-plugins.lsts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -4,13 +4,13 @@ let plugin-current-backend = &plugin-null-backend;
44
let frontend-has-seen = {} : Hashtable<CString,Bool>;
55

66
let frontend(fp: CString): Nil = (
7-
if not(frontend-has-seen.has(fp)) {
7+
if not(frontend-has-seen.has-key(fp)) {
88
frontend-has-seen = frontend-has-seen.bind(fp,true);
99
if fp.has-prefix(c"core/") then fp = config-platform-prefix + fp;
1010
if fp.has-prefix(c"std/") then fp = config-platform-prefix + fp;
1111
let found-file = false;
1212
if fp.has-suffix(c".h") then found-file = true;
13-
if plugins-frontends-index.has(fp.file-extension) then found-file = true;
13+
if plugins-frontends-index.has-key(fp.file-extension) then found-file = true;
1414
if not(found-file) {
1515
if file-exists(fp) {
1616
found-file = true

0 commit comments

Comments
 (0)