Skip to content
This repository was archived by the owner on Feb 22, 2018. It is now read-only.

Strip FINAL, CONST and ABSTRACT annotations from Dart output #13

Open
yjbanov opened this issue Mar 18, 2015 · 4 comments
Open

Strip FINAL, CONST and ABSTRACT annotations from Dart output #13

yjbanov opened this issue Mar 18, 2015 · 4 comments

Comments

@yjbanov
Copy link
Contributor

yjbanov commented Mar 18, 2015

They pollute Dart code. Example:

This:

import {
  CONST, FINAL, ABSTRACT
} from 'angular2/src/facade/lang';

@ABSTRACT()
class Blah {
  @FINAL()
  i;

  @CONST()
  constructor(a) {
    this.i = a;
  }
}

Transpiles to this:

library angular2.blah_dart;
import 'package:angular2/src/facade/lang.dart' show CONST, FINAL, ABSTRACT;

@ABSTRACT() 
class Blah {
  final i;
  @CONST() 
  const Blah( a): i = a;
}

(@Final is removed but still imported unnecessarily)

@chalin
Copy link
Contributor

chalin commented Mar 18, 2015

/sub

@mprobst
Copy link
Contributor

mprobst commented Apr 1, 2015

Mhpf. Done already, but now this causes dartanalyzer warnings for unused imports :-(

@mprobst mprobst closed this as completed Apr 1, 2015
@kevmoo
Copy link

kevmoo commented Apr 1, 2015

@mprobst Now you need to strip the imports. 😄

@mprobst
Copy link
Contributor

mprobst commented Apr 2, 2015

Actually handling the unused imports is not feasible at the moment as we don't have precise type information available to detect used and unused imports. So let's just include these in the output for now, and revisit this once we're fully migrated to TypeScript.

Maybe it's easiest to just ignore warnings from the dart analyzer - after all, this is just generated code, and the imports will be dropped by later stages during compilation.

# for free to subscribe to this conversation on GitHub. Already have an account? #.
Labels
None yet
Development

No branches or pull requests

4 participants