File tree 2 files changed +12
-3
lines changed
2 files changed +12
-3
lines changed Original file line number Diff line number Diff line change 1174
1174
return obj ;
1175
1175
} ;
1176
1176
1177
- Opal . alias_native = function ( obj , name , old ) {
1177
+ Opal . alias_native = function ( obj , name , native_name ) {
1178
1178
var id = '$' + name ,
1179
- body = obj . $$proto [ '$' + old ] ;
1179
+ body = obj . $$proto [ native_name ] ;
1180
1180
1181
1181
if ( typeof ( body ) !== "function" || body . $$stub ) {
1182
- throw Opal . NameError . $new ( "undefined method `" + old + "' for class `" + obj . $name ( ) + "'" )
1182
+ throw Opal . NameError . $new ( "undefined native method `" + native_name + "' for class `" + obj . $name ( ) + "'" )
1183
1183
}
1184
1184
1185
1185
Opal . defn ( obj , id , wrap ( body ) ) ;
Original file line number Diff line number Diff line change 25
25
} . new ( `{ a: 42 }` ) . a . should == 42
26
26
end
27
27
end
28
+
29
+ describe 'Module#alias_native' do
30
+ it 'exposes a native method' do
31
+ klass = Class . new
32
+ `klass.$$proto.a = function() { return 123 }`
33
+ klass . alias_native :a , :a
34
+ klass . new . a . should == 123
35
+ end
36
+ end
You can’t perform that action at this time.
2 commit comments
meh commentedon Feb 25, 2015
Yeah, I was backporting fixes/cleanups from proper-bridging to keep myself sane, some changes broke themselves and didn't fail.
elia commentedon Feb 25, 2015
No worries, was just for fun :)