Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Deploy Polymer App generates code with errors #13849

Closed
sethladd opened this issue Oct 5, 2013 · 20 comments
Closed

Deploy Polymer App generates code with errors #13849

sethladd opened this issue Oct 5, 2013 · 20 comments
Labels
area-pkg Used for miscellaneous pkg/ packages not associated with specific area- teams.

Comments

@sethladd
Copy link
Contributor

sethladd commented Oct 5, 2013

Using:

  polymer:
    description: polymer
    source: hosted
    version: "0.7.6+4"
  polymer_expressions:
    description: polymer_expressions
    source: hosted
    version: "0.7.6+4"

Dart Editor version 0.7.6_r28108

Just ran "deploy polymer app", and it generated code that doesn't compile.

This is from the todo_element sample here: https://github.com/sethladd/dart-polymer-dart-examples/tree/master/web/todo_element

Build looks like this:

!/usr/bin/env dart

// Copyright (c) 2012, the Dart project authors. Please see the AUTHORS file
// for details. All rights reserved. Use of this source code is governed by a
// BSD-style license that can be found in the LICENSE file.

import 'package:polymer/builder.dart';

void main() {
  build(entryPoints: ['web/simple_custom_element/index.html', 'web/todo_element/index.html']);
}


Attachment:
[Screen Shot 2013-10-05 at 10.02.45 AM.png](https://storage.googleapis.com/google-code-attachments/dart/issue-13849/comment-0/Screen Shot 2013-10-05 at 10.02.45 AM.png) (205.33 KB)

@sethladd
Copy link
Contributor Author

sethladd commented Oct 5, 2013

Here's the original code, before the build step:

library models;

import 'package:polymer/polymer.dart'
show ObservableMixin, observable, bindProperty, notifyProperty;

/// The Item class represents an item in the Todo list.
class Item extends Object with ObservableMixin {
  @­observable String text = '';
  @­observable bool done = false;

  Item({this.text: '', this.done: false}) {
    // Monitor the done boolean to add/remove done class.
    bindProperty(this, const Symbol('done'),
        () => notifyProperty(this, const Symbol('doneClass')));
  }

  // Check if item text is empty.
  bool get isEmpty => text.isEmpty;

  // Apply a done class for completed items.
  String get doneClass => done ? 'done' : '';
}

I think the issue is: the code has an import with a show. But the build step is introducing a new name that isn't included in the original show, and the build step isn't adding the new name (ChangeNotifierMixin) to the show.

Yup, if I remove the show statements from my original code, the generated code in out/ works.


Added Library-PolymerBuild label.

@sethladd
Copy link
Contributor Author

sethladd commented Oct 5, 2013

Bumping to high.


Removed Priority-Unassigned label.
Added Priority-High label.

@jmesserly
Copy link

Sadness. We used to add our own import with prefix, to be safe from this kind of issue. Not sure what happened.


Added Accepted label.

@jmesserly
Copy link

Removed Library-PolymerBuild label.
Added Library-Observe label.

@sethladd
Copy link
Contributor Author

sethladd commented Oct 6, 2013

Thanks for verifying!

@sigmundch
Copy link
Member

Added this to the M8 milestone.

@jmesserly
Copy link

for now the workaround is to use wildcard imports. we do want to fix but can happen after M8


Removed this from the M8 milestone.
Added this to the Later milestone.

@jmesserly
Copy link

Issue #14509 has been merged into this issue.

@jmesserly
Copy link

Ugh. No idea how to fix this yet.

The @­observable transformation is local right now. It doesn't need to affect the rest of your file. It doesn't mess up line numbers and it doesn't care if your code is in a library or part.

If we need to add an import, then suddenly we've got to know if we're in a library/part, and if it's a part, we need add the import to the main file. Which is not easy with barback transformers (would've been relatively easy in our old compiler. Doh!)

One idea is to change the transform ... instead of replacing the base class with ChangeNotifier, just override some methods to turn the dirty-checking impl into a no-op. But, I'm not sure how smart dart2js is in this case, in other words: can it kill the dirty-check code?

@jmesserly
Copy link

Set owner to @jmesserly.
Added Started label.

@sigmundch
Copy link
Member

Removed this from the Later milestone.
Added this to the M9 milestone.

@clayberg
Copy link

Removed this from the M9 milestone.
Added this to the 1.1 milestone.

@sigmundch
Copy link
Member

Issue #15095 has been merged into this issue.

@sigmundch
Copy link
Member

Removed this from the 1.1 milestone.
Added this to the 1.2 milestone.

@sigmundch
Copy link
Member

Issue #16555 has been merged into this issue.

@sethladd
Copy link
Contributor Author

sethladd commented Feb 5, 2014

Ah, I knew this sounded familiar. Thanks for de-duping. I have this starred.

@anders-sandholm
Copy link
Contributor

Removed Library-Observe label.
Added Pkg-Observe label.

@jmesserly
Copy link

unfortunately, no progress here. Maybe the answer is to ditch the @­observable transform for now & stick with dirty-checking similar to Angular.


Added Accepted label.

@sigmundch
Copy link
Member

Alternatively, we could use the resolver for this. Now that we are using the analyzer in transformers for polymer, I think we can start using it here too. We would apply this on libraries rather than files, though. We can also resolve @­observable and remove the special handling we have for @­published.

@sethladd sethladd added Type-Defect area-pkg Used for miscellaneous pkg/ packages not associated with specific area- teams. labels Apr 18, 2014
@DartBot
Copy link

DartBot commented Jun 5, 2015

This issue has been moved to dart-archive/observe#44.

@DartBot DartBot closed this as completed Jun 5, 2015
@kevmoo kevmoo removed the triaged label Mar 1, 2016
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
area-pkg Used for miscellaneous pkg/ packages not associated with specific area- teams.
Projects
None yet
Development

No branches or pull requests

7 participants