Class: Y2R::AST::YCP::YETerm

Inherits:
Node
  • Object
show all
Defined in:
lib/y2r/ast/ycp.rb,
lib/y2r/ast/ycp.rb

Overview

Forward declaration needed for |YEBracket::LAZY_DEFULT_CLASSES|.

Constant Summary collapse

UI_TERMS =
[
  :BarGraph,
  :BusyIndicator,
  :Bottom,
  :ButtonBox,
  :Cell,
  :Center,
  :CheckBox,
  :CheckBoxFrame,
  :ColoredLabel,
  :ComboBox,
  :DateField,
  :DownloadProgress,
  :DumbTab,
  :Dummy,
  :DummySpecialWidget,
  :Empty,
  :Frame,
  :HBox,
  :HCenter,
  :HMultiProgressMeter,
  :HSpacing,
  :HSquash,
  :HStretch,
  :HVCenter,
  :HVSquash,
  :HVStretch,
  :HWeight,
  :Heading,
  :IconButton,
  :Image,
  :InputField,
  :IntField,
  :Label,
  :Left,
  :LogView,
  :MarginBox,
  :MenuButton,
  :MinHeight,
  :MinSize,
  :MinWidth,
  :MultiLineEdit,
  :MultiSelectionBox,
  :PackageSelector,
  :PatternSelector,
  :PartitionSplitter,
  :Password,
  :PkgSpecial,
  :ProgressBar,
  :PushButton,
  :RadioButton,
  :RadioButtonGroup,
  :ReplacePoint,
  :RichText,
  :Right,
  :SelectionBox,
  :Slider,
  :Table,
  :TextEntry,
  :TimeField,
  :TimezoneSelector,
  :Top,
  :Tree,
  :VBox,
  :VCenter,
  :VMultiProgressMeter,
  :VSpacing,
  :VSquash,
  :VStretch,
  :VWeight,
  :Wizard,
  # special ones that will have upper case shortcut, but in term is lowercase
  :id,
  :item,
  :header,
  :opt,
]

Instance Method Summary collapse

Methods inherited from Node

#always_returns?, #compile_as_copy_if_needed, #compile_statements, #compile_statements_inside_block, #compile_statements_with_whitespace, #creates_local_scope?, #needs_copy?, #never_nil?, #optimize_last_statement, #optimize_next, #optimize_return, #remove_duplicate_imports, transfers_comments

Instance Method Details

#compile(context) ⇒ Object



2470
2471
2472
2473
2474
2475
2476
2477
2478
2479
2480
2481
2482
2483
2484
2485
2486
2487
2488
2489
2490
2491
2492
2493
2494
# File 'lib/y2r/ast/ycp.rb', line 2470

def compile(context)
  children_compiled = children.map { |ch| ch.compile(context) }

  method_name = name.dup
  method_name[0] = method_name[0].upcase
  if UI_TERMS.include?(name.to_sym) && !context.symbols.include?(method_name)
    Ruby::MethodCall.new(
      :receiver => nil,
      :name     => method_name,
      :args     => children_compiled,
      :block    => nil,
      :parens   => true
    )
  else
    name_compiled = Ruby::Literal.new(:value => name.to_sym)

    Ruby::MethodCall.new(
      :receiver => nil,
      :name     => "term",
      :args     => [name_compiled] + children_compiled,
      :block    => nil,
      :parens   => true
    )
  end
end

#empty?Boolean

Returns:

  • (Boolean)


2498
2499
2500
# File 'lib/y2r/ast/ycp.rb', line 2498

def empty?
  children.empty?
end