diff --git a/.run/Demo25.run.xml b/.run/Demo25.run.xml new file mode 100644 index 0000000..95ec15e --- /dev/null +++ b/.run/Demo25.run.xml @@ -0,0 +1,10 @@ + + + + \ No newline at end of file diff --git a/playground/Demo/Demo25/Main.snow b/playground/Demo/Demo25/Main.snow new file mode 100644 index 0000000..d83e6a4 --- /dev/null +++ b/playground/Demo/Demo25/Main.snow @@ -0,0 +1,23 @@ +module: Main + import: os,ModuleA + globals: + declare c: int = 10 + function: main + returns: void + body: + c = ModuleA.getA() + os.print(c) + end body + end function +end module + +module: ModuleA + globals: + declare a: int = 2 + function: getA + returns: int + body: + return a + end body + end function +end module diff --git a/playground/Demo/Demo25/OS.snow b/playground/Demo/Demo25/OS.snow new file mode 100644 index 0000000..1982627 --- /dev/null +++ b/playground/Demo/Demo25/OS.snow @@ -0,0 +1,11 @@ +module: os + import: os + function: print + params: + declare i1: int + returns: void + body: + syscall("PRINT",i1) + end body + end function +end module \ No newline at end of file diff --git a/src/main/java/org/jcnc/snow/compiler/semantic/analyzers/expression/CallExpressionAnalyzer.java b/src/main/java/org/jcnc/snow/compiler/semantic/analyzers/expression/CallExpressionAnalyzer.java index 250e12e..c71f54a 100644 --- a/src/main/java/org/jcnc/snow/compiler/semantic/analyzers/expression/CallExpressionAnalyzer.java +++ b/src/main/java/org/jcnc/snow/compiler/semantic/analyzers/expression/CallExpressionAnalyzer.java @@ -25,6 +25,7 @@ import java.util.List; *
  • 支持数值参数的宽化转换(如 int → double);
  • *
  • 支持数值到字符串的隐式转换(自动视为调用 {@code to_string});
  • *
  • 在发生类型不匹配、未导入模块或函数未定义等情况下记录语义错误。
  • + *
  • 新增:以"_"开头的函数名只允许在本模块访问,禁止跨模块访问。
  • * */ public class CallExpressionAnalyzer implements ExpressionAnalyzer { @@ -64,20 +65,32 @@ public class CallExpressionAnalyzer implements ExpressionAnalyzer