Example: Changed glyph-outline.shape for use with FontConfig.
[shapes.git] / source / astinsertion.cc
blob8ae7e4e4d1ce51f1c95ff5bfd9fb61e0fa25d7be
1 /* This file is part of Shapes.
3 * Shapes is free software: you can redistribute it and/or modify
4 * it under the terms of the GNU General Public License as published by
5 * the Free Software Foundation, either version 3 of the License, or
6 * any later version.
8 * Shapes is distributed in the hope that it will be useful,
9 * but WITHOUT ANY WARRANTY; without even the implied warranty of
10 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
11 * GNU General Public License for more details.
13 * You should have received a copy of the GNU General Public License
14 * along with Shapes. If not, see <http://www.gnu.org/licenses/>.
16 * Copyright 2008 Henrik Tidefelt
19 #include "astinsertion.h"
23 Shapes::MemberAssignStmt::MemberAssignStmt( const Ast::SourceLocation & _loc, Ast::Expression * _variable, Shapes::IdentifierNode * _fieldID, Ast::Expression * _expr )
24 : loc( _loc ), variable( _variable ), fieldID( _fieldID ), expr( _expr )
25 { }
27 Shapes::MemberAssignStmt::~MemberAssignStmt( )
29 delete variable;
30 delete fieldID;
31 delete expr;
34 RefCountPtr< const Lang::Value >
35 Shapes::MemberAssignStmt::value( Kernel::Environment::VariableHandle dstgroup, SimplePDF::PDF_out * pdfo, Kernel::GraphicsState * metaState, Kernel::PassedEnv env ) const
37 Kernel::ValueRef untypedVar = variable->value( dstgroup, pdfo, metaState, env );
39 typedef const Lang::Instance VarType;
40 VarType * typedVar = dynamic_cast< VarType * >( untypedVar.getPtr( ) );
41 if( typedVar == 0 )
43 throw Exceptions::NonObjectMemberAssignment( loc, untypedVar->getTypeName( ) );
46 typedVar->assignMember( fieldID->identifier( dstgroup, pdfo, metaState, env ),
47 expr->value( dstgroup, pdfo, metaState, env ) );
49 return Shapes::THE_VOID;
52 const Ast::SourceLocation &
53 Shapes::MemberAssignStmt::firstLoc( ) const
55 return loc;
58 const Ast::SourceLocation &
59 Shapes::MemberAssignStmt::lastLoc( ) const
61 return loc;