opal 0.7.0.beta3 → 0.7.0.rc1

Sign up to get free protection for your applications and to get access to all the features.
Files changed (94) hide show
  1. checksums.yaml +4 -4
  2. data/.gitmodules +4 -0
  3. data/.travis.yml +7 -3
  4. data/.yardopts +6 -0
  5. data/CHANGELOG.md +28 -0
  6. data/Gemfile +1 -1
  7. data/README.md +3 -12
  8. data/Rakefile +4 -150
  9. data/bin/opal-mspec +1 -1
  10. data/docs/compiler_directives.md +127 -0
  11. data/examples/rack/.gitignore +1 -0
  12. data/examples/rack/app/user.rb +1 -0
  13. data/lib/mspec/opal/special_calls.rb +15 -2
  14. data/lib/opal/builder.rb +15 -8
  15. data/lib/opal/compiler.rb +75 -4
  16. data/lib/opal/erb.rb +22 -2
  17. data/lib/opal/fragment.rb +17 -5
  18. data/lib/opal/nodes/def.rb +174 -53
  19. data/lib/opal/nodes/if.rb +14 -0
  20. data/lib/opal/nodes/module.rb +0 -1
  21. data/lib/opal/nodes/rescue.rb +10 -2
  22. data/lib/opal/nodes/scope.rb +0 -17
  23. data/lib/opal/parser.rb +83 -19
  24. data/lib/opal/parser/grammar.rb +2511 -2414
  25. data/lib/opal/parser/grammar.y +71 -9
  26. data/lib/opal/parser/lexer.rb +44 -12
  27. data/lib/opal/parser/parser_scope.rb +3 -0
  28. data/lib/opal/parser/sexp.rb +7 -1
  29. data/lib/opal/paths.rb +5 -5
  30. data/lib/opal/sprockets/environment.rb +2 -10
  31. data/lib/opal/sprockets/path_reader.rb +1 -1
  32. data/lib/opal/sprockets/processor.rb +1 -0
  33. data/lib/opal/sprockets/server.rb +2 -0
  34. data/lib/opal/util.rb +7 -2
  35. data/lib/opal/version.rb +1 -1
  36. data/opal.gemspec +1 -0
  37. data/opal/README.md +1 -1
  38. data/opal/corelib/dir.rb +1 -1
  39. data/opal/corelib/enumerable.rb +3 -1
  40. data/opal/corelib/error.rb +3 -0
  41. data/opal/corelib/file.rb +2 -0
  42. data/opal/corelib/hash.rb +3 -0
  43. data/opal/corelib/io.rb +15 -1
  44. data/opal/corelib/kernel.rb +8 -0
  45. data/opal/corelib/module.rb +42 -17
  46. data/opal/corelib/runtime.js +223 -49
  47. data/opal/corelib/string.rb +1 -1
  48. data/opal/corelib/struct.rb +1 -7
  49. data/spec/README.md +8 -0
  50. data/spec/filters/bugs/language.rb +1 -0
  51. data/spec/filters/bugs/module.rb +4 -0
  52. data/spec/filters/unsupported/frozen.rb +2 -0
  53. data/spec/lib/compiler/pre_processed_conditionals_spec.rb +87 -0
  54. data/spec/lib/compiler_spec.rb +1 -67
  55. data/spec/lib/fixtures/file_with_directives.js +2 -0
  56. data/spec/lib/fixtures/required_file.js +1 -0
  57. data/spec/lib/parser/def_spec.rb +29 -16
  58. data/spec/lib/parser/variables_spec.rb +5 -5
  59. data/spec/lib/sprockets/path_reader_spec.rb +24 -8
  60. data/spec/lib/sprockets/server_spec.rb +10 -3
  61. data/spec/opal/core/date_spec.rb +14 -0
  62. data/spec/opal/core/language/versions/def_2_0_spec.rb +62 -0
  63. data/spec/opal/core/language_spec.rb +23 -0
  64. data/spec/opal/core/runtime/donate_spec.rb +53 -0
  65. data/spec/opal/stdlib/native/native_alias_spec.rb +19 -0
  66. data/spec/opal/stdlib/native/native_class_spec.rb +18 -0
  67. data/spec/opal/stdlib/native/native_module_spec.rb +13 -0
  68. data/spec/rubyspecs +2 -0
  69. data/stdlib/buffer.rb +1 -0
  70. data/stdlib/date.rb +18 -0
  71. data/stdlib/encoding.rb +3 -2
  72. data/stdlib/minitest.rb +780 -0
  73. data/stdlib/minitest/assertions.rb +662 -0
  74. data/stdlib/minitest/autorun.rb +12 -0
  75. data/stdlib/minitest/benchmark.rb +426 -0
  76. data/stdlib/minitest/expectations.rb +281 -0
  77. data/stdlib/minitest/hell.rb +11 -0
  78. data/stdlib/minitest/mock.rb +220 -0
  79. data/stdlib/minitest/parallel.rb +65 -0
  80. data/stdlib/minitest/pride.rb +4 -0
  81. data/stdlib/minitest/pride_plugin.rb +142 -0
  82. data/stdlib/minitest/spec.rb +310 -0
  83. data/stdlib/minitest/test.rb +293 -0
  84. data/stdlib/minitest/unit.rb +45 -0
  85. data/stdlib/native.rb +12 -3
  86. data/stdlib/nodejs/process.rb +16 -2
  87. data/stdlib/promise.rb +99 -0
  88. data/stdlib/test/unit.rb +10 -0
  89. data/stdlib/thread.rb +4 -0
  90. data/tasks/building.rake +58 -0
  91. data/tasks/documentation.rake +38 -0
  92. data/tasks/documenting.rake +37 -0
  93. data/tasks/testing.rake +102 -0
  94. metadata +57 -2
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 56f72a2aa585530e324d1024147329f90ac699ef
4
- data.tar.gz: a75ca4d5fc0abc995d98d6e9884286986fe54666
3
+ metadata.gz: 92e17e48bf5a163e7dae89bb90448a82ec66baa1
4
+ data.tar.gz: 313106590cfd949c9810a5866b1866e20de0b3cd
5
5
  SHA512:
