//------------------------------------------------------------ // コンストラクタ。 public FunctionArgumentDecl( TypePath aTypePath , Identifier aIdent , bool aIsConst , bool aIsRef , bool aIsIn ) { TypePath = aTypePath; Ident = aIdent; IsConst = aIsConst; IsRef = aIsRef; IsIn = aIsIn; }
//------------------------------------------------------------ // TypeInfoを生成する。 public TypeInfo CreateTypeInfo(TypePath typePath) { BuiltInType builtInType = typePath.BuiltInType; TypeInfo.TypeKind kind = TypeInfo.TypeKind.VALUE; if (builtInType == BuiltInType.Void) { kind = TypeInfo.TypeKind.UNKNOWN; } return(new TypeInfo( new TypeInfo.TypeSymbol(builtInType) , kind , new TypeInfo.TypeAttribute(false, false) )); }
//------------------------------------------------------------ /// <summary> /// CastExpression: /// "cast" "(" TypePath ")" UnaryExpression /// </summary> /// <returns></returns> IExpression parseCastExpression() { // "cast" System.Diagnostics.Debug.Assert(currentToken().Value == Token.Kind.KeyCast); nextToken(); // "(" if (!expectToken(Token.Kind.OpLParen, ErrorKind.CAST_EXPRESSION_LPAREN_EXPECTED)) { return(null); } // TypePath TypePath typePath = parseTypePath(); if (typePath == null) { return(null); } // ")" if (!expectToken(Token.Kind.OpRParen, ErrorKind.CAST_EXPRESSION_RPAREN_EXPECTED)) { return(null); } // UnaryExpression IExpression expr = parseUnaryExpression(); if (expr == null) { return(null); } return(new CastExpression(typePath, expr)); }
//------------------------------------------------------------ /// <summary> /// NewExpression: /// "new" TypePath FunctionCallExpression /// </summary> /// <returns></returns> IExpression parseNewExpression() { // "new" System.Diagnostics.Debug.Assert(currentToken().Value == Token.Kind.KeyNew); nextToken(); // TypePath TypePath typePath = parseTypePath(); if (typePath == null) { return(null); } // FunctionCallExpression FunctionCallExpression funcCallExpr = parseFunctionCallExpression(); if (funcCallExpr == null) { return(null); } return(new NewExpression(typePath, funcCallExpr)); }
//------------------------------------------------------------ // コンストラクタ。 public NewExpression(TypePath aTypePath, FunctionCallExpression aFuncCallExpr) { mTypePath = aTypePath; mFuncCallExpr = aFuncCallExpr; }
//------------------------------------------------------------ // コンストラクタ。 public VariableDecl(TypePath aTypePath, Identifier aIdent, IExpression aExpr) { TypePath = aTypePath; Ident = aIdent; Expr = aExpr; }
//------------------------------------------------------------ // コンストラクタ。 public CastExpression(TypePath aTypePath, IExpression aExpr) { mTypePath = aTypePath; mExpr = aExpr; }