Sha256: 8425f94e9ab792d8a44bab3bbde0de72be4fd6e7675d8285c885ecc1f47c247a
Contents?: true
Size: 544 Bytes
Versions: 15
Compression:
Stored size: 544 Bytes
Contents
require 'opal/nodes/base' module Opal module Nodes # A node responsible for extracting a single # optional argument # # def m(a=1) # class OptargNode < Base handle :optarg def compile optarg_name = @sexp[1].to_sym default_value = @sexp[2] var_name = variable(optarg_name) return if default_value[2] == :undefined line "if (#{var_name} == null) {" line " #{var_name} = ", expr(default_value) push ";" line "}" end end end end
Version data entries
15 entries across 15 versions & 1 rubygems