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

builder fails on "unreachable code" #2

Open
aplatypus opened this issue Apr 27, 2014 · 2 comments
Open

builder fails on "unreachable code" #2

aplatypus opened this issue Apr 27, 2014 · 2 comments

Comments

@aplatypus
Copy link

Hello there.

I don't know yet what the problem is, I've commented out the Dart code to isolate this issue but it still fails. The biggest problem is that the builder error stops Dart doing the *pub get command. Poor show mates.

The source of the error is some place in "reference_form.dart". This is the only file I've edited today.

Commenting out the code in Builder.dart solves the immediate issue. But now I have no polymer lexxer.

I've included a error output below and a command line output from a manual pub get.


// 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 'dart:html';
import 'dart:convert';
import 'package:polymer/polymer.dart';

  class _Data { 
      String publishTitle     = '(title)';
      String publishUrl       = '';
      String publishDate;
      String authorGivenName  = '(given)';
      String authorFamilyName = '(family)';
      String authorUrl        = ''; 
      String accessDate;

```
       //--- ctor ---

  _Data(){
      publishDate  = new DateTime.now().toString();
      accessDate   = new DateTime.now().toString();
  }
```

  }

@CustomTag('reference-form')
class SlamBookComponent extends FormElement with Polymer, Observable {

  SlamBookComponent.created() : super.created();

  // This map contains the rest of the forma data.
  @observable 
  Map theData = toObservable({
    'publishTitle':     '[title]',
    'publishUrl':       '',
    'publishDate':      '2014-05-01',
    'authorGivenName':  '[given name]',
    'authorFamilyName': '[family name]',
    'authorUrl':        '', 
    'accessDate':       '2014-05-01'
  });

  //---- testing ----

  @observable
  _Data _data = new _Data();

  @observable 
  String get familyName => familyName;
  void   set familyName( String nam ){
      familyName = nam; 
      fullName   = notifyPropertyChange( 
                       #fullName, 
                       "${fullName}", 
                       "${nam}, ${theData['authorGivenName']}" );
  }

  @observable
  String fullName;

  //---- end: testing ----

  @observable String formattedReference = '(blank)'; 

  @observable String serverResponse = '';
  HttpRequest request;

  void submitForm(Event e, var detail, Node target) {
   /// e.preventDefault(); // Don't do the default submit.

```
request = new HttpRequest();

request.onReadyStateChange.listen(onData); 

// POST the data to the server.
var url = 'http://127.0.0.1:4040';
request.open('POST', url);
request.send(_slambookAsJsonData());
```

  }

  void onData(_) {
    if (request.readyState == HttpRequest.DONE &&
        request.status == 200) {
      // Data saved OK.
      serverResponse = 'Server Sez: ' + request.responseText;
    } else if (request.readyState == HttpRequest.DONE &&
        request.status == 0) {
      // Status is 0...most likely the server isn't running.
      serverResponse = 'No server';
    }
  }

  void resetForm(Event e, var detail, Node target) {
    e.preventDefault(); // Default behavior clears elements,
                        // but bound values don't follow
                        // so have to do this explicitly.

```
///  formatReference();

theData['publishTitle']     = '(title)';
theData['publishUrl']       = '';
theData['publishDate']      = '2014-05-01';
theData['authorGivenName']  = '(given name)';
theData['authorFamilyName'] = '(family name)';
theData['authorUrl']        = '';
theData['accessDate']       = '2014-05-01';

serverResponse = 'Data cleared.';
```

  }

  @observable
  String formatReference(){

```
  formattedReference = '!! [['+ 
          theData['authorFamilyName'] +', '+ 
          theData['authorGivenName'] +'|'+ theData['authorUrl'] +']] \n'+
          ' --- \n';
```

  }

  String _slambookAsJsonData() {
    return JSON.encode(theData);
  }
}

~~~~~~~[ build.dart ]~~~~~~~~~~~~~~

import 'package:polymer/builder.dart';

main(args) {
//  build(entryPoints: ['web/reference.html'],
//        options: parseOptions(args));
}

