Sha256: e719274e5cc830b8036a017d85277e73b75f816e87b8925ffd23adbd0cc63033
Contents?: true
Size: 1.29 KB
Versions: 36
Compression:
Stored size: 1.29 KB
Contents
require 'opal/nodes/base' module Opal module Nodes class ConstNode < Base handle :const children :name def compile if name == :DATA and compiler.eof_content push("$__END__") else push "$scope.get('#{name}')" end end end class ConstDeclarationNode < Base handle :cdecl children :name, :base def compile push expr(base) wrap "Opal.cdecl($scope, '#{name}', ", ")" end end class ConstAssignNode < Base handle :casgn children :base, :name, :value def compile push "Opal.casgn(" push expr(base) push ", '#{name}', " push expr(value) push ")" end end class ConstGetNode < Base handle :colon2 children :base, :name def compile push "((" push expr(base) push ").$$scope.get('#{name}'))" end end class TopConstNode < Base handle :colon3 children :name def compile push "Opal.get('#{name}')" end end class TopConstAssignNode < Base handle :casgn3 children :name, :value def compile push "Opal.casgn(Opal.Object, '#{name}', " push expr(value) push ")" end end end end
Version data entries
36 entries across 36 versions & 2 rubygems