#1592 javascript compiler extending order fails

jessevdam Wed 27 Jul 2011

When I try to rebuild the fwt it creates a faulty script.

fan.fwt.TabPanePeer = fan.sys.Obj.$extend(fan.fwt.PanePeer);

Here it tries to extend the fan.fwt.TabPanePeer from the fan.fwt.PanePeer, which not yet exist because it is made later in the script.

In the original is script it is all fine, but after a rebuild...

andy Wed 27 Jul 2011

The type order comes from the compiler. You can stick some debug in compilerJs - might start by dumping the type qname here:

// compilerJs/fan/ast/JsPod.fan:63 
types.each |t|
{
  if (t.isNative) writePeer(out, t, false)
  else
  {
    t.write(out)
    if (t.hasNatives) writePeer(out, t, true)
  }
}

jessevdam Wed 27 Jul 2011

This is the order I get

Writing type: fwt::Widget
Writing type: fwt::TabPane
Writing type: fwt::Tab
Writing type: fwt::Command
Writing type: fwt::ScrollBar
Writing type: fwt::Pane
Writing type: fwt::GridPane
Writing type: fwt::GridPaneSizes
Writing type: fwt::ContentPane
Writing type: fwt::Event
Writing type: fwt::EventId
Writing type: fwt::EventListeners
Writing type: fwt::Table
Writing type: fwt::TableModel
Writing type: fwt::TableView
Writing type: fwt::Window
Writing type: fwt::Dialog
Writing type: fwt::DialogCommand
Writing type: fwt::DialogCommandId
Writing type: fwt::MenuItem
Writing type: fwt::EdgePane
Writing type: fwt::Label
Writing type: fwt::SashPane
Writing type: fwt::Cursor
Writing type: fwt::Button
Writing type: fwt::Key
Writing type: fwt::Combo
Writing type: fwt::ScrollPane
Writing type: fwt::InsetPane
Writing type: fwt::FwtEnv
Writing type: fwt::ConstraintPane
Writing type: fwt::BorderPane
Writing type: fwt::Desktop
Writing type: fwt::TextWidget
Writing type: fwt::TextChange
Writing type: fwt::TreeModel
Writing type: fwt::Menu
Writing type: fwt::CommandMode
Writing type: fwt::ButtonMode
Writing type: fwt::MenuItemMode
Writing type: fwt::WindowMode
Writing type: fwt::FileDialogMode
Writing type: fwt::SortMode
Writing type: fwt::ProgressBar
Writing type: fwt::Canvas
Writing type: fwt::ToolBar
Writing type: fwt::RichText
Writing type: fwt::RichTextModel
Writing type: fwt::RichTextStyle
Writing type: fwt::RichTextUnderline
Writing type: fwt::Text

I will continue searching why, but TabPane should come after Pane

Should the list type be ordered some how or not?

jessevdam Wed 27 Jul 2011

It seems that not the compiler is not at fault, but the peer file

So the TabPanePeer.js file it still subclasses Pane while in the fan code it subclasses Widget so

fan.fwt.TabPanePeer = fan.sys.Obj.$extend(fan.fwt.PanePeer);

must become

fan.fwt.TabPanePeer = fan.sys.Obj.$extend(fan.fwt.WidgetPeer);

Login or Signup to reply.