```
--- 12:27:06 AM build.dart --machine --changed=web\reference_form.dart ---
file:/W:/sandbox/dart/polymer/reference/build.dart
build.dart returned error code 3

unexpected error invoking 'pub':


--- 12:27:47 AM Running pub upgrade on W:\sandbox\dart\polymer\reference ... ---
Pub upgrade failed, [3] 

--- 12:35:04 AM build.dart --machine --changed=web\reference_form.dart ---
file:/W:/sandbox/dart/polymer/reference/build.dart
build.dart returned error code 3

unexpected error invoking 'pub':


--- 12:38:14 AM build.dart --machine --changed=web\reference_form.dart ---
file:/W:/sandbox/dart/polymer/reference/build.dart
build.dart returned error code 255

Unhandled exception:
FormatException: Unexpected character at 0: ''
#0      _JsonParser.fail (dart:convert-patch/convert_patch.dart:580)
#1      _JsonParser.parse (dart:convert-patch/convert_patch.dart:336)
#2      _parseJson (dart:convert-patch/convert_patch.dart:16)
#3      JsonDecoder.convert (dart:convert/json.dart:321)
#4      JsonCodec.decode (dart:convert/json.dart:124)
#5      _readPackageDirsFromPub (package:polymer/src/build/runner.dart:110:24)
#6      BarbackOptions.BarbackOptions (package:polymer/src/build/runner.dart:63:50)
#7      lint (package:polymer/builder.dart:156:25)
#8      build (package:polymer/builder.dart:126:13)
#9      main (file:///W:/sandbox/dart/polymer/reference/build.dart:4:8)
#10     _startIsolate.isolateStartHandler (dart:isolate-patch/isolate_patch.dart:216)
#11     _RawReceivePortImpl._handleMessage (dart:isolate-patch/isolate_patch.dart:116)


--- 12:39:06 AM build.dart --machine --changed=web\reference_form.dart ---
file:/W:/sandbox/dart/polymer/reference/build.dart
build.dart returned error code 3

unexpected error invoking 'pub':

~~~~~~~~~~[ pub get ]~~~~~~~~

W:...> pub get
vm\raw_object_snapshot.cc:2010: error: unreachable code
```
@jmesserly
Copy link
Owner

hi, what version(s) of Dart/packages are you using?

help -> about in editor or dart --version will give Dart version
pubspec.lock will have package versions

@aplatypus
Copy link
Author

Hi

Version:

  • Dart VM version: 1.4.0-dev.4.0 (Thu Apr 24 07:52:20 2014) on
    "windows_ia32"

PubSpec.lock

Generated by pub

See http://pub.dartlang.org/doc/glossary.html#lockfile

packages:
analyzer:
description: analyzer
source: hosted
version: "0.10.5"
args:
description: args
source: hosted
version: "0.9.0"
barback:
description: barback
source: hosted
version: "0.13.0"
browser:
description: browser
source: hosted
version: "0.9.1"
collection:
description: collection
source: hosted
version: "0.9.1"
custom_element:
description: custom_element
source: hosted
version: "0.9.2"
html5lib:
description: html5lib
source: hosted
version: "0.9.2"
html_import:
description: html_import
source: hosted
version: "0.9.0"
logging:
description: logging
source: hosted
version: "0.9.1+1"
mutation_observer:
description: mutation_observer
source: hosted
version: "0.9.0"
observe:
description: observe
source: hosted
version: "0.9.3+1"
path:
description: path
source: hosted
version: "1.1.0"
polymer:
description: polymer
source: hosted
version: "0.9.5+2"
polymer_expressions:
description: polymer_expressions
source: hosted
version: "0.9.1"
shadow_dom:
description: shadow_dom
source: hosted
version: "0.9.2"
source_maps:
description: source_maps
source: hosted
version: "0.9.0"
stack_trace:
description: stack_trace
source: hosted
version: "0.9.3+1"
template_binding:
description: template_binding
source: hosted
version: "0.9.1"
unmodifiable_collection:
description: unmodifiable_collection
source: hosted
version: "0.9.2+1"
utf:
description: utf
source: hosted
version: "0.9.0"
yaml:
description: yaml
source: hosted
version: "0.9.0"

On 29 April 2014 06:09, John Messerly [email protected] wrote:

hi, what version(s) of Dart/packages are you using?

help -> about in editor or dart --version will give Dart version
pubspec.lock will have package versions

Reply to this email directly or view it on GitHubhttps://github.com//issues/2#issuecomment-41606918
.

aloha,
w/


º  http://www.facebook.com/will.2016

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants