fix(ddc): router, compiler, web worker fixes for DDC
Also enable DDC checks across all non-web worker playground apps. We are now down to 2 DDC errors across all of them. The remaining two need to be fixed in package:analyzer, not in angular. BREAKING CHANGE: - there's a chance of breakage as router's Instruction constructor signature changed. Closes #6693
This commit is contained in:
parent
c4c43f5a77
commit
db87baeb98
@ -112,6 +112,10 @@ class TemplatePreparseVisitor implements HtmlAstVisitor {
|
|||||||
case PreparsedElementType.STYLESHEET:
|
case PreparsedElementType.STYLESHEET:
|
||||||
this.styleUrls.push(preparsedElement.hrefAttr);
|
this.styleUrls.push(preparsedElement.hrefAttr);
|
||||||
break;
|
break;
|
||||||
|
default:
|
||||||
|
// DDC reports this as error. See:
|
||||||
|
// https://github.com/dart-lang/dev_compiler/issues/428
|
||||||
|
break;
|
||||||
}
|
}
|
||||||
if (preparsedElement.nonBindable) {
|
if (preparsedElement.nonBindable) {
|
||||||
this.ngNonBindableStackCount++;
|
this.ngNonBindableStackCount++;
|
||||||
|
@ -107,9 +107,8 @@ export var BLANK_ROUTE_DATA = new RouteData();
|
|||||||
* ```
|
* ```
|
||||||
*/
|
*/
|
||||||
export abstract class Instruction {
|
export abstract class Instruction {
|
||||||
public component: ComponentInstruction;
|
constructor(public component: ComponentInstruction, public child: Instruction,
|
||||||
public child: Instruction;
|
public auxInstruction: {[key: string]: Instruction}) {}
|
||||||
public auxInstruction: {[key: string]: Instruction} = {};
|
|
||||||
|
|
||||||
get urlPath(): string { return isPresent(this.component) ? this.component.urlPath : ''; }
|
get urlPath(): string { return isPresent(this.component) ? this.component.urlPath : ''; }
|
||||||
|
|
||||||
@ -210,9 +209,9 @@ export abstract class Instruction {
|
|||||||
* a resolved instruction has an outlet instruction for itself, but maybe not for...
|
* a resolved instruction has an outlet instruction for itself, but maybe not for...
|
||||||
*/
|
*/
|
||||||
export class ResolvedInstruction extends Instruction {
|
export class ResolvedInstruction extends Instruction {
|
||||||
constructor(public component: ComponentInstruction, public child: Instruction,
|
constructor(component: ComponentInstruction, child: Instruction,
|
||||||
public auxInstruction: {[key: string]: Instruction}) {
|
auxInstruction: {[key: string]: Instruction}) {
|
||||||
super();
|
super(component, child, auxInstruction);
|
||||||
}
|
}
|
||||||
|
|
||||||
resolveComponent(): Promise<ComponentInstruction> {
|
resolveComponent(): Promise<ComponentInstruction> {
|
||||||
@ -225,7 +224,9 @@ export class ResolvedInstruction extends Instruction {
|
|||||||
* Represents a resolved default route
|
* Represents a resolved default route
|
||||||
*/
|
*/
|
||||||
export class DefaultInstruction extends Instruction {
|
export class DefaultInstruction extends Instruction {
|
||||||
constructor(public component: ComponentInstruction, public child: DefaultInstruction) { super(); }
|
constructor(component: ComponentInstruction, child: DefaultInstruction) {
|
||||||
|
super(component, child, {});
|
||||||
|
}
|
||||||
|
|
||||||
resolveComponent(): Promise<ComponentInstruction> {
|
resolveComponent(): Promise<ComponentInstruction> {
|
||||||
return PromiseWrapper.resolve(this.component);
|
return PromiseWrapper.resolve(this.component);
|
||||||
@ -244,7 +245,7 @@ export class DefaultInstruction extends Instruction {
|
|||||||
export class UnresolvedInstruction extends Instruction {
|
export class UnresolvedInstruction extends Instruction {
|
||||||
constructor(private _resolver: () => Promise<Instruction>, private _urlPath: string = '',
|
constructor(private _resolver: () => Promise<Instruction>, private _urlPath: string = '',
|
||||||
private _urlParams: string[] = CONST_EXPR([])) {
|
private _urlParams: string[] = CONST_EXPR([])) {
|
||||||
super();
|
super(null, null, {});
|
||||||
}
|
}
|
||||||
|
|
||||||
get urlPath(): string {
|
get urlPath(): string {
|
||||||
|
@ -202,12 +202,12 @@ export class Router {
|
|||||||
return this._settleInstruction(instruction)
|
return this._settleInstruction(instruction)
|
||||||
.then((_) => this._routerCanReuse(instruction))
|
.then((_) => this._routerCanReuse(instruction))
|
||||||
.then((_) => this._canActivate(instruction))
|
.then((_) => this._canActivate(instruction))
|
||||||
.then((result) => {
|
.then((result: boolean) => {
|
||||||
if (!result) {
|
if (!result) {
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
return this._routerCanDeactivate(instruction)
|
return this._routerCanDeactivate(instruction)
|
||||||
.then((result) => {
|
.then((result: boolean) => {
|
||||||
if (result) {
|
if (result) {
|
||||||
return this.commit(instruction, _skipLocationChange)
|
return this.commit(instruction, _skipLocationChange)
|
||||||
.then((_) => {
|
.then((_) => {
|
||||||
|
@ -9,29 +9,32 @@ import 'package:angular2/src/facade/lang.dart';
|
|||||||
import 'package:angular2/src/facade/exceptions.dart';
|
import 'package:angular2/src/facade/exceptions.dart';
|
||||||
|
|
||||||
class GenericMessageBus implements MessageBus {
|
class GenericMessageBus implements MessageBus {
|
||||||
MessageBusSink sink;
|
final MessageBusSink _sink;
|
||||||
MessageBusSource source;
|
final MessageBusSource _source;
|
||||||
|
|
||||||
|
MessageBusSink get sink => _sink;
|
||||||
|
MessageBusSource get source => _source;
|
||||||
|
|
||||||
GenericMessageBus(MessageBusSink sink, MessageBusSource source)
|
GenericMessageBus(MessageBusSink sink, MessageBusSource source)
|
||||||
: sink = sink,
|
: _sink = sink,
|
||||||
source = source;
|
_source = source;
|
||||||
|
|
||||||
void attachToZone(NgZone zone) {
|
void attachToZone(NgZone zone) {
|
||||||
sink.attachToZone(zone);
|
_sink.attachToZone(zone);
|
||||||
source.attachToZone(zone);
|
_source.attachToZone(zone);
|
||||||
}
|
}
|
||||||
|
|
||||||
void initChannel(String channel, [bool runInZone = true]) {
|
void initChannel(String channel, [bool runInZone = true]) {
|
||||||
sink.initChannel(channel, runInZone);
|
_sink.initChannel(channel, runInZone);
|
||||||
source.initChannel(channel, runInZone);
|
_source.initChannel(channel, runInZone);
|
||||||
}
|
}
|
||||||
|
|
||||||
EventEmitter from(String channel) {
|
EventEmitter from(String channel) {
|
||||||
return source.from(channel);
|
return _source.from(channel);
|
||||||
}
|
}
|
||||||
|
|
||||||
EventEmitter to(String channel) {
|
EventEmitter to(String channel) {
|
||||||
return sink.to(channel);
|
return _sink.to(channel);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -9,8 +9,6 @@ import {
|
|||||||
LocationStrategy
|
LocationStrategy
|
||||||
} from 'angular2/router';
|
} from 'angular2/router';
|
||||||
|
|
||||||
import {reflector} from 'angular2/src/core/reflection/reflection';
|
|
||||||
import {ReflectionCapabilities} from 'angular2/src/core/reflection/reflection_capabilities';
|
|
||||||
|
|
||||||
@Component({selector: 'hello-cmp', template: `hello`})
|
@Component({selector: 'hello-cmp', template: `hello`})
|
||||||
class HelloCmp {
|
class HelloCmp {
|
||||||
@ -46,7 +44,6 @@ class AppCmp {
|
|||||||
|
|
||||||
|
|
||||||
export function main() {
|
export function main() {
|
||||||
reflector.reflectionCapabilities = new ReflectionCapabilities();
|
|
||||||
bootstrap(AppCmp,
|
bootstrap(AppCmp,
|
||||||
[ROUTER_PROVIDERS, provide(LocationStrategy, {useClass: HashLocationStrategy})]);
|
[ROUTER_PROVIDERS, provide(LocationStrategy, {useClass: HashLocationStrategy})]);
|
||||||
}
|
}
|
||||||
|
@ -34,7 +34,7 @@
|
|||||||
</p>
|
</p>
|
||||||
|
|
||||||
<section>
|
<section>
|
||||||
<form (submit)="submit('form submit')">
|
<form (submit)="submit('form submit', $event)">
|
||||||
<button mdButton>SUBMIT</button>
|
<button mdButton>SUBMIT</button>
|
||||||
<button>Native button</button>
|
<button>Native button</button>
|
||||||
</form>
|
</form>
|
||||||
|
@ -72,7 +72,8 @@ class RawEntity extends Object
|
|||||||
}
|
}
|
||||||
|
|
||||||
@override
|
@override
|
||||||
operator [](String key) {
|
operator [](untypedKey) {
|
||||||
|
var key = untypedKey as String;
|
||||||
if (!key.contains('.')) {
|
if (!key.contains('.')) {
|
||||||
return _data[key];
|
return _data[key];
|
||||||
}
|
}
|
||||||
@ -102,7 +103,8 @@ class RawEntity extends Object
|
|||||||
set(String name, dynamic value) { this[name] = value; }
|
set(String name, dynamic value) { this[name] = value; }
|
||||||
|
|
||||||
@override
|
@override
|
||||||
remove(String key) {
|
remove(untypedKey) {
|
||||||
|
var key = untypedKey as String;
|
||||||
if (!key.contains('.')) {
|
if (!key.contains('.')) {
|
||||||
return _data.remove(key);
|
return _data.remove(key);
|
||||||
}
|
}
|
||||||
|
@ -1,12 +1,9 @@
|
|||||||
import {bootstrap} from 'angular2/bootstrap';
|
import {bootstrap} from 'angular2/bootstrap';
|
||||||
import {reflector} from 'angular2/src/core/reflection/reflection';
|
|
||||||
import {ReflectionCapabilities} from 'angular2/src/core/reflection/reflection_capabilities';
|
|
||||||
|
|
||||||
import {Renderer, ElementRef, Component, Directive, Injectable} from 'angular2/core';
|
import {Renderer, ElementRef, Component, Directive, Injectable} from 'angular2/core';
|
||||||
import {MyCmp} from './my_cmp/my_cmp';
|
import {MyCmp} from './my_cmp/my_cmp';
|
||||||
|
|
||||||
export function main() {
|
export function main() {
|
||||||
reflector.reflectionCapabilities = new ReflectionCapabilities();
|
|
||||||
bootstrap(RelativeApp);
|
bootstrap(RelativeApp);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -3,11 +3,7 @@ import {provide} from 'angular2/core';
|
|||||||
import {bootstrap} from 'angular2/bootstrap';
|
import {bootstrap} from 'angular2/bootstrap';
|
||||||
import {ROUTER_PROVIDERS, HashLocationStrategy, LocationStrategy} from 'angular2/router';
|
import {ROUTER_PROVIDERS, HashLocationStrategy, LocationStrategy} from 'angular2/router';
|
||||||
|
|
||||||
import {reflector} from 'angular2/src/core/reflection/reflection';
|
|
||||||
import {ReflectionCapabilities} from 'angular2/src/core/reflection/reflection_capabilities';
|
|
||||||
|
|
||||||
export function main() {
|
export function main() {
|
||||||
reflector.reflectionCapabilities = new ReflectionCapabilities();
|
|
||||||
bootstrap(InboxApp,
|
bootstrap(InboxApp,
|
||||||
[ROUTER_PROVIDERS, provide(LocationStrategy, {useClass: HashLocationStrategy})]);
|
[ROUTER_PROVIDERS, provide(LocationStrategy, {useClass: HashLocationStrategy})]);
|
||||||
}
|
}
|
||||||
|
@ -11,7 +11,8 @@ source $SCRIPT_DIR/env_dart.sh
|
|||||||
cd $SCRIPT_DIR/../..
|
cd $SCRIPT_DIR/../..
|
||||||
|
|
||||||
# Variables
|
# Variables
|
||||||
DDC_WARNING_CAP="180"
|
DDC_TOTAL_WARNING_CAP="1000"
|
||||||
|
DDC_TOTAL_ERROR_CAP="2"
|
||||||
DDC_DIR=`pwd`/tmp/dev_compiler
|
DDC_DIR=`pwd`/tmp/dev_compiler
|
||||||
DDC_VERSION="0.1.14"
|
DDC_VERSION="0.1.14"
|
||||||
|
|
||||||
@ -25,6 +26,7 @@ git clone https://github.com/dart-lang/dev_compiler.git tmp/dev_compiler
|
|||||||
|
|
||||||
# Convert TypeScript to Dart
|
# Convert TypeScript to Dart
|
||||||
./node_modules/.bin/gulp build/packages.dart
|
./node_modules/.bin/gulp build/packages.dart
|
||||||
|
./node_modules/.bin/gulp build.dart.material.css
|
||||||
./node_modules/.bin/gulp build/pubspec.dart
|
./node_modules/.bin/gulp build/pubspec.dart
|
||||||
node ./scripts/ci/dart_experimental/pubspec_for_ddc.js \
|
node ./scripts/ci/dart_experimental/pubspec_for_ddc.js \
|
||||||
--pubspec-file=dist/dart/playground/pubspec.yaml
|
--pubspec-file=dist/dart/playground/pubspec.yaml
|
||||||
@ -36,7 +38,32 @@ cd build/web
|
|||||||
LOG_FILE="analyzer.log"
|
LOG_FILE="analyzer.log"
|
||||||
set +e
|
set +e
|
||||||
$DART_SDK/bin/dart $DDC_DIR/bin/dartdevc.dart \
|
$DART_SDK/bin/dart $DDC_DIR/bin/dartdevc.dart \
|
||||||
--dart-sdk=$DART_SDK_LIB_SEARCH_PATH -o out src/hello_world/index.dart \
|
--dart-sdk=$DART_SDK_LIB_SEARCH_PATH -o out \
|
||||||
|
src/animate/index.dart \
|
||||||
|
src/async/index.dart \
|
||||||
|
src/gestures/index.dart \
|
||||||
|
src/hash_routing/index.dart \
|
||||||
|
src/hello_world/index.dart \
|
||||||
|
src/key_events/index.dart \
|
||||||
|
src/material/button/index.dart \
|
||||||
|
src/material/checkbox/index.dart \
|
||||||
|
src/material/dialog/index.dart \
|
||||||
|
src/material/grid_list/index.dart \
|
||||||
|
src/material/input/index.dart \
|
||||||
|
src/material/progress-linear/index.dart \
|
||||||
|
src/material/radio/index.dart \
|
||||||
|
src/material/switcher/index.dart \
|
||||||
|
src/model_driven_forms/index.dart \
|
||||||
|
src/observable_models/index.dart \
|
||||||
|
src/order_management/index.dart \
|
||||||
|
src/person_management/index.dart \
|
||||||
|
src/relative_assets/index.dart \
|
||||||
|
src/routing/index.dart \
|
||||||
|
src/sourcemap/index.dart \
|
||||||
|
src/svg/index.dart \
|
||||||
|
src/template_driven_forms/index.dart \
|
||||||
|
src/todo/index.dart \
|
||||||
|
src/zippy_component/index.dart \
|
||||||
>$LOG_FILE
|
>$LOG_FILE
|
||||||
EXIT_CODE=`echo $?`
|
EXIT_CODE=`echo $?`
|
||||||
set -e
|
set -e
|
||||||
@ -53,7 +80,7 @@ fi
|
|||||||
cat $LOG_FILE
|
cat $LOG_FILE
|
||||||
WARNING_COUNT=`cat $LOG_FILE | wc -l | sed -e 's/^[[:space:]]*//'`
|
WARNING_COUNT=`cat $LOG_FILE | wc -l | sed -e 's/^[[:space:]]*//'`
|
||||||
|
|
||||||
if [[ "$WARNING_COUNT" -gt "$DDC_WARNING_CAP" ]]
|
if [[ "$WARNING_COUNT" -gt "$DDC_TOTAL_WARNING_CAP" ]]
|
||||||
then
|
then
|
||||||
echo "Too many warnings: $WARNING_COUNT"
|
echo "Too many warnings: $WARNING_COUNT"
|
||||||
exit 1
|
exit 1
|
||||||
@ -61,14 +88,8 @@ else
|
|||||||
echo "Warning count ok"
|
echo "Warning count ok"
|
||||||
fi
|
fi
|
||||||
|
|
||||||
function countWarnings {
|
ERROR_COUNT=`cat $LOG_FILE | grep -E '^severe.*' | wc -l | sed -e 's/^[[:space:]]*//'`
|
||||||
local GREP_PATTERN=$1
|
if [[ "$ERROR_COUNT" -gt "$DDC_TOTAL_ERROR_CAP" ]]
|
||||||
local COUNT=`cat $LOG_FILE | grep -E '$GREP_PATTERN' | wc -l | sed -e 's/^[[:space:]]*//'`
|
|
||||||
echo $COUNT
|
|
||||||
}
|
|
||||||
|
|
||||||
SEVERE_ANGULAR_COUNT=$(countWarnings '^severe.*package:angular2')
|
|
||||||
if [[ "$SEVERE_ANGULAR_COUNT" -gt "0" ]]
|
|
||||||
then
|
then
|
||||||
echo "Found severe errors in angular2 package"
|
echo "Found severe errors in angular2 package"
|
||||||
exit 1
|
exit 1
|
||||||
|
Loading…
x
Reference in New Issue
Block a user