From 0fa3aee717b039088c3fa4c9c5605af30fcf643d Mon Sep 17 00:00:00 2001 From: Boris Batkin Date: Wed, 11 Dec 2024 17:29:36 -0800 Subject: [PATCH] unsafe tables and more --- daslib/rst.das | 26 +++++++++++++------------- modules/dasLLVM | 2 +- src/ast/ast_generate.cpp | 3 +++ 3 files changed, 17 insertions(+), 14 deletions(-) diff --git a/daslib/rst.das b/daslib/rst.das index c89a3c966..8d6cf69c7 100644 --- a/daslib/rst.das +++ b/daslib/rst.das @@ -455,7 +455,7 @@ def document_function_arguments(doc_file:file;argNames:array;argTypes:ar if length(tab)!=1 fwrite(doc_file,make_table(tab,true)) -def document_class_method(doc_file:file;mod:Module?;value;fld) +def document_class_method(doc_file:file;mod:Module?;value;var fld) let argNames <- [{for arg in fld._type.argNames; string(arg)}] let argTypes <- [{for arg in fld._type.argTypes; get_ptr(arg)}] document_function_declaration(doc_file,"das:function","{value.name}.{fld.name}", @@ -777,7 +777,7 @@ def function_name ( name : string ) return "operator {name}" return name -def document_function(doc_file:file;mod:Module?;func:FunctionPtr|Function?) +def document_function(doc_file:file;mod:Module?;var func:FunctionPtr|Function?) let argNames <- [{for arg in func.arguments; string(arg.name)}] let argTypes <- [{for arg in func.arguments; get_ptr(arg._type)}] fwrite(doc_file,make_label(function_label_name(func))) @@ -792,13 +792,13 @@ def document_function(doc_file:file;mod:Module?;func:FunctionPtr|Function?) document_function_arguments(doc_file,argNames,argTypes) document_topic(doc_file,topic("function",mod,"{function_file_name(func)}")) -def document_functions(doc_file:file;mod:Module?;groups:array) +def document_functions(doc_file:file;mod:Module?;var groups:array) var tab : table for grp in groups if length(grp.func) != 0 if !show_hidden_groups && grp.hidden for func in grp.func - tab[func] = true + tab |> insert(func, true) else fwrite(doc_file,make_group(grp.name)) if grp.hidden @@ -810,18 +810,18 @@ def document_functions(doc_file:file;mod:Module?;groups:array) fwrite(doc_file," * {make_ref(labn,descr)}\n") fwrite(doc_file,"\n") for func in grp.func - if tab[func] + if tab |> get_value(func) continue - tab[func] = true + tab |> insert(func, true) document_function(doc_file,mod,func) var first_function = true for_each_function(mod, "") <| $(func) if !function_needs_documenting(func) return var pfunc = get_ptr(func) - if tab[pfunc] + if tab |> get_value(pfunc) return - tab[pfunc] = true + tab |> insert(pfunc, true) if first_function fwrite(doc_file,make_group("Uncategorized")) first_function = false @@ -830,9 +830,9 @@ def document_functions(doc_file:file;mod:Module?;groups:array) if !function_needs_documenting(func) return var pfunc = get_ptr(func) - if tab[pfunc] + if tab |> get_value(pfunc) return - tab[pfunc] = true + tab |> insert(pfunc, true) if first_function fwrite(doc_file,make_group("Uncategorized")) first_function = false @@ -873,8 +873,8 @@ def public hide_group(var group:DocGroup) return <- group def private generate_topic_stub(var tab:table;doc_file:file;topic:string implicit) - if !tab[topic] - tab[topic] = true + if !tab |> get_value(topic) + tab |> insert(topic, true) fwrite(doc_file,".. {topic} replace:: to be documented in {topic}.rst\n\n" ) def private generate_substitute_stub(mod:Module?;substname:string) @@ -932,7 +932,7 @@ def private getDetailIncludePath ( fname, substname : string ) var ipath = join ( [[ for i in range(index,length(snp)); snp[i] ]], "/" ) return ipath -def public document(name:string;mod:Module?;fname,substname:string;groups:array) +def public document(name:string;mod:Module?;fname,substname:string;var groups:array) //! Document single module given list of `DocGropus`. //! This will generate RST file with documentation for the module. //! Functions which do not match any `DocGroup` will be placed in the `Uncategorized` group. diff --git a/modules/dasLLVM b/modules/dasLLVM index 9261678ab..5fcb6b057 160000 --- a/modules/dasLLVM +++ b/modules/dasLLVM @@ -1 +1 @@ -Subproject commit 9261678ab188eec8c754eb07dce1bd9785dfff28 +Subproject commit 5fcb6b057b2852c9a9655e45a895e5a7f52dbc98 diff --git a/src/ast/ast_generate.cpp b/src/ast/ast_generate.cpp index e0bae6a65..9b481abf8 100644 --- a/src/ast/ast_generate.cpp +++ b/src/ast/ast_generate.cpp @@ -133,6 +133,9 @@ namespace das { pVar->type->firstType = make_smart(*expr->subexpr->type); pVar->type->firstType->ref = false; pVar->type->firstType->constant = false; + if ( expr->subexpr->type->isPointer() && expr->subexpr->type->constant ) { + pVar->type->firstType->firstType->constant = true; + } // let temp auto pLet = make_smart(); pLet->at = expr->at;