Skip to content

Commit

Permalink
fix(Dart): make some playground samples run with Dart Dev Compiler
Browse files Browse the repository at this point in the history
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
  • Loading branch information
jacob314 committed Jan 21, 2016
1 parent a4b5cb8 commit 3e65d14
Show file tree
Hide file tree
Showing 6 changed files with 18 additions and 12 deletions.
2 changes: 1 addition & 1 deletion modules/angular2/src/core/linker/template_ref.ts
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ export abstract class TemplateRef {
*
*/
// TODO(i): rename to anchor or location
elementRef: ElementRef;
get elementRef(): ElementRef { return null; }
}

export class TemplateRef_ extends TemplateRef {
Expand Down
18 changes: 12 additions & 6 deletions modules/angular2/src/facade/exceptions.dart
Original file line number Diff line number Diff line change
Expand Up @@ -4,26 +4,28 @@ import 'exception_handler.dart';
export 'exception_handler.dart';

class BaseException extends Error {
final String message;
final String _message;

BaseException([this.message]);
BaseException([this._message]);

String get message => _message;

String toString() {
return this.message;
}
}

class WrappedException extends Error {
final dynamic context;
final String wrapperMessage;
final dynamic _context;
final String _wrapperMessage;
final originalException;
final originalStack;

WrappedException(
[this.wrapperMessage,
[this._wrapperMessage,
this.originalException,
this.originalStack,
this.context]);
this._context]);

get message {
return ExceptionHandler.exceptionToString(this);
Expand All @@ -32,6 +34,10 @@ class WrappedException extends Error {
String toString() {
return this.message;
}

dynamic get context => _context;

String get wrapperMessage => _wrapperMessage;
}

Error makeTypeError([String message = ""]) {
Expand Down
5 changes: 4 additions & 1 deletion modules/angular2/src/platform/dom/dom_adapter.ts
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,10 @@ export abstract class DomAdapter {
* Maps attribute names to their corresponding property names for cases
* where attribute name doesn't match property name.
*/
attrToPropMap: {[key: string]: string};
get attrToPropMap(): {[key: string]: string} { return this._attrToPropMap; };
set attrToPropMap(value: {[key: string]: string}) { this._attrToPropMap = value; };
/** @internal */
_attrToPropMap: {[key: string]: string};

abstract parse(templateHtml: string);
abstract query(selector: string): any;
Expand Down
2 changes: 0 additions & 2 deletions modules/angular2/src/platform/dom/events/dom_events.ts
Original file line number Diff line number Diff line change
Expand Up @@ -4,8 +4,6 @@ import {EventManagerPlugin, EventManager} from './event_manager';

@Injectable()
export class DomEventsPlugin extends EventManagerPlugin {
manager: EventManager;

// This plugin should come last in the list of plugins, because it accepts all
// events.
supports(eventName: string): boolean { return true; }
Expand Down
1 change: 0 additions & 1 deletion modules/angular2/test/public_api_spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -1224,7 +1224,6 @@ var NG_CORE = [
'SimpleChange.isFirstChange()',
'TemplateRef',
'TemplateRef.elementRef',
'TemplateRef.elementRef=',
/*
Abstract method
'TemplateRef.hasLocal()',
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -225,7 +225,7 @@ class _CodegenState {
List<String> codes = [];
_endOfBlockIdxs.clear();

ListWrapper.forEachWithIndex(eb.records, (r, i) {
ListWrapper.forEachWithIndex(eb.records, (_, i) {
var code;
var r = eb.records[i];

Expand Down

0 comments on commit 3e65d14

Please sign in to comment.