opal 0.3.2 → 0.3.6
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- data/README.md +85 -127
- data/bin/opal +3 -3
- data/lib/core.rb +114 -0
- data/{gems/core/lib → lib}/core/array.rb +68 -187
- data/{gems/core/lib → lib}/core/basic_object.rb +22 -5
- data/lib/core/class.rb +38 -0
- data/{gems/core/lib → lib}/core/dir.rb +1 -1
- data/lib/core/enumerable.rb +33 -0
- data/{gems/core/lib → lib}/core/error.rb +1 -4
- data/{gems/core/lib → lib}/core/false_class.rb +0 -0
- data/{gems/core/lib → lib}/core/file.rb +11 -3
- data/{gems/core/lib → lib}/core/hash.rb +12 -0
- data/{gems/core/lib → lib}/core/kernel.rb +114 -86
- data/lib/core/match_data.rb +33 -0
- data/lib/core/module.rb +97 -0
- data/{gems/core/lib → lib}/core/nil_class.rb +0 -0
- data/{gems/core/lib → lib}/core/numeric.rb +5 -0
- data/{gems/core/lib → lib}/core/object.rb +0 -0
- data/{gems/core/lib → lib}/core/proc.rb +13 -3
- data/{gems/core/lib → lib}/core/range.rb +10 -0
- data/{gems/core/lib → lib}/core/regexp.rb +33 -1
- data/{gems/core/lib → lib}/core/string.rb +25 -10
- data/{gems/core/lib → lib}/core/symbol.rb +3 -3
- data/{gems/core/lib → lib}/core/top_self.rb +0 -0
- data/{gems/core/lib → lib}/core/true_class.rb +0 -0
- data/lib/dev.rb +169 -0
- data/{gems/ospec/lib → lib}/ospec.rb +1 -0
- data/lib/ospec/autorun.rb +8 -0
- data/{gems/ospec/lib → lib}/ospec/dsl.rb +2 -2
- data/{gems/ospec/lib → lib}/ospec/example.rb +0 -0
- data/{gems/ospec/lib → lib}/ospec/example/before_and_after_hooks.rb +0 -0
- data/{gems/ospec/lib → lib}/ospec/example/errors.rb +0 -0
- data/{gems/ospec/lib → lib}/ospec/example/example_group.rb +0 -0
- data/{gems/ospec/lib → lib}/ospec/example/example_group_factory.rb +0 -3
- data/{gems/ospec/lib → lib}/ospec/example/example_group_hierarchy.rb +4 -3
- data/{gems/ospec/lib → lib}/ospec/example/example_group_methods.rb +1 -1
- data/{gems/ospec/lib → lib}/ospec/example/example_group_proxy.rb +3 -2
- data/{gems/ospec/lib → lib}/ospec/example/example_methods.rb +1 -1
- data/{gems/ospec/lib → lib}/ospec/example/example_proxy.rb +7 -7
- data/{gems/ospec/lib → lib}/ospec/expectations.rb +0 -0
- data/{gems/ospec/lib → lib}/ospec/expectations/errors.rb +0 -0
- data/{gems/ospec/lib → lib}/ospec/expectations/fail_with.rb +4 -3
- data/{gems/ospec/lib → lib}/ospec/expectations/handler.rb +6 -0
- data/lib/ospec/helpers/scratch.rb +18 -0
- data/{gems/ospec/lib → lib}/ospec/matchers.rb +2 -2
- data/{gems/ospec/lib → lib}/ospec/matchers/be.rb +0 -0
- data/{gems/ospec/lib → lib}/ospec/matchers/generated_descriptions.rb +0 -0
- data/{gems/ospec/lib → lib}/ospec/matchers/operator_matcher.rb +2 -0
- data/lib/ospec/matchers/raise_error.rb +38 -0
- data/lib/ospec/runner.rb +90 -0
- data/{gems/ospec/lib → lib}/ospec/runner/example_group_runner.rb +10 -13
- data/lib/ospec/runner/formatter/html_formatter.rb +139 -0
- data/{gems/ospec/lib → lib}/ospec/runner/formatter/terminal_formatter.rb +0 -0
- data/{gems/ospec/lib → lib}/ospec/runner/options.rb +1 -3
- data/{gems/ospec/lib → lib}/ospec/runner/reporter.rb +0 -9
- data/lib/racc/parser.rb +165 -0
- data/lib/strscan.rb +52 -0
- data/{lib → opal_lib}/opal.rb +2 -0
- data/opal_lib/opal/build_methods.rb +51 -0
- data/opal_lib/opal/builder.rb +164 -0
- data/opal_lib/opal/bundle.rb +70 -0
- data/opal_lib/opal/command.rb +68 -0
- data/{lib → opal_lib}/opal/context.rb +21 -9
- data/{lib → opal_lib}/opal/context/console.rb +0 -2
- data/opal_lib/opal/context/file_system.rb +34 -0
- data/{lib → opal_lib}/opal/context/loader.rb +26 -8
- data/opal_lib/opal/gem.rb +84 -0
- data/{lib → opal_lib}/opal/rake/builder_task.rb +2 -2
- data/opal_lib/opal/rake/spec_task.rb +32 -0
- data/{lib → opal_lib}/opal/ruby/nodes.rb +730 -109
- data/{lib → opal_lib}/opal/ruby/parser.rb +90 -23
- data/opal_lib/opal/ruby/ruby_parser.rb +4862 -0
- data/opal_lib/opal/ruby/ruby_parser.y +1454 -0
- data/opal_lib/opal/version.rb +4 -0
- data/runtime/class.js +359 -0
- data/runtime/debug.js +84 -0
- data/runtime/fs.js +199 -0
- data/runtime/init.js +558 -0
- data/runtime/loader.js +351 -0
- data/runtime/module.js +109 -0
- data/runtime/post.js +10 -0
- data/runtime/pre.js +7 -0
- data/runtime/runtime.js +351 -0
- metadata +88 -175
- data/.gitignore +0 -7
- data/Changelog +0 -31
- data/LICENSE +0 -75
- data/Rakefile +0 -86
- data/gems/core/README.md +0 -14
- data/gems/core/Rakefile +0 -8
- data/gems/core/core.gemspec +0 -13
- data/gems/core/lib/core.rb +0 -34
- data/gems/core/lib/core/class.rb +0 -31
- data/gems/core/lib/core/module.rb +0 -100
- data/gems/core/lib/core/vm.rb +0 -16
- data/gems/core/spec/core/array/append_spec.rb +0 -30
- data/gems/core/spec/core/array/assoc_spec.rb +0 -29
- data/gems/core/spec/core/array/at_spec.rb +0 -37
- data/gems/core/spec/core/array/clear_spec.rb +0 -22
- data/gems/core/spec/core/array/collect_bang_spec.rb +0 -27
- data/gems/core/spec/core/array/collect_spec.rb +0 -27
- data/gems/core/spec/core/array/compact_spec.rb +0 -41
- data/gems/core/spec/core/array/concat_spec.rb +0 -15
- data/gems/core/spec/core/array/constructor_spec.rb +0 -14
- data/gems/core/spec/core/array/each_spec.rb +0 -9
- data/gems/core/spec/core/array/element_reference_spec.rb +0 -4
- data/gems/core/spec/core/array/first_spec.rb +0 -35
- data/gems/core/spec/core/array/include_spec.rb +0 -9
- data/gems/core/spec/core/array/join_spec.rb +0 -6
- data/gems/core/spec/core/array/last_spec.rb +0 -51
- data/gems/core/spec/core/array/length_spec.rb +0 -6
- data/gems/core/spec/core/array/map_spec.rb +0 -33
- data/gems/core/spec/core/array/reverse_spec.rb +0 -6
- data/gems/core/spec/core/builtin_constants/builtin_constants_spec.rb +0 -7
- data/gems/core/spec/core/false/and_spec.rb +0 -10
- data/gems/core/spec/core/false/inspect_spec.rb +0 -6
- data/gems/core/spec/core/false/or_spec.rb +0 -10
- data/gems/core/spec/core/false/to_s_spec.rb +0 -6
- data/gems/core/spec/core/false/xor_spec.rb +0 -10
- data/gems/core/spec/core/file/join_spec.rb +0 -19
- data/gems/core/spec/core/hash/assoc_spec.rb +0 -32
- data/gems/core/spec/core/kernel/instance_eval_spec.rb +0 -0
- data/gems/core/spec/core/kernel/loop_spec.rb +0 -24
- data/gems/core/spec/core/kernel/raise_spec.rb +0 -0
- data/gems/core/spec/core/module/attr_accessor_spec.rb +0 -28
- data/gems/core/spec/core/number/lt_spec.rb +0 -12
- data/gems/core/spec/core/string/sub_spec.rb +0 -24
- data/gems/core/spec/core/true/and_spec.rb +0 -10
- data/gems/core/spec/core/true/inspect_spec.rb +0 -6
- data/gems/core/spec/core/true/or_spec.rb +0 -10
- data/gems/core/spec/core/true/to_s_spec.rb +0 -6
- data/gems/core/spec/core/true/xor_spec.rb +0 -10
- data/gems/core/spec/language/and_spec.rb +0 -61
- data/gems/core/spec/language/array_spec.rb +0 -68
- data/gems/core/spec/language/block_spec.rb +0 -38
- data/gems/core/spec/language/break_spec.rb +0 -36
- data/gems/core/spec/language/case_spec.rb +0 -103
- data/gems/core/spec/language/def_spec.rb +0 -21
- data/gems/core/spec/language/eigenclass_spec.rb +0 -60
- data/gems/core/spec/language/file_spec.rb +0 -13
- data/gems/core/spec/language/fixtures/block.rb +0 -21
- data/gems/core/spec/language/fixtures/super.rb +0 -293
- data/gems/core/spec/language/hash_spec.rb +0 -29
- data/gems/core/spec/language/if_spec.rb +0 -54
- data/gems/core/spec/language/loop_spec.rb +0 -11
- data/gems/core/spec/language/metaclass_spec.rb +0 -21
- data/gems/core/spec/language/method_spec.rb +0 -124
- data/gems/core/spec/language/next_spec.rb +0 -25
- data/gems/core/spec/language/or_spec.rb +0 -34
- data/gems/core/spec/language/redo_spec.rb +0 -24
- data/gems/core/spec/language/regexp_spec.rb +0 -26
- data/gems/core/spec/language/rescue_spec.rb +0 -20
- data/gems/core/spec/language/return_spec.rb +0 -47
- data/gems/core/spec/language/string_spec.rb +0 -25
- data/gems/core/spec/language/super_spec.rb +0 -32
- data/gems/core/spec/language/until_spec.rb +0 -157
- data/gems/core/spec/language/variables_spec.rb +0 -155
- data/gems/core/spec/language/while_spec.rb +0 -163
- data/gems/core/spec/spec_helper.rb +0 -5
- data/gems/core_fs/README.md +0 -19
- data/gems/dev/Rakefile +0 -5
- data/gems/dev/lib/dev.js +0 -99
- data/gems/dev/lib/dev/generator.js +0 -1264
- data/gems/dev/lib/dev/parser.js +0 -979
- data/gems/dev/lib/dev/ruby_parser.js +0 -1088
- data/gems/dev/lib/dev/ruby_parser.y +0 -1267
- data/gems/dev/lib/dev/string_scanner.js +0 -38
- data/gems/dev/tools/racc2js/README.md +0 -39
- data/gems/dev/tools/racc2js/math_parser.js +0 -222
- data/gems/dev/tools/racc2js/math_parser.rb +0 -133
- data/gems/dev/tools/racc2js/math_parser.y +0 -28
- data/gems/dev/tools/racc2js/parser.js +0 -218
- data/gems/dev/tools/racc2js/racc2js.rb +0 -153
- data/gems/json/README.md +0 -4
- data/gems/json/json.gemspec +0 -14
- data/gems/json/lib/json.rb +0 -64
- data/gems/json/lib/json/ext.rb +0 -51
- data/gems/json/lib/json/json2.js +0 -481
- data/gems/ospec/README.md +0 -0
- data/gems/ospec/lib/ospec/autorun.rb +0 -3
- data/gems/ospec/lib/ospec/runner.rb +0 -40
- data/gems/ospec/lib/ospec/runner/formatter/html_formatter.rb +0 -91
- data/gems/ospec/ospec.gemspec +0 -0
- data/gems/rquery/README.md +0 -9
- data/gems/rquery/lib/rquery.rb +0 -10
- data/gems/rquery/lib/rquery/ajax.rb +0 -4
- data/gems/rquery/lib/rquery/css.rb +0 -96
- data/gems/rquery/lib/rquery/document.rb +0 -25
- data/gems/rquery/lib/rquery/element.rb +0 -292
- data/gems/rquery/lib/rquery/event.rb +0 -108
- data/gems/rquery/lib/rquery/jquery.js +0 -8177
- data/gems/rquery/lib/rquery/request.rb +0 -138
- data/gems/rquery/lib/rquery/response.rb +0 -49
- data/gems/rquery/rquery.gemspec +0 -16
- data/lib/opal.js +0 -1597
- data/lib/opal/builder.rb +0 -117
- data/lib/opal/bundle.rb +0 -131
- data/lib/opal/command.rb +0 -11
- data/lib/opal/context/file_system.rb +0 -19
- data/lib/opal/gem.rb +0 -153
- data/lib/opal/ruby/ruby_parser.rb +0 -5170
- data/lib/opal/ruby/ruby_parser.y +0 -1298
- data/opal.gemspec +0 -15
data/runtime/post.js
ADDED
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
|
|
2
|
+
init();
|
|
3
|
+
|
|
4
|
+
})();
|
|
5
|
+
|
|
6
|
+
// if in a commonjs system already (node etc), exports become our opal
|
|
7
|
+
// object. Otherwise, in the browser, we just get a top level opal var
|
|
8
|
+
if ((typeof require !== 'undefined') && (typeof module !== 'undefined')) {
|
|
9
|
+
module.exports = opal;
|
|
10
|
+
}
|
data/runtime/pre.js
ADDED
data/runtime/runtime.js
ADDED
|
@@ -0,0 +1,351 @@
|
|
|
1
|
+
/**
|
|
2
|
+
All methods and properties available to ruby/js sources at runtime. These
|
|
3
|
+
are kept in their own namespace to keep the opal namespace clean.
|
|
4
|
+
*/
|
|
5
|
+
Op.runtime = {};
|
|
6
|
+
|
|
7
|
+
// for minimizng
|
|
8
|
+
var Rt = Op.runtime;
|
|
9
|
+
Rt.opal = Op;
|
|
10
|
+
|
|
11
|
+
/**
|
|
12
|
+
Opal platform - this is overriden in gem context and nodejs context. These
|
|
13
|
+
are the default values used in the browser, `opal-browser'.
|
|
14
|
+
*/
|
|
15
|
+
Op.platform = {
|
|
16
|
+
platform: "opal",
|
|
17
|
+
engine: "opal-browser",
|
|
18
|
+
version: "1.9.2",
|
|
19
|
+
argv: []
|
|
20
|
+
};
|
|
21
|
+
|
|
22
|
+
/**
|
|
23
|
+
Core runtime classes, objects and literals.
|
|
24
|
+
*/
|
|
25
|
+
var cBasicObject, cObject, cModule, cClass,
|
|
26
|
+
mKernel, cNilClass, cTrueClass, cFalseClass,
|
|
27
|
+
cArray,
|
|
28
|
+
cRegexp, cMatch, top_self, Qnil,
|
|
29
|
+
Qfalse, Qtrue,
|
|
30
|
+
|
|
31
|
+
cDir;
|
|
32
|
+
|
|
33
|
+
/**
|
|
34
|
+
Core object type flags. Added as local variables, and onto runtime.
|
|
35
|
+
*/
|
|
36
|
+
var T_CLASS = Rt.T_CLASS = 1,
|
|
37
|
+
T_MODULE = Rt.T_MODULE = 2,
|
|
38
|
+
T_OBJECT = Rt.T_OBJECT = 4,
|
|
39
|
+
T_BOOLEAN = Rt.T_BOOLEAN = 8,
|
|
40
|
+
T_STRING = Rt.T_STRING = 16,
|
|
41
|
+
T_ARRAY = Rt.T_ARRAY = 32,
|
|
42
|
+
T_NUMBER = Rt.T_NUMBER = 64,
|
|
43
|
+
T_PROC = Rt.T_PROC = 128,
|
|
44
|
+
T_SYMBOL = Rt.T_SYMBOL = 256,
|
|
45
|
+
T_HASH = Rt.T_HASH = 512,
|
|
46
|
+
T_RANGE = Rt.T_RANGE = 1024,
|
|
47
|
+
T_ICLASS = Rt.T_ICLASS = 2056,
|
|
48
|
+
FL_SINGLETON = Rt.FL_SINGLETON = 4112;
|
|
49
|
+
|
|
50
|
+
/**
|
|
51
|
+
Method visibility modes
|
|
52
|
+
*/
|
|
53
|
+
var FL_PUBLIC = 0,
|
|
54
|
+
FL_PRIVATE = 1;
|
|
55
|
+
|
|
56
|
+
/**
|
|
57
|
+
Define classes. This is the public API for defining classes, shift classes
|
|
58
|
+
and modules.
|
|
59
|
+
|
|
60
|
+
@param {RubyObject} base
|
|
61
|
+
@param {RClass} super_class
|
|
62
|
+
@param {String} id
|
|
63
|
+
@param {Function} body
|
|
64
|
+
@param {Number} flag
|
|
65
|
+
*/
|
|
66
|
+
Rt.dc = function(base, super_class, id, body, flag) {
|
|
67
|
+
var klass;
|
|
68
|
+
|
|
69
|
+
switch (flag) {
|
|
70
|
+
case 0:
|
|
71
|
+
if (base.$flags & T_OBJECT) {
|
|
72
|
+
base = class_real(base.$klass);
|
|
73
|
+
}
|
|
74
|
+
|
|
75
|
+
if (super_class == Qnil) {
|
|
76
|
+
super_class = cObject;
|
|
77
|
+
}
|
|
78
|
+
|
|
79
|
+
klass = define_class_under(base, id, super_class);
|
|
80
|
+
break;
|
|
81
|
+
|
|
82
|
+
case 1:
|
|
83
|
+
klass = singleton_class(base);
|
|
84
|
+
break;
|
|
85
|
+
|
|
86
|
+
case 2:
|
|
87
|
+
if (base.$flags & T_OBJECT) {
|
|
88
|
+
base = class_real(base.$klass);
|
|
89
|
+
}
|
|
90
|
+
klass = define_module_under(base, id);
|
|
91
|
+
break;
|
|
92
|
+
|
|
93
|
+
default:
|
|
94
|
+
raise(eException, "define_class got a unknown flag " + flag);
|
|
95
|
+
}
|
|
96
|
+
|
|
97
|
+
// when reopening a class always set it back to public
|
|
98
|
+
klass.$mode = FL_PUBLIC;
|
|
99
|
+
|
|
100
|
+
var res = body(klass);
|
|
101
|
+
|
|
102
|
+
return res;
|
|
103
|
+
};
|
|
104
|
+
|
|
105
|
+
/**
|
|
106
|
+
Regexp object. This holds the results of last regexp match.
|
|
107
|
+
X for regeXp.
|
|
108
|
+
*/
|
|
109
|
+
Rt.X = null;
|
|
110
|
+
|
|
111
|
+
/**
|
|
112
|
+
Undefine methods
|
|
113
|
+
*/
|
|
114
|
+
Rt.um = function(kls) {
|
|
115
|
+
var args = [].slice.call(arguments, 1);
|
|
116
|
+
|
|
117
|
+
for (var i = 0, ii = args.length; i < ii; i++) {
|
|
118
|
+
(function(mid) {
|
|
119
|
+
var func = function() {
|
|
120
|
+
raise(eNoMethodError, "undefined method `" + mid + "' for " + this.m$inspect());
|
|
121
|
+
};
|
|
122
|
+
|
|
123
|
+
kls.allocator.prototype['m$' + mid] = func;
|
|
124
|
+
|
|
125
|
+
if (kls.$bridge_prototype) {
|
|
126
|
+
kls.$bridge_prototype['m$' + mid] = func;
|
|
127
|
+
}
|
|
128
|
+
})(args[i].m$to_s());
|
|
129
|
+
}
|
|
130
|
+
|
|
131
|
+
return Qnil;
|
|
132
|
+
};
|
|
133
|
+
|
|
134
|
+
/**
|
|
135
|
+
Method missing support - used in debug mode (opt in).
|
|
136
|
+
*/
|
|
137
|
+
Rt.mm = function(method_ids) {
|
|
138
|
+
var prototype = cBasicObject.$m_tbl;
|
|
139
|
+
|
|
140
|
+
for (var i = 0, ii = method_ids.length; i < ii; i++) {
|
|
141
|
+
var mid = method_ids[i];
|
|
142
|
+
|
|
143
|
+
if (!prototype[mid]) {
|
|
144
|
+
var imp = (function(mid, method_id) {
|
|
145
|
+
return function(self) {
|
|
146
|
+
var args = [].slice.call(arguments, 0);
|
|
147
|
+
args.unshift(intern(method_id));
|
|
148
|
+
args.unshift(self);
|
|
149
|
+
return self.$m.method_missing.apply(null, args);
|
|
150
|
+
};
|
|
151
|
+
})(mid, method_ids[i]);
|
|
152
|
+
|
|
153
|
+
imp.$rbMM = true;
|
|
154
|
+
|
|
155
|
+
prototype[mid] = prototype['$' + mid] = imp;
|
|
156
|
+
}
|
|
157
|
+
}
|
|
158
|
+
};
|
|
159
|
+
|
|
160
|
+
/**
|
|
161
|
+
Define methods. Public method for defining a method on the given base.
|
|
162
|
+
|
|
163
|
+
@param {Object} klass The base to define method on
|
|
164
|
+
@param {String} name Ruby mid
|
|
165
|
+
@param {Function} public_body The method implementation
|
|
166
|
+
@param {Number} arity Method arity
|
|
167
|
+
@return {Qnil}
|
|
168
|
+
*/
|
|
169
|
+
Rt.dm = function(klass, name, public_body, arity) {
|
|
170
|
+
if (klass.$flags & T_OBJECT) {
|
|
171
|
+
klass = klass.$klass;
|
|
172
|
+
}
|
|
173
|
+
|
|
174
|
+
var mode = klass.$mode;
|
|
175
|
+
var private_body = public_body;
|
|
176
|
+
|
|
177
|
+
if (mode == FL_PRIVATE) {
|
|
178
|
+
public_body = function() {
|
|
179
|
+
raise(eNoMethodError, "private method `" + name +
|
|
180
|
+
"' called for " + this.$m$inspect());
|
|
181
|
+
};
|
|
182
|
+
public_body.$arity = -1;
|
|
183
|
+
}
|
|
184
|
+
|
|
185
|
+
if (!private_body.$rbName) {
|
|
186
|
+
private_body.$rbName = name;
|
|
187
|
+
private_body.$rbArity = arity;
|
|
188
|
+
}
|
|
189
|
+
|
|
190
|
+
// FIXME: add to private/public methods
|
|
191
|
+
// klass.$methods.push(intern(name));
|
|
192
|
+
define_raw_method(klass, name, private_body, public_body);
|
|
193
|
+
|
|
194
|
+
return Qnil;
|
|
195
|
+
};
|
|
196
|
+
|
|
197
|
+
/**
|
|
198
|
+
Define singleton method.
|
|
199
|
+
|
|
200
|
+
@param {Object} base The base to define method on
|
|
201
|
+
@param {String} method_id Method id
|
|
202
|
+
@param {Function} body Method implementation
|
|
203
|
+
@param {Number} arity Method arity
|
|
204
|
+
@return {Qnil}
|
|
205
|
+
*/
|
|
206
|
+
Rt.ds = function(base, method_id, body, arity) {
|
|
207
|
+
return Rt.dm(singleton_class(base), method_id, body);
|
|
208
|
+
};
|
|
209
|
+
|
|
210
|
+
/**
|
|
211
|
+
Call a super method.
|
|
212
|
+
|
|
213
|
+
callee is the function that actually called super(). We use this to find
|
|
214
|
+
the right place in the tree to find the method that actually called super.
|
|
215
|
+
This is actually done in super_find.
|
|
216
|
+
*/
|
|
217
|
+
Rt.S = function(callee, self, args) {
|
|
218
|
+
var mid = callee.$rbName;
|
|
219
|
+
var func = super_find(self.$klass, callee, mid);
|
|
220
|
+
|
|
221
|
+
if (!func) {
|
|
222
|
+
raise(eNoMethodError, "super: no super class method `" + mid + "`" +
|
|
223
|
+
" for " + self.m$inspect());
|
|
224
|
+
}
|
|
225
|
+
|
|
226
|
+
var args_to_send = [self].concat(args);
|
|
227
|
+
return func.apply(self, args_to_send);
|
|
228
|
+
};
|
|
229
|
+
|
|
230
|
+
/**
|
|
231
|
+
Actually find super impl to call. Returns null if cannot find it.
|
|
232
|
+
*/
|
|
233
|
+
function super_find(klass, callee, mid) {
|
|
234
|
+
var cur_method;
|
|
235
|
+
|
|
236
|
+
while (klass) {
|
|
237
|
+
if (klass.$m_tbl[mid]) {
|
|
238
|
+
if (klass.$m_tbl[mid] == callee) {
|
|
239
|
+
cur_method = klass.$m_tbl[mid];
|
|
240
|
+
break;
|
|
241
|
+
}
|
|
242
|
+
}
|
|
243
|
+
klass = klass.$super;
|
|
244
|
+
}
|
|
245
|
+
|
|
246
|
+
if (!(klass && cur_method)) { return null; }
|
|
247
|
+
|
|
248
|
+
klass = klass.$super;
|
|
249
|
+
|
|
250
|
+
while (klass) {
|
|
251
|
+
if (klass.$m_tbl[mid]) {
|
|
252
|
+
return klass.$m_tbl[mid];
|
|
253
|
+
}
|
|
254
|
+
|
|
255
|
+
klass = klass.$super;
|
|
256
|
+
}
|
|
257
|
+
|
|
258
|
+
return null;
|
|
259
|
+
};
|
|
260
|
+
|
|
261
|
+
/**
|
|
262
|
+
Exception classes. Some of these are used by runtime so they are here for
|
|
263
|
+
convenience.
|
|
264
|
+
*/
|
|
265
|
+
var eException, eStandardError, eLocalJumpError, eNameError,
|
|
266
|
+
eNoMethodError, eArgError, eScriptError, eLoadError,
|
|
267
|
+
eRuntimeError, eTypeError, eIndexError, eKeyError,
|
|
268
|
+
eRangeError;
|
|
269
|
+
|
|
270
|
+
var eExceptionInstance;
|
|
271
|
+
|
|
272
|
+
/**
|
|
273
|
+
Standard jump exceptions to save re-creating them everytime they are needed
|
|
274
|
+
*/
|
|
275
|
+
var eReturnInstance,
|
|
276
|
+
eBreakInstance,
|
|
277
|
+
eNextInstance;
|
|
278
|
+
|
|
279
|
+
/**
|
|
280
|
+
Ruby break statement with the given value. When no break value is needed, nil
|
|
281
|
+
should be passed here. An undefined/null value is not valid and will cause an
|
|
282
|
+
internal error.
|
|
283
|
+
|
|
284
|
+
@param {RubyObject} value The break value.
|
|
285
|
+
*/
|
|
286
|
+
Rt.B = function(value) {
|
|
287
|
+
eBreakInstance.$value = value;
|
|
288
|
+
raise_exc(eBreakInstance);
|
|
289
|
+
};
|
|
290
|
+
|
|
291
|
+
/**
|
|
292
|
+
Ruby return, with the given value. The func is the reference function which
|
|
293
|
+
represents the method that this statement must return from.
|
|
294
|
+
*/
|
|
295
|
+
Rt.R = function(value, func) {
|
|
296
|
+
eReturnInstance.$value = value;
|
|
297
|
+
eReturnInstance.$func = func;
|
|
298
|
+
throw eReturnInstance;
|
|
299
|
+
};
|
|
300
|
+
|
|
301
|
+
/**
|
|
302
|
+
Get the given constant name from the given base
|
|
303
|
+
*/
|
|
304
|
+
Rt.cg = function(base, id) {
|
|
305
|
+
if (base.$flags & T_OBJECT) {
|
|
306
|
+
base = class_real(base.$klass);
|
|
307
|
+
}
|
|
308
|
+
return const_get(base, id);
|
|
309
|
+
};
|
|
310
|
+
|
|
311
|
+
/**
|
|
312
|
+
Set constant from runtime
|
|
313
|
+
*/
|
|
314
|
+
Rt.cs = function(base, id, val) {
|
|
315
|
+
if (base.$flags & T_OBJECT) {
|
|
316
|
+
base = class_real(base.$klass);
|
|
317
|
+
}
|
|
318
|
+
return const_set(base, id, val);
|
|
319
|
+
};
|
|
320
|
+
|
|
321
|
+
/**
|
|
322
|
+
Get global by id
|
|
323
|
+
*/
|
|
324
|
+
Rt.gg = function(id) {
|
|
325
|
+
return gvar_get(id);
|
|
326
|
+
};
|
|
327
|
+
|
|
328
|
+
/**
|
|
329
|
+
Set global by id
|
|
330
|
+
*/
|
|
331
|
+
Rt.gs = function(id, value) {
|
|
332
|
+
return gvar_set(id, value);
|
|
333
|
+
};
|
|
334
|
+
|
|
335
|
+
function regexp_match_getter(id) {
|
|
336
|
+
var matched = Rt.X;
|
|
337
|
+
|
|
338
|
+
if (matched) {
|
|
339
|
+
if (matched.$md) {
|
|
340
|
+
return matched.$md;
|
|
341
|
+
} else {
|
|
342
|
+
var res = new cMatch.allocator();
|
|
343
|
+
res.$data = matched;
|
|
344
|
+
matched.$md = res;
|
|
345
|
+
return res;
|
|
346
|
+
}
|
|
347
|
+
} else {
|
|
348
|
+
return Qnil;
|
|
349
|
+
}
|
|
350
|
+
}
|
|
351
|
+
|
metadata
CHANGED
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
name: opal
|
|
3
3
|
version: !ruby/object:Gem::Version
|
|
4
4
|
prerelease:
|
|
5
|
-
version: 0.3.
|
|
5
|
+
version: 0.3.6
|
|
6
6
|
platform: ruby
|
|
7
7
|
authors:
|
|
8
8
|
- Adam Beynon
|
|
@@ -10,11 +10,11 @@ autorequire:
|
|
|
10
10
|
bindir: bin
|
|
11
11
|
cert_chain: []
|
|
12
12
|
|
|
13
|
-
date: 2011-
|
|
13
|
+
date: 2011-07-07 00:00:00 +01:00
|
|
14
14
|
default_executable:
|
|
15
15
|
dependencies: []
|
|
16
16
|
|
|
17
|
-
description:
|
|
17
|
+
description:
|
|
18
18
|
email:
|
|
19
19
|
- adam@adambeynon.com
|
|
20
20
|
executables:
|
|
@@ -24,185 +24,98 @@ extensions: []
|
|
|
24
24
|
extra_rdoc_files: []
|
|
25
25
|
|
|
26
26
|
files:
|
|
27
|
-
- .gitignore
|
|
28
|
-
- Changelog
|
|
29
|
-
- LICENSE
|
|
30
|
-
- README.md
|
|
31
|
-
- Rakefile
|
|
32
27
|
- bin/opal
|
|
33
|
-
-
|
|
34
|
-
-
|
|
35
|
-
-
|
|
36
|
-
-
|
|
37
|
-
-
|
|
38
|
-
-
|
|
39
|
-
-
|
|
40
|
-
-
|
|
41
|
-
-
|
|
42
|
-
-
|
|
43
|
-
-
|
|
44
|
-
-
|
|
45
|
-
-
|
|
46
|
-
-
|
|
47
|
-
-
|
|
48
|
-
-
|
|
49
|
-
-
|
|
50
|
-
-
|
|
51
|
-
-
|
|
52
|
-
-
|
|
53
|
-
-
|
|
54
|
-
-
|
|
55
|
-
-
|
|
56
|
-
-
|
|
57
|
-
-
|
|
58
|
-
-
|
|
59
|
-
-
|
|
60
|
-
-
|
|
61
|
-
-
|
|
62
|
-
-
|
|
63
|
-
-
|
|
64
|
-
-
|
|
65
|
-
-
|
|
66
|
-
-
|
|
67
|
-
-
|
|
68
|
-
-
|
|
69
|
-
-
|
|
70
|
-
-
|
|
71
|
-
-
|
|
72
|
-
-
|
|
73
|
-
-
|
|
74
|
-
-
|
|
75
|
-
-
|
|
76
|
-
-
|
|
77
|
-
-
|
|
78
|
-
-
|
|
79
|
-
-
|
|
80
|
-
-
|
|
81
|
-
-
|
|
82
|
-
-
|
|
83
|
-
-
|
|
84
|
-
-
|
|
85
|
-
-
|
|
86
|
-
-
|
|
87
|
-
-
|
|
88
|
-
-
|
|
89
|
-
-
|
|
90
|
-
-
|
|
91
|
-
-
|
|
92
|
-
-
|
|
93
|
-
-
|
|
94
|
-
-
|
|
95
|
-
-
|
|
96
|
-
-
|
|
97
|
-
-
|
|
98
|
-
-
|
|
99
|
-
-
|
|
100
|
-
-
|
|
101
|
-
-
|
|
102
|
-
-
|
|
103
|
-
-
|
|
104
|
-
-
|
|
105
|
-
-
|
|
106
|
-
-
|
|
107
|
-
-
|
|
108
|
-
-
|
|
109
|
-
-
|
|
110
|
-
-
|
|
111
|
-
-
|
|
112
|
-
-
|
|
113
|
-
-
|
|
114
|
-
-
|
|
115
|
-
- gems/core/spec/language/return_spec.rb
|
|
116
|
-
- gems/core/spec/language/string_spec.rb
|
|
117
|
-
- gems/core/spec/language/super_spec.rb
|
|
118
|
-
- gems/core/spec/language/until_spec.rb
|
|
119
|
-
- gems/core/spec/language/variables_spec.rb
|
|
120
|
-
- gems/core/spec/language/while_spec.rb
|
|
121
|
-
- gems/core/spec/spec_helper.rb
|
|
122
|
-
- gems/core_fs/README.md
|
|
123
|
-
- gems/dev/Rakefile
|
|
124
|
-
- gems/dev/lib/dev.js
|
|
125
|
-
- gems/dev/lib/dev/generator.js
|
|
126
|
-
- gems/dev/lib/dev/parser.js
|
|
127
|
-
- gems/dev/lib/dev/ruby_parser.js
|
|
128
|
-
- gems/dev/lib/dev/ruby_parser.y
|
|
129
|
-
- gems/dev/lib/dev/string_scanner.js
|
|
130
|
-
- gems/dev/tools/racc2js/README.md
|
|
131
|
-
- gems/dev/tools/racc2js/math_parser.js
|
|
132
|
-
- gems/dev/tools/racc2js/math_parser.rb
|
|
133
|
-
- gems/dev/tools/racc2js/math_parser.y
|
|
134
|
-
- gems/dev/tools/racc2js/parser.js
|
|
135
|
-
- gems/dev/tools/racc2js/racc2js.rb
|
|
136
|
-
- gems/json/README.md
|
|
137
|
-
- gems/json/json.gemspec
|
|
138
|
-
- gems/json/lib/json.rb
|
|
139
|
-
- gems/json/lib/json/ext.rb
|
|
140
|
-
- gems/json/lib/json/json2.js
|
|
141
|
-
- gems/ospec/README.md
|
|
142
|
-
- gems/ospec/lib/ospec.rb
|
|
143
|
-
- gems/ospec/lib/ospec/autorun.rb
|
|
144
|
-
- gems/ospec/lib/ospec/dsl.rb
|
|
145
|
-
- gems/ospec/lib/ospec/example.rb
|
|
146
|
-
- gems/ospec/lib/ospec/example/before_and_after_hooks.rb
|
|
147
|
-
- gems/ospec/lib/ospec/example/errors.rb
|
|
148
|
-
- gems/ospec/lib/ospec/example/example_group.rb
|
|
149
|
-
- gems/ospec/lib/ospec/example/example_group_factory.rb
|
|
150
|
-
- gems/ospec/lib/ospec/example/example_group_hierarchy.rb
|
|
151
|
-
- gems/ospec/lib/ospec/example/example_group_methods.rb
|
|
152
|
-
- gems/ospec/lib/ospec/example/example_group_proxy.rb
|
|
153
|
-
- gems/ospec/lib/ospec/example/example_methods.rb
|
|
154
|
-
- gems/ospec/lib/ospec/example/example_proxy.rb
|
|
155
|
-
- gems/ospec/lib/ospec/expectations.rb
|
|
156
|
-
- gems/ospec/lib/ospec/expectations/errors.rb
|
|
157
|
-
- gems/ospec/lib/ospec/expectations/fail_with.rb
|
|
158
|
-
- gems/ospec/lib/ospec/expectations/handler.rb
|
|
159
|
-
- gems/ospec/lib/ospec/matchers.rb
|
|
160
|
-
- gems/ospec/lib/ospec/matchers/be.rb
|
|
161
|
-
- gems/ospec/lib/ospec/matchers/generated_descriptions.rb
|
|
162
|
-
- gems/ospec/lib/ospec/matchers/operator_matcher.rb
|
|
163
|
-
- gems/ospec/lib/ospec/runner.rb
|
|
164
|
-
- gems/ospec/lib/ospec/runner/example_group_runner.rb
|
|
165
|
-
- gems/ospec/lib/ospec/runner/formatter/html_formatter.rb
|
|
166
|
-
- gems/ospec/lib/ospec/runner/formatter/terminal_formatter.rb
|
|
167
|
-
- gems/ospec/lib/ospec/runner/options.rb
|
|
168
|
-
- gems/ospec/lib/ospec/runner/reporter.rb
|
|
169
|
-
- gems/ospec/ospec.gemspec
|
|
170
|
-
- gems/rquery/README.md
|
|
171
|
-
- gems/rquery/lib/rquery.rb
|
|
172
|
-
- gems/rquery/lib/rquery/ajax.rb
|
|
173
|
-
- gems/rquery/lib/rquery/css.rb
|
|
174
|
-
- gems/rquery/lib/rquery/document.rb
|
|
175
|
-
- gems/rquery/lib/rquery/element.rb
|
|
176
|
-
- gems/rquery/lib/rquery/event.rb
|
|
177
|
-
- gems/rquery/lib/rquery/jquery.js
|
|
178
|
-
- gems/rquery/lib/rquery/request.rb
|
|
179
|
-
- gems/rquery/lib/rquery/response.rb
|
|
180
|
-
- gems/rquery/rquery.gemspec
|
|
181
|
-
- lib/opal.js
|
|
182
|
-
- lib/opal.rb
|
|
183
|
-
- lib/opal/builder.rb
|
|
184
|
-
- lib/opal/bundle.rb
|
|
185
|
-
- lib/opal/command.rb
|
|
186
|
-
- lib/opal/context.rb
|
|
187
|
-
- lib/opal/context/console.rb
|
|
188
|
-
- lib/opal/context/file_system.rb
|
|
189
|
-
- lib/opal/context/loader.rb
|
|
190
|
-
- lib/opal/gem.rb
|
|
191
|
-
- lib/opal/rake/builder_task.rb
|
|
192
|
-
- lib/opal/ruby/nodes.rb
|
|
193
|
-
- lib/opal/ruby/parser.rb
|
|
194
|
-
- lib/opal/ruby/ruby_parser.rb
|
|
195
|
-
- lib/opal/ruby/ruby_parser.y
|
|
196
|
-
- opal.gemspec
|
|
28
|
+
- lib/core/array.rb
|
|
29
|
+
- lib/core/basic_object.rb
|
|
30
|
+
- lib/core/class.rb
|
|
31
|
+
- lib/core/dir.rb
|
|
32
|
+
- lib/core/enumerable.rb
|
|
33
|
+
- lib/core/error.rb
|
|
34
|
+
- lib/core/false_class.rb
|
|
35
|
+
- lib/core/file.rb
|
|
36
|
+
- lib/core/hash.rb
|
|
37
|
+
- lib/core/kernel.rb
|
|
38
|
+
- lib/core/match_data.rb
|
|
39
|
+
- lib/core/module.rb
|
|
40
|
+
- lib/core/nil_class.rb
|
|
41
|
+
- lib/core/numeric.rb
|
|
42
|
+
- lib/core/object.rb
|
|
43
|
+
- lib/core/proc.rb
|
|
44
|
+
- lib/core/range.rb
|
|
45
|
+
- lib/core/regexp.rb
|
|
46
|
+
- lib/core/string.rb
|
|
47
|
+
- lib/core/symbol.rb
|
|
48
|
+
- lib/core/top_self.rb
|
|
49
|
+
- lib/core/true_class.rb
|
|
50
|
+
- lib/core.rb
|
|
51
|
+
- lib/dev.rb
|
|
52
|
+
- lib/ospec/autorun.rb
|
|
53
|
+
- lib/ospec/dsl.rb
|
|
54
|
+
- lib/ospec/example/before_and_after_hooks.rb
|
|
55
|
+
- lib/ospec/example/errors.rb
|
|
56
|
+
- lib/ospec/example/example_group.rb
|
|
57
|
+
- lib/ospec/example/example_group_factory.rb
|
|
58
|
+
- lib/ospec/example/example_group_hierarchy.rb
|
|
59
|
+
- lib/ospec/example/example_group_methods.rb
|
|
60
|
+
- lib/ospec/example/example_group_proxy.rb
|
|
61
|
+
- lib/ospec/example/example_methods.rb
|
|
62
|
+
- lib/ospec/example/example_proxy.rb
|
|
63
|
+
- lib/ospec/example.rb
|
|
64
|
+
- lib/ospec/expectations/errors.rb
|
|
65
|
+
- lib/ospec/expectations/fail_with.rb
|
|
66
|
+
- lib/ospec/expectations/handler.rb
|
|
67
|
+
- lib/ospec/expectations.rb
|
|
68
|
+
- lib/ospec/helpers/scratch.rb
|
|
69
|
+
- lib/ospec/matchers/be.rb
|
|
70
|
+
- lib/ospec/matchers/generated_descriptions.rb
|
|
71
|
+
- lib/ospec/matchers/operator_matcher.rb
|
|
72
|
+
- lib/ospec/matchers/raise_error.rb
|
|
73
|
+
- lib/ospec/matchers.rb
|
|
74
|
+
- lib/ospec/runner/example_group_runner.rb
|
|
75
|
+
- lib/ospec/runner/formatter/html_formatter.rb
|
|
76
|
+
- lib/ospec/runner/formatter/terminal_formatter.rb
|
|
77
|
+
- lib/ospec/runner/options.rb
|
|
78
|
+
- lib/ospec/runner/reporter.rb
|
|
79
|
+
- lib/ospec/runner.rb
|
|
80
|
+
- lib/ospec.rb
|
|
81
|
+
- lib/racc/parser.rb
|
|
82
|
+
- lib/strscan.rb
|
|
83
|
+
- opal_lib/opal/build_methods.rb
|
|
84
|
+
- opal_lib/opal/builder.rb
|
|
85
|
+
- opal_lib/opal/bundle.rb
|
|
86
|
+
- opal_lib/opal/command.rb
|
|
87
|
+
- opal_lib/opal/context/console.rb
|
|
88
|
+
- opal_lib/opal/context/file_system.rb
|
|
89
|
+
- opal_lib/opal/context/loader.rb
|
|
90
|
+
- opal_lib/opal/context.rb
|
|
91
|
+
- opal_lib/opal/gem.rb
|
|
92
|
+
- opal_lib/opal/rake/builder_task.rb
|
|
93
|
+
- opal_lib/opal/rake/spec_task.rb
|
|
94
|
+
- opal_lib/opal/ruby/nodes.rb
|
|
95
|
+
- opal_lib/opal/ruby/parser.rb
|
|
96
|
+
- opal_lib/opal/ruby/ruby_parser.rb
|
|
97
|
+
- opal_lib/opal/ruby/ruby_parser.y
|
|
98
|
+
- opal_lib/opal/version.rb
|
|
99
|
+
- opal_lib/opal.rb
|
|
100
|
+
- runtime/class.js
|
|
101
|
+
- runtime/debug.js
|
|
102
|
+
- runtime/fs.js
|
|
103
|
+
- runtime/init.js
|
|
104
|
+
- runtime/loader.js
|
|
105
|
+
- runtime/module.js
|
|
106
|
+
- runtime/post.js
|
|
107
|
+
- runtime/pre.js
|
|
108
|
+
- runtime/runtime.js
|
|
109
|
+
- README.md
|
|
197
110
|
has_rdoc: true
|
|
198
|
-
homepage: http://
|
|
111
|
+
homepage: http://opalscript.org
|
|
199
112
|
licenses: []
|
|
200
113
|
|
|
201
114
|
post_install_message:
|
|
202
115
|
rdoc_options: []
|
|
203
116
|
|
|
204
117
|
require_paths:
|
|
205
|
-
-
|
|
118
|
+
- opal_lib
|
|
206
119
|
required_ruby_version: !ruby/object:Gem::Requirement
|
|
207
120
|
none: false
|
|
208
121
|
requirements:
|
|
@@ -221,6 +134,6 @@ rubyforge_project:
|
|
|
221
134
|
rubygems_version: 1.6.2
|
|
222
135
|
signing_key:
|
|
223
136
|
specification_version: 3
|
|
224
|
-
summary: Ruby
|
|
137
|
+
summary: Ruby runtime and core library for javascript
|
|
225
138
|
test_files: []
|
|
226
139
|
|