6
- metadata.gz: 2dd0158e79a73ea54fed5a02fe222606b8a4d45198c1338f3c17f902a30e37e19da3d8347d82256a2f8e70faeb31c04a6076bc16a630662c93d9c0d52b657cd7
7
- data.tar.gz: f59534fa214044c4cb01096f722745db095b4c67dc4b1129b5ec70fe24d4e7653729e219847b62445281ca061f905a83a945f917b92825d43c42a1059a4be0d8
6
+ metadata.gz: 40b7b2836d698ab35eff8fb344335d376ccebad0b9c01998cab188ba94e0b4e77d2b9873163fbaa3d19665b916da51ec55ca76ab0d30122e175ed50dd57c1c20
7
+ data.tar.gz: fe4e07293db5de3a1b4441453c9f9288dcfd3db46d71679a7de247ead82fc59661f7a6f1111790f05c952b8be8e503607871330f07b24929609cceb50e49abf5
data/.gitmodules CHANGED
@@ -25,3 +25,7 @@
25
25
  [submodule "spec/stdlib/rubysl-date"]
26
26
  path = spec/stdlib/rubysl-date
27
27
  url = https://github.com/rubysl/rubysl-date
28
+ [submodule "test/cruby"]
29
+ path = test/cruby
30
+ url = https://github.com/ruby/ruby.git
31
+ branch = ruby_2_2
data/.travis.yml CHANGED
@@ -1,5 +1,7 @@
1
1
  language: ruby
2
2
 
3
+ sudo: false
4
+
3
5
  cache:
4
6
  bundler: true
5
7
  directories:
@@ -9,15 +11,17 @@ matrix:
9
11
  fast_finish: true
10
12
 
11
13
  include:
12
- - rvm: 2.1
14
+ - rvm: 2.2
13
15
  env: RUN=default TZ="/usr/share/zoneinfo/Pacific/Fiji"
14
- before_install: test -d node_modules || npm install
16
+
17
+ - rvm: 2.1
18
+ env: RUN=rspec
15
19
 
16
20
  - rvm: 1.9.3
17
21
  env: RUN=rspec
18
22
 
19
23
  - rvm: 2.0.0
20
- env: RUN="rspec mspec"
24
+ env: RUN="rspec mspec_phantom"
21
25
 
22
26
  - rvm: rbx
23
27
  env: RUN=rspec
data/.yardopts ADDED
@@ -0,0 +1,6 @@
1
+ lib/opal.rb
2
+ lib/opal/**/*.rb
3
+ --markup markdown
4
+ -
5
+ CHANGELOG.md
6
+ docs/compiler_directives.md
data/CHANGELOG.md CHANGED
@@ -1,5 +1,33 @@
1
1
  ## edge (upcoming 0.7)
