Phase 8.8: Pack transparency system core implementation completed

Co-authored-by: moe-charm <217100418+moe-charm@users.noreply.github.com>
This commit is contained in:
copilot-swe-agent[bot]
2025-08-15 10:52:35 +00:00
parent 6b62209da9
commit 8dfa9a50b5
6 changed files with 235 additions and 48 deletions

View File

@ -486,32 +486,39 @@ impl NyashParser {
});
};
// DOTを確認
self.consume(TokenType::DOT)?;
// method名を取得 (IDENTIFIERまたはINITを受け入れ)
let method = match &self.current_token().token_type {
TokenType::IDENTIFIER(name) => {
let name = name.clone();
self.advance();
name
}
TokenType::INIT => {
self.advance();
"init".to_string()
}
TokenType::PACK => {
self.advance();
"pack".to_string()
}
_ => {
let line = self.current_token().line;
return Err(ParseError::UnexpectedToken {
found: self.current_token().token_type.clone(),
expected: "method name".to_string(),
line,
});
// DOT とmethod名は任意pack透明化対応
let method = if self.match_token(&TokenType::DOT) {
// DOTがある場合: from Parent.method() 形式
self.advance(); // consume DOT
// method名を取得 (IDENTIFIERまたはINITを受け入れ)
match &self.current_token().token_type {
TokenType::IDENTIFIER(name) => {
let name = name.clone();
self.advance();
name
}
TokenType::INIT => {
self.advance();
"init".to_string()
}
TokenType::PACK => {
self.advance();
"pack".to_string()
}
_ => {
let line = self.current_token().line;
return Err(ParseError::UnexpectedToken {
found: self.current_token().token_type.clone(),
expected: "method name".to_string(),
line,
});
}
}
} else {
// DOTがない場合: from Parent() 形式 - 透明化システム
// 🔥 Pack透明化: Parent名をmethod名として使用
parent.clone()
};
// 引数リストをパース