This Bugzilla instance is a read-only archive of historic NetBeans bug reports. To report a bug in NetBeans please follow the project's instructions for reporting issues.
Summary: | Recursive references in Knockout modeling API not supported | ||
---|---|---|---|
Product: | web | Reporter: | Jaroslav Tulach <jtulach> |
Component: | Knockout | Assignee: | Jaroslav Tulach <jtulach> |
Status: | RESOLVED FIXED | ||
Severity: | normal | CC: | ppisl, rsvitanic |
Priority: | P3 | ||
Version: | 8.1 | ||
Hardware: | PC | ||
OS: | Linux | ||
Issue Type: | DEFECT | Exception Reporter: | |
Bug Depends on: | 231131 | ||
Bug Blocks: | |||
Attachments: |
Proposed fix
Patch reusing the cycle detection in TopologicalSortException |
Description
Jaroslav Tulach
2015-03-10 18:31:43 UTC
Created attachment 152560 [details]
Proposed fix
Sorry, attachment should go to another issue #251075. The case var Multi = { "int" : 0 }; var Hello = { "multi" : Multi }; Multi.hello = Hello; works correctly now. In the model there is basically no cycle. In the our model there is the property hello of Multi object that has one assignment of Hello "type". So the model basically doesn't know about the cycle. Code completion works correctly as well, because the types are counted for every type after . separately in an expression. For example code completion Multi.hello.multi.hello.| works as expected and offers multi property. But mark occurrences will not work for the second occurrence of hello identifier in this example. The cycle is there detected and computing occurrences is stopped then. Petr seems to be OK with the late time assignments like Multi.hello = Hello; and belives that JavaScript editor should understand them correctly. So we need to modify the API to detect a cycle between Multi/Hello and solve it with the late assignment. Btw. NetBeans have an API for detecting cycles in a topological graph: http://bits.netbeans.org/dev/javadoc/org-openide-util-ui/org/openide/util/Utilities.html#topologicalSort%28java.util.Collection,%20java.util.Map%29 http://bits.netbeans.org/dev/javadoc/org-openide-util/org/openide/util/TopologicalSortException.html?is-external=true Created attachment 152696 [details]
Patch reusing the cycle detection in TopologicalSortException
This is my proposed fix. It will work well even if there are multiple separate cycles between the models thanks to the heavy job done by the TopologicalSortException.
Unless there are objections I'd like to apply it while keeping the version number of the generated JavaScript 1, as there was no release with the current format yet.
(In reply to Jaroslav Tulach from comment #5) > Created attachment 152696 [details] > Patch reusing the cycle detection in TopologicalSortException > > This is my proposed fix. It will work well even if there are multiple > separate cycles between the models thanks to the heavy job done by the > TopologicalSortException. Proposed fix seems to solve the issue and I think it can be integrated. Thanks. > > Unless there are objections I'd like to apply it while keeping the version > number of the generated JavaScript 1, as there was no release with the > current format yet. I do not have any objections. Integrated into 'main-silver', will be available in build *201503210001* on http://bits.netbeans.org/dev/nightly/ (upload may still be in progress) Changeset: http://hg.netbeans.org/main-silver/rev/f7780c8e9f06 User: Jaroslav Tulach <jtulach@netbeans.org> Log: #251076: Generate reasonable format even if there are recursive dependencies between used models |