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

Commit 7a2c2d2

Browse files
committed
chore: Cleanup warnings
1 parent 3cf82a1 commit 7a2c2d2

10 files changed

+41
-32
lines changed

lib/core/scope.dart

+5-3
Original file line numberDiff line numberDiff line change
@@ -97,9 +97,11 @@ class ScopeLocals implements Map {
9797
void operator []=(String name, value) {
9898
_scope[name] = value;
9999
}
100-
dynamic operator [](String name) =>
101-
// as Map needed to clear Dart2js warning
102-
((_locals.containsKey(name) ? _locals : _scope) as Map)[name];
100+
dynamic operator [](String name) {
101+
// Map needed to clear Dart2js warning
102+
Map map = _locals.containsKey(name) ? _locals : _scope;
103+
return map[name];
104+
}
103105

104106
bool get isEmpty => _scope.isEmpty && _locals.isEmpty;
105107
bool get isNotEmpty => _scope.isNotEmpty || _locals.isNotEmpty;

lib/core_dom/directive.dart

+1-1
Original file line numberDiff line numberDiff line change
@@ -86,7 +86,7 @@ class NodeAttrs {
8686
* ShadowRoot is ready.
8787
*/
8888
class TemplateLoader {
89-
final async.Future<dom.ShadowRoot> template;
89+
final async.Future<dom.Node> template;
9090

9191
TemplateLoader(this.template);
9292
}

lib/core_dom/shadow_dom_component_factory.dart

+2-2
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@ abstract class ComponentFactory {
1414
return null;
1515
}
1616

17-
static TemplateLoader _setupOnShadowDomAttach(controller, templateLoader, shadowScope) {
17+
static void _setupOnShadowDomAttach(controller, templateLoader, shadowScope) {
1818
if (controller is ShadowRootAware) {
1919
templateLoader.template.then((shadowDom) {
2020
if (!shadowScope.isAttached) return;
@@ -104,7 +104,7 @@ class _ComponentFactory implements Function {
104104
}
105105
var viewFuture = ComponentFactory._viewFuture(component, viewCache, directives);
106106
TemplateLoader templateLoader = new TemplateLoader(
107-
async.Future.wait(cssFutures).then((Iterable<String> cssList) {
107+
async.Future.wait(cssFutures).then((Iterable<dom.StyleElement> cssList) {
108108
cssList
109109
.where((styleElement) => styleElement != null)
110110
.forEach((styleElement) => shadowDom.append(styleElement.clone(true)));

lib/core_dom/transcluding_component_factory.dart

+4-3
Original file line numberDiff line numberDiff line change
@@ -88,17 +88,18 @@ class TranscludingComponentFactory implements ComponentFactory {
8888

8989
// Append the component's template as children
9090
var viewFuture = ComponentFactory._viewFuture(component, viewCache, directives);
91+
var elementFuture;
9192

9293
if (viewFuture != null) {
93-
viewFuture = viewFuture.then((ViewFactory viewFactory) {
94+
elementFuture = viewFuture.then((ViewFactory viewFactory) {
9495
contentPort.pullNodes();
9596
element.nodes.addAll(viewFactory(childInjector).nodes);
9697
return element;
9798
});
9899
} else {
99-
viewFuture = new async.Future.microtask(() => contentPort.pullNodes());
100+
elementFuture = new async.Future.microtask(() => contentPort.pullNodes());
100101
}
101-
TemplateLoader templateLoader = new TemplateLoader(viewFuture);
102+
TemplateLoader templateLoader = new TemplateLoader(elementFuture);
102103

103104
Scope shadowScope = scope.createChild({});
104105

lib/tools/source_metadata_extractor.dart

-2
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,6 @@
11
library angular.source_metadata_extractor ;
22

33
import 'package:analyzer/src/generated/ast.dart';
4-
import 'package:analyzer/src/generated/element.dart';
5-
64
import 'package:angular/tools/source_crawler.dart';
75
import 'package:angular/tools/common.dart';
86

lib/tools/symbol_inspector/symbol_inspector.dart

+6-6
Original file line numberDiff line numberDiff line change
@@ -31,11 +31,11 @@ Iterable<Symbol> _getUsedSymbols(DeclarationMirror decl, seenDecls, path, onlyTy
3131
var used = [];
3232

3333
if (decl is TypedefMirror) {
34-
var tddecl = decl as TypedefMirror;
34+
TypedefMirror tddecl = decl;
3535
used.addAll(_getUsedSymbols(tddecl.referent, seenDecls, path, onlyType));
3636
}
3737
if (decl is FunctionTypeMirror) {
38-
var ftdecl = decl as FunctionTypeMirror;
38+
FunctionTypeMirror ftdecl = decl;
3939

4040
ftdecl.parameters.forEach((ParameterMirror p) {
4141
used.addAll(_getUsedSymbols(p.type, seenDecls, path, onlyType));
@@ -50,7 +50,7 @@ Iterable<Symbol> _getUsedSymbols(DeclarationMirror decl, seenDecls, path, onlyTy
5050

5151
if (!onlyType) {
5252
if (decl is ClassMirror) {
53-
var cdecl = decl as ClassMirror;
53+
ClassMirror cdecl = decl;
5454
cdecl.declarations.forEach((s, d) {
5555
try {
5656
used.addAll(_getUsedSymbols(d, seenDecls, path, false));
@@ -62,7 +62,7 @@ Iterable<Symbol> _getUsedSymbols(DeclarationMirror decl, seenDecls, path, onlyTy
6262
}
6363

6464
if (decl is MethodMirror) {
65-
var mdecl = decl as MethodMirror;
65+
MethodMirror mdecl = decl;
6666
if (mdecl.parameters != null)
6767
mdecl.parameters.forEach((p) {
6868
used.addAll(_getUsedSymbols(p.type, seenDecls, path, true));
@@ -71,14 +71,14 @@ Iterable<Symbol> _getUsedSymbols(DeclarationMirror decl, seenDecls, path, onlyTy
7171
}
7272

7373
if (decl is VariableMirror) {
74-
var vdecl = decl as VariableMirror;
74+
VariableMirror vdecl = decl;
7575
used.addAll(_getUsedSymbols(vdecl.type, seenDecls, path, true));
7676
}
7777
}
7878

7979
// Strip out type variables.
8080
if (decl is TypeMirror) {
81-
var tdecl = decl as TypeMirror;
81+
TypeMirror tdecl = decl;
8282
var typeVariables = tdecl.typeVariables.map((tv) => tv.qualifiedName);
8383
used = used.where((x) => !typeVariables.contains(x));
8484
}

scripts/analyze.sh

+4-4
Original file line numberDiff line numberDiff line change
@@ -4,9 +4,9 @@ set -e
44

55
. $(dirname $0)/env.sh
66

7-
echo '==========='
8-
echo '== BUILD =='
9-
echo '==========='
7+
echo '============='
8+
echo '== ANALYZE =='
9+
echo '============='
1010

1111
OUT=tmp/all.dart
1212
mkdir -p tmp
@@ -16,7 +16,7 @@ $DARTANALYZER --version
1616
echo // generated file > $OUT
1717

1818
for FILE in $(ls lib/angular.dart \
19-
benchmarks/*_perf.dart \
19+
benchmark/*_perf.dart \
2020
test/*_spec.dart \
2121
test/*/*_spec.dart \
2222
lib/change_detection/change_detection.dart \

scripts/env.sh

+18-9
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,12 @@
11
#!/bin/bash
22
set -e
33

4+
if [[ -n $ENV_SET ]]; then
5+
exit 0
6+
else
7+
export ENV_SET=1
8+
fi
9+
410
if [ -n "$DART_SDK" ]; then
511
DARTSDK=$DART_SDK
612
else
@@ -24,31 +30,33 @@ else
2430
fi
2531
fi
2632

33+
case $( uname -s ) in
34+
Darwin)
35+
path=$(readlink ${BASH_SOURCE[0]}||echo './scripts/env.sh')
36+
export NGDART_SCRIPT_DIR=$(dirname $path)
37+
;;
38+
Linux)
39+
export NGDART_SCRIPT_DIR=$(dirname $(readlink -f ${BASH_SOURCE[0]}))
40+
;;
41+
esac
42+
export NGDART_BASE_DIR=$(dirname $NGDART_SCRIPT_DIR)
43+
2744
export DART_SDK="$DARTSDK"
2845
export DART=${DART:-"$DARTSDK/bin/dart"}
2946
export PUB=${PUB:-"$DARTSDK/bin/pub"}
3047
export DARTANALYZER=${DARTANALYZER:-"$DARTSDK/bin/dartanalyzer"}
3148
export DARTDOC=${DARTDOC:-"$DARTSDK/bin/dartdoc"}
3249
export DART_DOCGEN=${DART_DOCGEN:-"$DARTSDK/bin/docgen"}
3350
export DART_VM_OPTIONS="--old_gen_heap_size=2048"
34-
3551
export DARTIUM_BIN=${DARTIUM_BIN:-"$DARTIUM"}
3652
export CHROME_BIN=${CHROME_BIN:-"google-chrome"}
37-
3853
export PATH=$PATH:$DARTSDK/bin
3954

40-
export NGDART_SCRIPT_DIR=$(dirname $(readlink -f ${BASH_SOURCE[0]}))
41-
if [ -n $NGDART_SCRIPT_DIR ]; then
42-
export NGDART_SCRIPT_DIR=./scripts
43-
fi
44-
export NGDART_BASE_DIR=$(dirname $NGDART_SCRIPT_DIR)
45-
4655
echo '*********'
4756
echo '** ENV **'
4857
echo '*********'
4958
echo DART_SDK=$DART_SDK
5059
echo DART=$DART
51-
$DART --version
5260
echo PUB=$PUB
5361
echo DARTANALYZER=$DARTANALYZER
5462
echo DARTDOC=$DARTDOC
@@ -58,3 +66,4 @@ echo CHROME_BIN=$CHROME_BIN
5866
echo PATH=$PATH
5967
echo NGDART_BASE_DIR=$NGDART_BASE_DIR
6068
echo NGDART_SCRIPT_DIR=$NGDART_SCRIPT_DIR
69+
$DART --version 2>&1

test/core/annotation_src_spec.dart

+1-1
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@ _getName(VariableMirror v) => _SYMBOL_NAME.firstMatch(v.simpleName.toString()).g
99

1010
Map<String, dynamic> variables(x) {
1111
Map variables = {};
12-
InstanceMirror mirror = reflect(x) as InstanceMirror;
12+
InstanceMirror mirror = reflect(x);
1313
ClassMirror type = mirror.type;
1414
do {
1515
type.declarations.forEach((k,v) {

test/formatter/arrayify_spec.dart

-1
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,6 @@
11
library map_spec;
22

33
import '../_specs.dart';
4-
import 'package:angular/formatter/module.dart';
54

65
void main() {
76
describe('arrayify', () {

0 commit comments

Comments
 (0)