Просмотр исходного кода

fix annotation detection for pyi

Lyon 2 лет назад
Родитель
Сommit
d2447d2eca

+ 4 - 0
port/linux/package/pikascript/_testcase.pyi

@@ -1,8 +1,12 @@
 
 def test_tuple_nested(tuple_nasted: tuple): ...
 
+
 class test:
     environ: dict
     def __init__(self): ...
 
+    # def gap_advertise(self, interval_us, adv_data=None, *, resp_data=None, connectable=True): ...
+
+
 def bytes_test(bytes: bytes, len: int): ...

+ 1 - 1
src/PikaVersion.h

@@ -2,4 +2,4 @@
 #define PIKA_VERSION_MINOR 12
 #define PIKA_VERSION_MICRO 6
 
-#define PIKA_EDIT_TIME "2023/09/17 11:11:11"
+#define PIKA_EDIT_TIME "2023/09/17 16:41:46"

+ 6 - 5
tools/pikaCompiler/src/arg_list.rs

@@ -68,11 +68,12 @@ impl ArgList {
                 Some(name) => name,
                 /* if not get ':', ignore the arg */
                 None => {
-                    if arg_define.starts_with("*") && arg_define.chars().nth(1).unwrap() != '*' {
-                        /* is the tuple variable parameter */
-                        String::from("@tupleVarPar")
-                    } else if arg_define.starts_with("*") {
-                        String::from("@dictVarPar")
+                    if arg_define.starts_with("*") {
+                        match arg_define.chars().nth(1) {
+                            Some('*') => String::from("@dictVarPar"),
+                            Some(_) => String::from("@tupleVarPar"),
+                            None => panic!("Unexpected end of string after '*' in arg_define!"), // Or handle this differently based on your use-case
+                        }
                     } else {
                         String::from("")
                     }

+ 1 - 1
tools/pikaCompiler/src/compiler.rs

@@ -431,7 +431,7 @@ impl Compiler {
             return Compiler::analyse_c_package_inner(compiler, file.to_string());
         }
 
-        if line.starts_with("#") {
+        if line.trim_start().starts_with("#") {
             return compiler;
         }
 

+ 2 - 1
tools/pikaCompiler/src/entry.rs

@@ -27,6 +27,7 @@ fn collect_pyi_files(dir: &Path) -> std::io::Result<Vec<String>> {
 }
 
 pub fn pika_compiler_entry() {
+    std::env::set_var("RUST_BACKTRACE", "1");
     let head_info = "/*
  * [Warning!] This file is auto-generated by pika compiler.
  * Do not edit it manually.
@@ -127,7 +128,7 @@ pub fn pika_compiler_entry() {
     f.write("\n".as_bytes()).unwrap();
 
     for (_, class_info) in compiler.class_list.iter() {
-        if class_info.is_package && !class_info.is_top{
+        if class_info.is_package && !class_info.is_top {
             continue;
         }
         /* get module_name */