chore: update files to match clang-format 1.0.21.

This commit is contained in:
Martin Probst 2015-06-19 10:18:44 -07:00
parent 254e58c28f
commit 920982c4e8
14 changed files with 383 additions and 337 deletions

View File

@ -17,7 +17,8 @@ enum TokenType {
NUMBER NUMBER
} }
@Injectable() export class Lexer { @Injectable()
export class Lexer {
tokenize(text: string): List<any> { tokenize(text: string): List<any> {
var scanner = new _Scanner(text); var scanner = new _Scanner(text);
var tokens = []; var tokens = [];

View File

@ -28,12 +28,11 @@ export function assertionsEnabled(): boolean {
// TODO: remove calls to assert in production environment // TODO: remove calls to assert in production environment
// Note: Can't just export this and import in in other files // Note: Can't just export this and import in in other files
// as `assert` is a reserved keyword in Dart // as `assert` is a reserved keyword in Dart
_global.assert = _global.assert = function assert(condition) {
function assert(condition) {
if (assertionsEnabled_) { if (assertionsEnabled_) {
_global['assert'].call(condition); _global['assert'].call(condition);
} }
} };
// This function is needed only to properly support Dart's const expressions // This function is needed only to properly support Dart's const expressions
// see https://github.com/angular/ts2dart/pull/151 for more info // see https://github.com/angular/ts2dart/pull/151 for more info
export function CONST_EXPR<T>(expr: T): T { export function CONST_EXPR<T>(expr: T): T {

View File

@ -1,12 +1,47 @@
export enum RequestModesOpts {
Cors,
NoCors,
SameOrigin
}
export enum RequestModesOpts {Cors, NoCors, SameOrigin}; export enum RequestCacheOpts {
Default,
NoStore,
Reload,
NoCache,
ForceCache,
OnlyIfCached
}
export enum RequestCacheOpts {Default, NoStore, Reload, NoCache, ForceCache, OnlyIfCached}; export enum RequestCredentialsOpts {
Omit,
SameOrigin,
Include
}
export enum RequestCredentialsOpts {Omit, SameOrigin, Include}; export enum RequestMethods {
GET,
POST,
PUT,
DELETE,
OPTIONS,
HEAD,
PATCH
}
export enum RequestMethods {GET, POST, PUT, DELETE, OPTIONS, HEAD, PATCH}; export enum ReadyStates {
UNSENT,
OPEN,
HEADERS_RECEIVED,
LOADING,
DONE,
CANCELLED
}
export enum ReadyStates {UNSENT, OPEN, HEADERS_RECEIVED, LOADING, DONE, CANCELLED}; export enum ResponseTypes {
Basic,
export enum ResponseTypes {Basic, Cors, Default, Error, Opaque} Cors,
Default,
Error,
Opaque
}

View File

@ -172,8 +172,7 @@ export function iit(name, fn) {
// gives us bad error messages in tests. // gives us bad error messages in tests.
// The only way to do this in Jasmine is to monkey patch a method // The only way to do this in Jasmine is to monkey patch a method
// to the object :-( // to the object :-(
Map.prototype['jasmineToString'] = Map.prototype['jasmineToString'] = function() {
function() {
var m = this; var m = this;
if (!m) { if (!m) {
return '' + m; return '' + m;
@ -181,9 +180,9 @@ Map.prototype['jasmineToString'] =
var res = []; var res = [];
m.forEach((v, k) => { res.push(`${k}:${v}`); }); m.forEach((v, k) => { res.push(`${k}:${v}`); });
return `{ ${res.join(',')} }`; return `{ ${res.join(',')} }`;
} };
_global.beforeEach(function() { _global.beforeEach(function() {
jasmine.addMatchers({ jasmine.addMatchers({
// Custom handler for Map as Jasmine does not support it yet // Custom handler for Map as Jasmine does not support it yet
toEqual: function(util, customEqualityTesters) { toEqual: function(util, customEqualityTesters) {
@ -210,10 +209,7 @@ Map.prototype['jasmineToString'] =
return { return {
compare: function(actual, expectedClass) { compare: function(actual, expectedClass) {
var pass = typeof actual === 'object' && typeof actual.then === 'function'; var pass = typeof actual === 'object' && typeof actual.then === 'function';
return { return {pass: pass, get message() { return 'Expected ' + actual + ' to be a promise'; }};
pass: pass,
get message() { return 'Expected ' + actual + ' to be a promise'; }
};
} }
}; };
}, },
@ -238,9 +234,7 @@ Map.prototype['jasmineToString'] =
var actualText = elementText(actual); var actualText = elementText(actual);
return { return {
pass: actualText == expectedText, pass: actualText == expectedText,
get message() { get message() { return 'Expected ' + actualText + ' to be equal to ' + expectedText; }
return 'Expected ' + actualText + ' to be equal to ' + expectedText;
}
}; };
} }
}; };
@ -268,7 +262,7 @@ Map.prototype['jasmineToString'] =
}; };
} }
}); });
}); });
export interface GuinessCompatibleSpy extends jasmine.Spy { export interface GuinessCompatibleSpy extends jasmine.Spy {
/** By chaining the spy with and.returnValue, all calls to the function will return a specific /** By chaining the spy with and.returnValue, all calls to the function will return a specific

View File

@ -237,14 +237,18 @@ class _DirectiveUpdating {
'noCallbacks': new _DirectiveUpdating( 'noCallbacks': new _DirectiveUpdating(
[_DirectiveUpdating.updateA('1', _DirectiveUpdating.recordNoCallbacks)], [_DirectiveUpdating.updateA('1', _DirectiveUpdating.recordNoCallbacks)],
[_DirectiveUpdating.recordNoCallbacks]), [_DirectiveUpdating.recordNoCallbacks]),
'readingDirectives': new _DirectiveUpdating([ 'readingDirectives':
BindingRecord.createForHostProperty(new DirectiveIndex(0, 0), new _DirectiveUpdating(
_getParser().parseBinding('a', 'location'), PROP_NAME) [
BindingRecord.createForHostProperty(
new DirectiveIndex(0, 0), _getParser().parseBinding('a', 'location'), PROP_NAME)
], ],
[_DirectiveUpdating.basicRecords[0]]), [_DirectiveUpdating.basicRecords[0]]),
'interpolation': new _DirectiveUpdating([ 'interpolation':
BindingRecord.createForElement(_getParser().parseInterpolation('B{{a}}A', 'location'), 0, new _DirectiveUpdating(
PROP_NAME) [
BindingRecord.createForElement(_getParser().parseInterpolation('B{{a}}A', 'location'),
0, PROP_NAME)
], ],
[]) [])
}; };

View File

@ -317,7 +317,8 @@ export function main() {
var mainProtoView = var mainProtoView =
createProtoView([createComponentElementBinder(directiveResolver, NestedComponent)]); createProtoView([createComponentElementBinder(directiveResolver, NestedComponent)]);
var nestedProtoView = createProtoView(); var nestedProtoView = createProtoView();
var compiler = createCompiler([ var compiler = createCompiler(
[
createRenderProtoView([createRenderComponentElementBinder(0)]), createRenderProtoView([createRenderComponentElementBinder(0)]),
createRenderProtoView() createRenderProtoView()
], ],

View File

@ -14,26 +14,22 @@ describe('ng2 naive infinite scroll benchmark', function() {
var cells = `${ allScrollItems } .row *`; var cells = `${ allScrollItems } .row *`;
var stageButtons = `${ allScrollItems } .row stage-buttons button`; var stageButtons = `${ allScrollItems } .row stage-buttons button`;
var count = var count = function(selector) {
function(selector) {
return browser.executeScript(`return ` + return browser.executeScript(`return ` +
`document.querySelectorAll("${ selector }").length;`); `document.querySelectorAll("${ selector }").length;`);
} };
var clickFirstOf = var clickFirstOf = function(selector) {
function(selector) {
return browser.executeScript(`document.querySelector("${ selector }").click();`); return browser.executeScript(`document.querySelector("${ selector }").click();`);
} };
var firstTextOf = var firstTextOf = function(selector) {
function(selector) {
return browser.executeScript(`return ` + return browser.executeScript(`return ` +
`document.querySelector("${ selector }").innerText;`); `document.querySelector("${ selector }").innerText;`);
} };
// Make sure rows are rendered // Make sure rows are rendered
count(allScrollItems) count(allScrollItems).then(function(c) { expect(c).toEqual(expectedRowCount); });
.then(function(c) { expect(c).toEqual(expectedRowCount); });
// Make sure cells are rendered // Make sure cells are rendered
count(cells).then(function(c) { expect(c).toEqual(expectedRowCount * expectedCellsPerRow); }); count(cells).then(function(c) { expect(c).toEqual(expectedRowCount * expectedCellsPerRow); });
@ -47,10 +43,9 @@ describe('ng2 naive infinite scroll benchmark', function() {
firstTextOf(`${ stageButtons }:enabled`) firstTextOf(`${ stageButtons }:enabled`)
.then(function(text) { expect(text).toEqual('Won'); }) .then(function(text) { expect(text).toEqual('Won'); })
}); });
}) });
$("#reset-btn") $("#reset-btn").click();
.click();
$("#run-btn").click(); $("#run-btn").click();
browser.wait(() => { browser.wait(() => {
return $('#done').getText().then(function() { return true; }, function() { return false; }); return $('#done').getText().then(function() { return true; }, function() { return false; });

View File

@ -24,7 +24,8 @@ function loadTemplate(templateId, repeatCount) {
} }
angular.module('app', []) angular.module('app', [])
.directive('dir0', [ .directive('dir0',
[
'$parse', '$parse',
function($parse) { function($parse) {
return { return {
@ -35,7 +36,8 @@ angular.module('app', [])
}; };
} }
]) ])
.directive('dir1', [ .directive('dir1',
[
'$parse', '$parse',
function($parse) { function($parse) {
return { return {
@ -46,7 +48,8 @@ angular.module('app', [])
}; };
} }
]) ])
.directive('dir2', [ .directive('dir2',
[
'$parse', '$parse',
function($parse) { function($parse) {
return { return {
@ -57,7 +60,8 @@ angular.module('app', [])
}; };
} }
]) ])
.directive('dir3', [ .directive('dir3',
[
'$parse', '$parse',
function($parse) { function($parse) {
return { return {
@ -68,7 +72,8 @@ angular.module('app', [])
}; };
} }
]) ])
.directive('dir4', [ .directive('dir4',
[
'$parse', '$parse',
function($parse) { function($parse) {
return { return {

View File

@ -19,7 +19,8 @@ angular.module('app', [])
}) })
// special directive for "if" as angular 1.3 does not support // special directive for "if" as angular 1.3 does not support
// recursive components. // recursive components.
.directive('treeIf', [ .directive('treeIf',
[
'$compile', '$compile',
'$parse', '$parse',
function($compile, $parse) { function($compile, $parse) {
@ -44,8 +45,8 @@ angular.module('app', [])
} }
if (newValue) { if (newValue) {
childScope = $scope.$new(); childScope = $scope.$new();
childElement = childElement = transclude(childScope,
transclude(childScope, function(clone) { $element.append(clone); }); function(clone) { $element.append(clone); });
} }
}); });
} }

View File

@ -26,7 +26,8 @@ export class SampleDescription {
var _BINDINGS = [ var _BINDINGS = [
bind(SampleDescription) bind(SampleDescription)
.toFactory((metric, id, forceGc, userAgent, validator, defaultDesc, userDesc) => .toFactory((metric, id, forceGc, userAgent, validator, defaultDesc, userDesc) =>
new SampleDescription(id, [ new SampleDescription(id,
[
{'forceGc': forceGc, 'userAgent': userAgent}, {'forceGc': forceGc, 'userAgent': userAgent},
validator.describe(), validator.describe(),
defaultDesc, defaultDesc,

View File

@ -333,7 +333,8 @@ export function main() {
describe('frame metrics', () => { describe('frame metrics', () => {
it('should calculate mean frame time', inject([AsyncTestCompleter], (async) => { it('should calculate mean frame time', inject([AsyncTestCompleter], (async) => {
aggregate([ aggregate(
[
eventFactory.markStart('frameCapture', 0), eventFactory.markStart('frameCapture', 0),
eventFactory.instant('frame', 1), eventFactory.instant('frame', 1),
eventFactory.instant('frame', 3), eventFactory.instant('frame', 3),
@ -372,7 +373,8 @@ export function main() {
it('should throw if trying to capture twice', inject([AsyncTestCompleter], (async) => { it('should throw if trying to capture twice', inject([AsyncTestCompleter], (async) => {
PromiseWrapper.catchError( PromiseWrapper.catchError(
aggregate([ aggregate(
[
eventFactory.markStart('frameCapture', 3), eventFactory.markStart('frameCapture', 3),
eventFactory.markStart('frameCapture', 4) eventFactory.markStart('frameCapture', 4)
], ],
@ -405,7 +407,8 @@ export function main() {
})); }));
it('should calculate best and worst frame time', inject([AsyncTestCompleter], (async) => { it('should calculate best and worst frame time', inject([AsyncTestCompleter], (async) => {
aggregate([ aggregate(
[
eventFactory.markStart('frameCapture', 0), eventFactory.markStart('frameCapture', 0),
eventFactory.instant('frame', 1), eventFactory.instant('frame', 1),
eventFactory.instant('frame', 9), eventFactory.instant('frame', 9),
@ -425,7 +428,8 @@ export function main() {
it('should calculate percentage of smoothness to be good', it('should calculate percentage of smoothness to be good',
inject([AsyncTestCompleter], (async) => { inject([AsyncTestCompleter], (async) => {
aggregate([ aggregate(
[
eventFactory.markStart('frameCapture', 0), eventFactory.markStart('frameCapture', 0),
eventFactory.instant('frame', 1), eventFactory.instant('frame', 1),
eventFactory.instant('frame', 2), eventFactory.instant('frame', 2),
@ -441,7 +445,8 @@ export function main() {
it('should calculate percentage of smoothness to be bad', it('should calculate percentage of smoothness to be bad',
inject([AsyncTestCompleter], (async) => { inject([AsyncTestCompleter], (async) => {
aggregate([ aggregate(
[
eventFactory.markStart('frameCapture', 0), eventFactory.markStart('frameCapture', 0),
eventFactory.instant('frame', 1), eventFactory.instant('frame', 1),
eventFactory.instant('frame', 2), eventFactory.instant('frame', 2),
@ -591,7 +596,8 @@ export function main() {
describe('microMetrics', () => { describe('microMetrics', () => {
it('should report micro metrics', inject([AsyncTestCompleter], (async) => { it('should report micro metrics', inject([AsyncTestCompleter], (async) => {
aggregate([ aggregate(
[
eventFactory.markStart('mm1', 0), eventFactory.markStart('mm1', 0),
eventFactory.markEnd('mm1', 5), eventFactory.markEnd('mm1', 5),
], ],
@ -615,7 +621,8 @@ export function main() {
})); }));
it('should report micro metric averages', inject([AsyncTestCompleter], (async) => { it('should report micro metric averages', inject([AsyncTestCompleter], (async) => {
aggregate([ aggregate(
[
eventFactory.markStart('mm1*20', 0), eventFactory.markStart('mm1*20', 0),
eventFactory.markEnd('mm1*20', 5), eventFactory.markEnd('mm1*20', 5),
], ],

View File

@ -277,7 +277,8 @@ export function main() {
it('should throw an error on buffer overflow', inject([AsyncTestCompleter], (async) => { it('should throw an error on buffer overflow', inject([AsyncTestCompleter], (async) => {
PromiseWrapper.catchError( PromiseWrapper.catchError(
createExtension([ createExtension(
[
chromeTimelineEvents.start('FunctionCall', 1234), chromeTimelineEvents.start('FunctionCall', 1234),
], ],
'Tracing.bufferUsage') 'Tracing.bufferUsage')

View File

@ -210,8 +210,7 @@ var type: any =
if (!isType(actual, T, errors)) { if (!isType(actual, T, errors)) {
// console.log(JSON.stringify(errors, null, ' ')); // console.log(JSON.stringify(errors, null, ' '));
// TODO(vojta): print "an instance of" only if T starts with uppercase. // TODO(vojta): print "an instance of" only if T starts with uppercase.
var msg = var msg = 'Expected an instance of ' + prettyPrint(T) + ', got ' + prettyPrint(actual) + '!';
'Expected an instance of ' + prettyPrint(T) + ', got ' + prettyPrint(actual) + '!';
if (errors.length) { if (errors.length) {
msg += '\n' + formatErrors(errors); msg += '\n' + formatErrors(errors);
} }
@ -219,7 +218,7 @@ var type: any =
throw new Error(msg); throw new Error(msg);
} }
return actual; return actual;
} }
function returnType(actual, T) { function returnType(actual, T) {
var errors = []; var errors = [];
@ -303,8 +302,7 @@ function define(classOrName, check) {
return cls; return cls;
} }
var assert: any = var assert: any = function(value) {
function(value) {
return { return {
is: function is(...types) { is: function is(...types) {
// var errors = [] // var errors = []
@ -334,15 +332,15 @@ var assert: any =
return false; return false;
} }
}; };
} };
// PUBLIC API // PUBLIC API
// asserting API // asserting API
// throw if no type provided // throw if no type provided
assert.type = type; assert.type = type;
for (var prop in primitives) { for (var prop in primitives) {
assert.type[prop] = primitives[prop]; assert.type[prop] = primitives[prop];
} }

View File

@ -166,4 +166,8 @@ function pad(value, length) {
} }
enum FileStatus { ADDED, UNCHANGED, CHANGED } enum FileStatus {
ADDED,
UNCHANGED,
CHANGED
}