2
2
 
3
+ * `Class#native_class` now also exposes `MyClass.new` (Ruby) as `Opal.global.MyClass.new()` (JS)
4
+
5
+ * Add CRuby (MRI) tests harness to start checking Opal against them too.
6
+
7
+ * Add Minitest to the stdlib.
8
+
9
+ * Add `Date#<=>` with specs.
10
+
11
+ * Show extended info and context upon parsing, compiling and building errors.
12
+
13
+ * Support keyword arguments in method calls and definitions.
14
+
15
+ * Fix `begin`/`rescue` blocks to evaluate to last expression.
16
+
17
+ * Add support for `RUBY_ENGINE/RUBY_PLATFORM != "opal"` pre-processor directives.
18
+
19
+ if RUBY_ENGINE != "opal"
20
+ # this code never compiles
21
+ end
22
+
23
+ * Fix donating methods defined in modules. This ensures that if a class includes more than one module, then the methods defined on the class respect the order in which the modules are included.
24
+
25
+ * Improved support for recursive `Hash` for both `#inspect` and `#hash`.
26
+
27
+ * Optimized `Hash` implementation for `String` and `Symbol`, they have a separate hash-table in which they're used as both keys and hashes.
28
+
29
+ * Added real `#hash` / `eql?` support, previously was relying on `.toString()`.
30
+
3
31
  * `String#to_proc` now uses `__send__` instead of `send` for calling
4
32
  methods on receivers.
5
33
 
data/Gemfile CHANGED
@@ -24,4 +24,4 @@ unless ENV['CI']
24
24
  gem 'terminal-notifier-guard'
25
25
  end
26
26
 
