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
}
@Injectable() export class Lexer {
@Injectable()
export class Lexer {
tokenize(text: string): List<any> {
var scanner = new _Scanner(text);
var tokens = [];

View File

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

View File

@ -172,8 +172,7 @@ export function iit(name, fn) {
// gives us bad error messages in tests.
// The only way to do this in Jasmine is to monkey patch a method
// to the object :-(
Map.prototype['jasmineToString'] =
function() {
Map.prototype['jasmineToString'] = function() {
var m = this;
if (!m) {
return '' + m;
@ -181,7 +180,7 @@ Map.prototype['jasmineToString'] =
var res = [];
m.forEach((v, k) => { res.push(`${k}:${v}`); });
return `{ ${res.join(',')} }`;
}
};
_global.beforeEach(function() {
jasmine.addMatchers({
@ -210,10 +209,7 @@ Map.prototype['jasmineToString'] =
return {
compare: function(actual, expectedClass) {
var pass = typeof actual === 'object' && typeof actual.then === 'function';
return {
pass: pass,
get message() { return 'Expected ' + actual + ' to be a promise'; }
};
return {pass: pass, get message() { return 'Expected ' + actual + ' to be a promise'; }};
}
};
},
@ -238,9 +234,7 @@ Map.prototype['jasmineToString'] =
var actualText = elementText(actual);
return {
pass: actualText == expectedText,
get message() {
return 'Expected ' + actualText + ' to be equal to ' + expectedText;
}
get message() { return 'Expected ' + actualText + ' to be equal to ' + expectedText; }
};
}
};

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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