Skip to content

Commit 3e65d14

Browse files
committed
fix(Dart): make some playground samples run with Dart Dev Compiler
Resolve all invalid field override errors, workaround current reflection limitations in Dart Dev Compiler. todo, hello_world and key_events samples now work with Dart Dev Compiler. BREAKING CHANGE: remove TemplateRef.elementRef setter Closes #6441
1 parent a4b5cb8 commit 3e65d14

File tree

6 files changed

+18
-12
lines changed

6 files changed

+18
-12
lines changed

modules/angular2/src/core/linker/template_ref.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,7 @@ export abstract class TemplateRef {
2525
*
2626
*/
2727
// TODO(i): rename to anchor or location
28-
elementRef: ElementRef;
28+
get elementRef(): ElementRef { return null; }
2929
}
3030

3131
export class TemplateRef_ extends TemplateRef {

modules/angular2/src/facade/exceptions.dart

Lines changed: 12 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -4,26 +4,28 @@ import 'exception_handler.dart';
44
export 'exception_handler.dart';
55

66
class BaseException extends Error {
7-
final String message;
7+
final String _message;
88

9-
BaseException([this.message]);
9+
BaseException([this._message]);
10+
11+
String get message => _message;
1012

1113
String toString() {
1214
return this.message;
1315
}
1416
}
1517

1618
class WrappedException extends Error {
17-
final dynamic context;
18-
final String wrapperMessage;
19+
final dynamic _context;
20+
final String _wrapperMessage;
1921
final originalException;
2022
final originalStack;
2123

2224
WrappedException(
23-
[this.wrapperMessage,
25+
[this._wrapperMessage,
2426
this.originalException,
2527
this.originalStack,
26-
this.context]);
28+
this._context]);
2729

2830
get message {
2931
return ExceptionHandler.exceptionToString(this);
@@ -32,6 +34,10 @@ class WrappedException extends Error {
3234
String toString() {
3335
return this.message;
3436
}
37+
38+
dynamic get context => _context;
39+
40+
String get wrapperMessage => _wrapperMessage;
3541
}
3642

3743
Error makeTypeError([String message = ""]) {

modules/angular2/src/platform/dom/dom_adapter.ts

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -30,7 +30,10 @@ export abstract class DomAdapter {
3030
* Maps attribute names to their corresponding property names for cases
3131
* where attribute name doesn't match property name.
3232
*/
33-
attrToPropMap: {[key: string]: string};
33+
get attrToPropMap(): {[key: string]: string} { return this._attrToPropMap; };
34+
set attrToPropMap(value: {[key: string]: string}) { this._attrToPropMap = value; };
35+
/** @internal */
36+
_attrToPropMap: {[key: string]: string};
3437

3538
abstract parse(templateHtml: string);
3639
abstract query(selector: string): any;

modules/angular2/src/platform/dom/events/dom_events.ts

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -4,8 +4,6 @@ import {EventManagerPlugin, EventManager} from './event_manager';
44

55
@Injectable()
66
export class DomEventsPlugin extends EventManagerPlugin {
7-
manager: EventManager;
8-
97
// This plugin should come last in the list of plugins, because it accepts all
108
// events.
119
supports(eventName: string): boolean { return true; }

modules/angular2/test/public_api_spec.ts

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1224,7 +1224,6 @@ var NG_CORE = [
12241224
'SimpleChange.isFirstChange()',
12251225
'TemplateRef',
12261226
'TemplateRef.elementRef',
1227-
'TemplateRef.elementRef=',
12281227
/*
12291228
Abstract method
12301229
'TemplateRef.hasLocal()',

modules_dart/transform/lib/src/transform/template_compiler/change_detector_codegen.dart

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -225,7 +225,7 @@ class _CodegenState {
225225
List<String> codes = [];
226226
_endOfBlockIdxs.clear();
227227

228-
ListWrapper.forEachWithIndex(eb.records, (r, i) {
228+
ListWrapper.forEachWithIndex(eb.records, (_, i) {
229229
var code;
230230
var r = eb.records[i];
231231

0 commit comments

Comments
 (0)