示例#1
0
 /// <summary>
 /// インデクサの引数リスト処理
 /// </summary>
 /// <param name="tokens"></param>
 /// <param name="parent"></param>
 /// <returns></returns>
 private KecaknoahArgumentCallExpressionAstNode ParsePrimaryIndexerAccessExpression(Queue<KecaknoahToken> tokens, KecaknoahPrimaryExpressionAstNode parent)
 {
     var r = new KecaknoahArgumentCallExpressionAstNode();
     r.Target = parent;
     r.ExpressionType = KecaknoahOperatorType.IndexerAccess;
     tokens.SkipLogicalLineBreak();    //TODO: 暗黙改行
     if (tokens.CheckSkipToken(KecaknoahTokenType.BracketEnd)) return r;
     while (true)
     {
         r.Arguments.Add(ParseExpression(tokens));
         if (tokens.CheckSkipToken(KecaknoahTokenType.Comma)) continue;
         tokens.SkipLogicalLineBreak();    //TODO: 暗黙改行
         if (tokens.CheckSkipToken(KecaknoahTokenType.BracketEnd)) break;
         throw new KecaknoahParseException(tokens.Peek().CreateErrorAt("メソッド呼び出しの引数リストが無効です。"));
     }
     return r;
 }
示例#2
0
 internal IList<KecaknoahILCode> PrecompileIndexerCall(KecaknoahArgumentCallExpressionAstNode node)
 {
     var result = new List<KecaknoahILCode>();
     result.AddRange(PrecompileExpression(node.Target));
     foreach (var arg in node.Arguments) result.AddRange(PrecompileExpression(arg));
     result.Add(new KecaknoahILCode { Type = KecaknoahILCodeType.IndexerCall, IntegerValue = node.Arguments.Count });
     return result;
 }