Avoid 'as' keyword

It has performance implications in release mode.

We'll enable the lint once https://github.com/dart-lang/linter/issues/195 is fixed.
This commit is contained in:
Hixie
2016-03-09 14:06:42 -08:00
parent 778c3a05b1
commit 5810cd80bd
10 changed files with 57 additions and 36 deletions

View File

@@ -68,7 +68,7 @@ class AndroidApk extends ApplicationPackage {
String launchActivity;
for (xml.XmlElement category in document.findAllElements('category')) {
if (category.getAttribute('android:name') == 'android.intent.category.LAUNCHER') {
xml.XmlElement activity = category.parent.parent as xml.XmlElement;
xml.XmlElement activity = category.parent.parent;
String activityName = activity.getAttribute('android:name');
launchActivity = "$id/$activityName";
break;

View File

@@ -294,9 +294,10 @@ class AnalyzeCommand extends FlutterCommand {
for (String package in packages.keys)
packagesBody.writeln('$package:${path.toUri(packages[package])}');
/// specify analysis options
/// note that until there is a default "all-in" lint rule-set we need
/// to opt-in to all desired lints (https://github.com/dart-lang/sdk/issues/25843)
/// Specify analysis options.
/// Note that until there is a default "all-in" lint rule-set we need
/// to opt-in to all desired lints (https://github.com/dart-lang/sdk/issues/25843).
/// For a list of lints, see: http://dart-lang.github.io/linter/lints/
String optionsBody = '''
analyzer:
errors:
@@ -307,6 +308,8 @@ analyzer:
todo: ignore
linter:
rules:
# we'll turn on avoid_as as soon as it doesn't complain about "as dynamic"
# - avoid_as
- camel_case_types
# sometimes we have no choice (e.g. when matching other platforms)
# - constant_identifier_names