Skip to content

Commit

Permalink
Built-ins
Browse files Browse the repository at this point in the history
* removed 'self' built in, due to the new AST-based definition and it is
  general a AST-only feature
  - see ref sealangdotorg/sea#19
  - see ref sealangdotorg/sea#20
  - see ref sealangdotorg/sea#22
  • Loading branch information
ppaulweber committed Apr 19, 2017
1 parent 1f96bc4 commit 6146f01
Show file tree
Hide file tree
Showing 5 changed files with 2 additions and 51 deletions.
26 changes: 2 additions & 24 deletions src/Builtin.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -258,30 +258,8 @@ GeneralBuiltin::GeneralBuiltin(

u1 GeneralBuiltin::classof( Value const* obj )
{
return obj->id() == classid() or SelfBuiltin::classof( obj )
or AbortBuiltin::classof( obj ) or AssertBuiltin::classof( obj )
or OutputBuiltin::classof( obj );
}

//
// SelfBuiltin
//

SelfBuiltin::SelfBuiltin( const Type::Ptr& type )
: GeneralBuiltin( type, info, classid() )
{
}

const Annotation SelfBuiltin::info( classid(),
Annotation::Data{

{ Type::RULE_REFERENCE, {} },

} );

u1 SelfBuiltin::classof( Value const* obj )
{
return obj->id() == classid();
return obj->id() == classid() or AbortBuiltin::classof( obj )
or AssertBuiltin::classof( obj ) or OutputBuiltin::classof( obj );
}

//
Expand Down
17 changes: 0 additions & 17 deletions src/Builtin.h
Original file line number Diff line number Diff line change
Expand Up @@ -87,23 +87,6 @@ namespace libcasm_ir
static u1 classof( Value const* obj );
};

class SelfBuiltin final : public GeneralBuiltin
{
public:
using Ptr = std::shared_ptr< SelfBuiltin >;

SelfBuiltin( const Type::Ptr& type );

static const Annotation info;

static inline Value::ID classid( void )
{
return Value::SELF_BUILTIN;
}

static u1 classof( Value const* obj );
};

class AbortBuiltin final : public GeneralBuiltin
{
public:
Expand Down
4 changes: 0 additions & 4 deletions src/Value.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -476,10 +476,6 @@ std::string Value::token( const Value::ID id )
{
return "GeneralBuiltin";
}
case Value::SELF_BUILTIN:
{
return "self";
}
case Value::ABORT_BUILTIN:
{
return "abort";
Expand Down
1 change: 0 additions & 1 deletion src/Value.h
Original file line number Diff line number Diff line change
Expand Up @@ -126,7 +126,6 @@ namespace libcasm_ir
BUILTIN,

GENERAL_BUILTIN,
SELF_BUILTIN,
ABORT_BUILTIN,
ASSERT_BUILTIN,

Expand Down
5 changes: 0 additions & 5 deletions uts/Value.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -376,11 +376,6 @@ TEST( libcasm_ir_Value, id_to_token_string )
EXPECT_STREQ( Value::token( id ).c_str(), "GeneralBuiltin" );
break;
}
case Value::SELF_BUILTIN:
{
EXPECT_STREQ( Value::token( id ).c_str(), "self" );
break;
}
case Value::ABORT_BUILTIN:
{
EXPECT_STREQ( Value::token( id ).c_str(), "abort" );
Expand Down

0 comments on commit 6146f01

Please sign in to comment.