27
- gem 'mspec', github: 'opal/mspec'
27
+ gem 'mspec', github: 'rubyspec/mspec'
data/README.md CHANGED
@@ -27,7 +27,7 @@ See the website, [http://opalrb.org](http://opalrb.org).
27
27
  string of javascript code.
28
28
 
29
29
  ```ruby
30
- Opal.compile("puts 'wow'") # => "(function() { ... })()"
30
+ Opal.compile("puts 'wow'") # => "(function() { ... self.$puts("wow"); ... })()"
31
31
  ```
32
32
 
33
33
  Running this by itself is not enough, you need the opal runtime/corelib.
@@ -116,17 +116,8 @@ javascript.
116
116
 
117
117
  ### stdlib
118
118
 
119
- Holds the stdlib that opal currently supports. This includes Observable,
120
- StringScanner, Date, etc.
121
-
122
- ### spec
123
-
124
- * **rubyspecs** (file) a whitelist of RubySpec files to be ran
125
- * **corelib** RubySpec examples (submodule)
126
- * **stdlib** `rubysl-*` examples (submodules)
127
- * **filters** The list of MSpec/RubySpec examples that are either bugs or unsupported
128
- * **opal** opal additions/special behaviour in the runtime/corelib
129
- * **cli** specs for opal lib (parser, lexer, grammar, compiler etc)
119
+ Holds the stdlib that opal currently supports. This includes `Observable`,
120
+ `StringScanner`, `Date`, etc.
130
121
 
131
122
  ## Browser support
132
123
 
data/Rakefile CHANGED
@@ -6,154 +6,8 @@ Bundler.require
6
6
  Bundler::GemHelper.install_tasks
7
7
 
8
8
  import 'tasks/github.rake'
9
+ import 'tasks/documenting.rake'
10
+ import 'tasks/testing.rake'
11
+ import 'tasks/building.rake'
9
12
 
10
- require 'rspec/core/rake_task'
11
- RSpec::Core::RakeTask.new(:rspec) do |t|
12
- t.pattern = 'spec/lib/**/*_spec.rb'
13
- end
14
-
15
- require 'mspec/opal/rake_task'
16
- MSpec::Opal::RakeTask.new(:mspec) do |config|
17
- config.pattern = ENV['MSPEC_PATTERN'] if ENV['MSPEC_PATTERN']
18
- config.basedir = ENV['MSPEC_BASEDIR'] if ENV['MSPEC_BASEDIR']
19
- end
20
-
21
- task :default => [:rspec, :mspec_node]
22
-
23
-
24
- task :mspec_node do
25
- rubyspecs = File.read('spec/rubyspecs').lines.reject do |l|
26
- l.strip!; l.start_with?('#') || l.empty?
27
- end.flat_map do |path|
28
- path = "spec/#{path}"
29
- File.directory?(path) ? Dir[path+'/*.rb'] : "#{path}.rb"
30
- end
31
-
32
- filters = Dir['spec/filters/**/*.rb']
33
- shared = Dir['spec/{opal,lib/parser}/**/*_spec.rb'] + ['spec/lib/lexer_spec.rb']
34
-
35
- specs = []
36
- add_specs = ->(name, new_specs) { p [new_specs.size, name]; specs + new_specs}
37
-
38
- specs = add_specs.(:filters, filters)
39
- pattern = ENV['PATTERN']
40
- whitelist_pattern = !!ENV['RUBYSPECS']
41
-
42
- if pattern
43
- custom = Dir[pattern]
44
- custom &= rubyspecs if whitelist_pattern
45
- specs = add_specs.(:custom, custom)
46
- else
47
- specs = add_specs.(:shared, shared)
48
- specs = add_specs.(:rubyspecs, rubyspecs)
49
- end
50
-
51
- requires = specs.map{|s| "require '#{s.sub(/^spec\//,'')}'"}
52
- filename = 'tmp/mspec_node.rb'
53
- mkdir_p File.dirname(filename)
54
- File.write filename, <<-RUBY
55
- require 'spec_helper'
56
- #{requires.join(" \n")}
57
- OSpecRunner.main.did_finish
58
- RUBY
59
-
60
- stubs = " -smspec/helpers/tmp -smspec/helpers/environment -smspec/guards/block_device -smspec/guards/endian"
61
-
62
- sh 'RUBYOPT="-rbundler/setup -rmspec/opal/special_calls" '\
63
- "bin/opal -Ispec -Ilib -gmspec #{stubs} -rnodejs -Dwarning -A #{filename}"
64
- end
65
-
66
- require 'opal/version'
67
- desc <<-DESC
68
- Build *corelib* and *stdlib* to "build/"
69
-
70
- You can restrict the file list with the FILES env var (comma separated)
71
- and the destination dir with the DIR env var.
72
-
73
- Example: rake dist DIR=/tmp/foo FILES='opal.rb,base64.rb'
74
- Example: rake dist DIR=cdn/opal/#{Opal::VERSION}
75
- Example: rake dist DIR=cdn/opal/master
76
- DESC
77
- task :dist do
78
- require 'opal/util'
79
- require 'opal/sprockets/environment'
80
-
81
- Opal::Processor.arity_check_enabled = false
82
- Opal::Processor.const_missing_enabled = false
83
- Opal::Processor.dynamic_require_severity = :warning
84
- env = Opal::Environment.new
85
-
86
- build_dir = ENV['DIR'] || 'build'
87
- files = ENV['FILES'] ? ENV['FILES'].split(',') :
88
- Dir['{opal,stdlib}/*.rb'].map { |lib| File.basename(lib, '.rb') }
89
-
90
- Dir.mkdir build_dir unless File.directory? build_dir
91
- width = files.map(&:size).max
92
-
93
- files.each do |lib|
94
- print "* building #{lib}...".ljust(width+'* building ... '.size)
95
- $stdout.flush
96
-
97
- src = env[lib].to_s
98
- min = Opal::Util.uglify src
99
- gzp = Opal::Util.gzip min
100
-
101
- File.open("#{build_dir}/#{lib}.js", 'w+') { |f| f << src }
102
- File.open("#{build_dir}/#{lib}.min.js", 'w+') { |f| f << min } if min
103
- File.open("#{build_dir}/#{lib}.min.js.gz", 'w+') { |f| f << gzp } if gzp
104
-
105
- print "done. ("
106
- print "development: #{('%.2f' % (src.size/1000.0)).rjust(6)}KB"
107
- print ", minified: #{('%.2f' % (min.size/1000.0)).rjust(6)}KB" if min
108
- print ", gzipped: #{('%.2f' % (gzp.size/1000.0)).rjust(6)}KB" if gzp
109
- puts ")."
110
- end
111
- end
112
-
113
- desc 'Rebuild grammar.rb for opal parser'
114
- task :racc do
115
- %x(racc -l lib/opal/parser/grammar.y -o lib/opal/parser/grammar.rb)
116
- end
117
-
118
- desc 'Remove any generated file.'
119
- task :clobber do
120
- rm_r './build'
121
- end
122
-
123
- namespace :doc do
124
- doc_repo = Pathname(ENV['DOC_REPO'] || 'gh-pages')
125
- doc_base = doc_repo.join('doc')
126
- current_git_release = -> { `git rev-parse --abbrev-ref HEAD`.chomp }
127
- template_option = "--template opal --template-path #{doc_repo.join('yard-templates')}"
128
-
129
- directory doc_repo.to_s do
130
- remote = ENV['DOC_REPO_REMOTE'] || '.'
131
- sh 'git', 'clone', '-b', 'gh-pages', '--', remote, doc_repo.to_s
132
- end
133
-
134
- task :corelib => doc_repo.to_s do
135
- git = current_git_release.call
136
- name = 'corelib'
137
- glob = 'opal/**/*.rb'
138
-
139
- command = "doxx --template #{doc_repo.join('doxx-templates/opal.jade')} "\
140
- "--source opal/corelib --target #{doc_base}/#{git}/#{name} "\
141
- "--title \"Opal runtime.js Documentation\" --readme opal/README.md"
142
- puts command; system command or $stderr.puts "Please install doxx with: npm install"
143
-
144
- command = "yard doc #{glob} #{template_option} "\
145
- "--readme opal/README.md -o #{doc_base}/#{git}/#{name}"
146
- puts command; system command
147
- end
148
-
149
- task :stdlib => doc_repo do
150
- git = current_git_release.call
151
- name = 'stdlib'
152
- glob = '{stdlib/**/*,opal/compiler,opal/erb,opal/version}.rb'
153
- command = "yard doc #{glob} #{template_option} "\
154
- "--readme stdlib/README.md -o gh-pages/doc/#{git}/#{name}"
155
- puts command; system command
156
- end
157
- end
158
-
159
- task :doc => ['doc:corelib', 'doc:stdlib']
13
+ task :default => [:rspec, :mspec_node, :cruby_tests]
data/bin/opal-mspec CHANGED
@@ -7,4 +7,4 @@ pattern = %Q{MSPEC_PATTERN="{#{specs.join(',')}}"} if specs.any?
7
7
  command = [pattern, 'rake mspec'].compact.join(' ')
8
8
  exec command
9
9
 
10
- # bundle exec mspec run -t opal -pspec/corelib/spec_helper spec/corelib/core/true/*
10
+ # RUBYOPT="-rbundler/setup -rmspec/opal/special_calls" bundle exec mspec run -t opal -pspec/corelib/spec_helper spec/corelib/core/true/*
@@ -0,0 +1,127 @@
1
+ # @title Compiler Directives
2
+
3
+ # Compiler Directives
4
+
5
+ The Opal compiler supports some special directives that can optimize or
6
+ enhance the output of compiled ruby code to suit the ruby environment.
7
+
8
+ ## Require Directive
9
+
10
+ All calls to `require` are captured so that the compiler and build tools
11
+ can determine which dependencies a file has. In the case of `Builder`,
12
+ these are collated and then added to a list of files to be processed.
13
+
14
+ ### `require`
15
+
16
+ Assuming we have a file `foo.rb`:
17
+
18
+ # foo.rb
19
+ require 'bar'
20
+ require 'baz'
21
+
22
+ The compiler will collect these two dependencies, and then `Builder`
23
+ will attempt to discover them within the opal load path to also compile
24
+ them into the target output. If these dependencies cannot be resolved,
25
+ then a compile time error will be thrown.
26
+
27
+ #### Dynamic Requires
28
+
29
+ Opal only supports hard-coded requires. This means that any dynamically
30
+ generated require statemnts cannot be discoeverd. Opal may raise an
31
+ error or just produce a warning if a dynamic require is used. A dynamic
32
+ require is any require that cannot be resolved using static analysis. A
33
+ common use case of dynamic requires is to include a directory of ruby
34
+ files. In this case, see `require_tree` below.
35
+
36
+ ### `require_relative`
37
+
38
+ `require_relative` is also supported by opals compiler for ahead-of-time
39
+ inclusion.
40
+
41
+ # foo.rb
42
+ require_relative 'bar'
43
+
44
+ This example will try to resolve `bar.rb` in the same directory.
45
+
46
+ ### `autoload`
47
+
48
+ `autoload` is used to load a modules and classes within a modules
49
+ namespace. Aslong as the string argument given to `autoload` can be
50
+ resolved in Opals load paths, in the same way as `require`, then these
51
+ referenced dependencies will also be compiled.
52
+
53
+ # foo.rb
54
+ module Foo
55
+ autoload :Bar, 'bar'
56
+ end
57
+
58
+ In this example, `bar.rb` will also be required.
59
+
60
+ ### `require_tree`
61
+
62
+ `require_tree` can be used as an Opal friendly alternative to globbing
63
+ over a directory to require a list of dependencies.
64
+
65
+ # foo.rb
66
+ require_tree './models'
67
+
68
+ This will, at compile time, resolve all files inside the `models/`
69
+ directory and also compile them to the output. At runtime this method
70
+ will then loop over all modules defined, and require them if they match
71
+ that given module path.
72
+
73
+ Note: The given directory **must** be inside Opals load path, otherwise
74
+ no files will be compiled.
75
+
76
+ ### Handling non-ruby requirements
77
+
78
+ Opal's `require` method is also special as it allows non-ruby source
79
+ files to be required and generated in the output. The obvious example of
80
+ this is requiring javascript source files. Javascript sources are
81
+ treated as first class citizens in Opal. The Opal gem also supports
82
+ compiling `.erb` files using the same process.
83
+
84
+ ## Opal Specific Code Compilation
85
+
86
+ A special case `if` and `unless` statements can hide or show blocks of
87
+ code from the Opal compiler. These check against `RUBY_ENGINE` or
88
+ `RUBY_PLATFORM`. As these are valid ruby statements against constants
89
+ that exist in all ruby runtimes, they will not affect any running code:
90
+
91
+ if RUBY_ENGINE == 'opal'
92
+ # this code compiles
93
+ else
94
+ # this code never compiles
95
+ end
96
+
97
+ Unless statements are also supported:
98
+
99
+ unless RUBY_ENGINE == 'opal'
100
+ # this code will not run
101
+ end
102
+
103
+ Also `!=` statements work:
104
+
105
+ if RUBY_ENGINE != 'opal'
106
+ puts "do not run this code"
107
+ end
108
+
109
+ These blocks of code dont run at all at runtime, but they also never
110
+ compile so will never be in the output javascript code. This is
111
+ particularly useful for using code in both mri and Opal.
112
+
113
+ Some uses are:
114
+
115
+ * Avoid `require` statements being picked up by Opal compile time
116
+ require handling.
117
+
118
+ * To stop certain requires taking place for opal (and vice-versa for
119
+ shared libraries).
120
+
121
+ * To wrap x-strings which might break in compiled javascript output.
122
+
123
+ * To simply avoid compiling large blocks of code that are not needed
124
+ in the javascript/opal version of an app.
125
+
126
+ In all these examples `RUBY_PLATFORM` can be used instead of
127
+ `RUBY_ENGINE`.
@@ -0,0 +1 @@
1
+ tmp
@@ -1,5 +1,6 @@
1
1
  class User
2
2
  def initialize(name)
3
+ puts "wow"
3
4
  @name = name
4
5
  end
5
6
 
@@ -1,9 +1,10 @@
1
1
  require 'opal/nodes'
2
+
2
3
  class Opal::Nodes::CallNode
3
4
  # Rubyspec uses this call to load in language specific features at runtime.
4
5
  # We can't do this at runtime, so handle it during compilation
5
6
  add_special :language_version do
6
- if meth == :language_version and scope.top?
7
+ if scope.top?
7
8
  lang_type = arglist[2][1]
8
9
  target = "corelib/language/versions/#{lang_type}_1.9"
9
10
 
@@ -16,7 +17,19 @@ class Opal::Nodes::CallNode
16
17
  end
17
18
 
18
19
  add_special :not_supported_on do
19
- unless meth == :not_supported_on and arglist[1][1] == :opal
20
+ unless arglist.flatten.include? :opal
21
+ compile_default!
22
+ end
23
+ end
24
+
25
+ add_special :platform_is_not do
26
+ unless arglist.flatten.include? :opal
27
+ compile_default!
28
+ end
29
+ end
30
+
31
+ add_special :platform_is do
32
+ if arglist.flatten.include? :opal
20
33
  compile_default!
21
34
  end
22
35
  end