This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| class MyVisitor < RLTK::Visitor | |
| def wrapper_fun | |
| ... | |
| yield | |
| ... | |
| end | |
| # Option 1 | |
| on KlassName do | |
| wrapper_fun do |params| |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| #ifndef RATIONAL_H | |
| #define RATIONAL_H | |
| /* | |
| * Standard Includes | |
| */ | |
| #include <type_traits> | |
| /* |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| class MyClass { | |
| template <typename IntType> | |
| inline operator typename std::enable_if<std::is_integral<IntType>::value, IntType>::type () { | |
| // Integer specific code. | |
| } | |
| template <typename FloatType> | |
| inline operator typename std::enable_if<std::is_floating_point<FloatType>::value, FloatType>::type () { | |
| // Float specific code. | |
| } |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| # Ruby Language Toolkit | |
| require 'rltk/cg/llvm' | |
| require 'rltk/cg/module' | |
| require 'rltk/cg/execution_engine' | |
| require 'rltk/cg/target' | |
| require 'rltk/cg/type' | |
| require 'rltk/cg/value' | |
| RLTK::CG::LLVM.init(:all) | |
| RLTK::CG::LLVM.init_asm_parser(:all) |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| module AbstractClass | |
| def self.included(klass) | |
| klass.instance_exec do | |
| @abstract_class = klass | |
| def self.new(*args) | |
| if self == @abstract_class | |
| raise "Instantiating abstract class #{self} is not allowed." | |
| else | |
| super |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| module A | |
| def A.included(klass) | |
| klass.instance_exec do | |
| @@foo = 0 | |
| def inc() | |
| puts self.object_id | |
| puts @@foo | |
NewerOlder