Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(18)

Side by Side Diff: test/codegen/expect/expect.js

Issue 1249043006: fix truncate call to use extension method (Closed) Base URL: git@github.com:dart-lang/dev_compiler.git@master
Patch Set: format Created 5 years, 5 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
« no previous file with comments | « test/codegen/expect/DeltaBlue.js ('k') | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 dart_library.library('expect', null, /* Imports */[ 1 dart_library.library('expect', null, /* Imports */[
2 "dart_runtime/dart", 2 "dart_runtime/dart",
3 'dart/core' 3 'dart/core'
4 ], /* Lazy imports */[ 4 ], /* Lazy imports */[
5 ], function(exports, dart, core) { 5 ], function(exports, dart, core) {
6 'use strict'; 6 'use strict';
7 let dartx = dart.dartx; 7 let dartx = dart.dartx;
8 class Expect extends core.Object { 8 class Expect extends core.Object {
9 static _truncateString(string, start, end, length) { 9 static _truncateString(string, start, end, length) {
10 if (dart.notNull(end) - dart.notNull(start) > dart.notNull(length)) { 10 if (dart.notNull(end) - dart.notNull(start) > dart.notNull(length)) {
11 end = dart.notNull(start) + dart.notNull(length); 11 end = dart.notNull(start) + dart.notNull(length);
12 } else if (dart.notNull(end) - dart.notNull(start) < dart.notNull(length)) { 12 } else if (dart.notNull(end) - dart.notNull(start) < dart.notNull(length)) {
13 let overflow = dart.notNull(length) - (dart.notNull(end) - dart.notNull( start)); 13 let overflow = dart.notNull(length) - (dart.notNull(end) - dart.notNull( start));
14 if (dart.notNull(overflow) > 10) 14 if (dart.notNull(overflow) > 10)
15 overflow = 10; 15 overflow = 10;
16 start = dart.notNull(start) - ((dart.notNull(overflow) + 1) / 2).truncat e(); 16 start = dart.notNull(start) - ((dart.notNull(overflow) + 1) / 2)[dartx.t runcate]();
17 end = dart.notNull(end) + (dart.notNull(overflow) / 2).truncate(); 17 end = dart.notNull(end) + (dart.notNull(overflow) / 2)[dartx.truncate]() ;
18 if (dart.notNull(start) < 0) 18 if (dart.notNull(start) < 0)
19 start = 0; 19 start = 0;
20 if (dart.notNull(end) > dart.notNull(string[dartx.length])) 20 if (dart.notNull(end) > dart.notNull(string[dartx.length]))
21 end = string[dartx.length]; 21 end = string[dartx.length];
22 } 22 }
23 if (start == 0 && end == string[dartx.length]) 23 if (start == 0 && end == string[dartx.length])
24 return string; 24 return string;
25 let buf = new core.StringBuffer(); 25 let buf = new core.StringBuffer();
26 if (dart.notNull(start) > 0) 26 if (dart.notNull(start) > 0)
27 buf.write("..."); 27 buf.write("...");
28 for (let i = start; dart.notNull(i) < dart.notNull(end); i = dart.notNull( i) + 1) { 28 for (let i = start; dart.notNull(i) < dart.notNull(end); i = dart.notNull( i) + 1) {
29 let code = string[dartx.codeUnitAt](i); 29 let code = string[dartx.codeUnitAt](i);
30 if (dart.notNull(code) < 32) { 30 if (dart.notNull(code) < 32) {
31 buf.write("\\x"); 31 buf.write("\\x");
32 buf.write("0123456789abcdef"[dartx.get]((dart.notNull(code) / 16).trun cate())); 32 buf.write("0123456789abcdef"[dartx.get]((dart.notNull(code) / 16)[dart x.truncate]()));
33 buf.write("0123456789abcdef"[dartx.get](dart.notNull(code) % 16)); 33 buf.write("0123456789abcdef"[dartx.get](dart.notNull(code) % 16));
34 } else { 34 } else {
35 buf.writeCharCode(string[dartx.codeUnitAt](i)); 35 buf.writeCharCode(string[dartx.codeUnitAt](i));
36 } 36 }
37 } 37 }
38 if (dart.notNull(end) < dart.notNull(string[dartx.length])) 38 if (dart.notNull(end) < dart.notNull(string[dartx.length]))
39 buf.write("..."); 39 buf.write("...");
40 return dart.toString(buf); 40 return dart.toString(buf);
41 } 41 }
42 static _stringDifference(expected, actual) { 42 static _stringDifference(expected, actual) {
(...skipping 289 matching lines...) Expand 10 before | Expand all | Expand 10 after
332 dart.setSignature(AssumeDynamic, { 332 dart.setSignature(AssumeDynamic, {
333 constructors: () => ({AssumeDynamic: [AssumeDynamic, []]}) 333 constructors: () => ({AssumeDynamic: [AssumeDynamic, []]})
334 }); 334 });
335 // Exports: 335 // Exports:
336 exports.Expect = Expect; 336 exports.Expect = Expect;
337 exports.ExpectException = ExpectException; 337 exports.ExpectException = ExpectException;
338 exports.NoInline = NoInline; 338 exports.NoInline = NoInline;
339 exports.TrustTypeAnnotations = TrustTypeAnnotations; 339 exports.TrustTypeAnnotations = TrustTypeAnnotations;
340 exports.AssumeDynamic = AssumeDynamic; 340 exports.AssumeDynamic = AssumeDynamic;
341 }); 341 });
OLDNEW
« no previous file with comments | « test/codegen/expect/DeltaBlue.js ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698