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

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

Issue 977153002: Fix increment on nullable (Closed) Base URL: https://github.com/dart-lang/dev_compiler.git@master
Patch Set: Remove assignments Created 5 years, 9 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
OLDNEW
1 var _js_helper; 1 var _js_helper;
2 (function(exports) { 2 (function(exports) {
3 'use strict'; 3 'use strict';
4 class _Patch extends dart.Object { 4 class _Patch extends dart.Object {
5 _Patch() { 5 _Patch() {
6 } 6 }
7 } 7 }
8 let patch = new _Patch(); 8 let patch = new _Patch();
9 class InternalMap extends dart.Object { 9 class InternalMap extends dart.Object {
10 } 10 }
(...skipping 94 matching lines...) Expand 10 before | Expand all | Expand 10 after
105 get isAccessor() { 105 get isAccessor() {
106 return this[_kind] !== METHOD; 106 return this[_kind] !== METHOD;
107 } 107 }
108 get positionalArguments() { 108 get positionalArguments() {
109 if (this.isGetter) 109 if (this.isGetter)
110 return /* Unimplemented const */new List.from([]); 110 return /* Unimplemented const */new List.from([]);
111 let argumentCount = dart.notNull(this[_arguments].length) - dart.notNull(t his[_namedArgumentNames].length); 111 let argumentCount = dart.notNull(this[_arguments].length) - dart.notNull(t his[_namedArgumentNames].length);
112 if (argumentCount === 0) 112 if (argumentCount === 0)
113 return /* Unimplemented const */new List.from([]); 113 return /* Unimplemented const */new List.from([]);
114 let list = new List.from([]); 114 let list = new List.from([]);
115 for (let index = 0; dart.notNull(index) < dart.notNull(argumentCount); dar t.notNull(index)++) { 115 for (let index = 0; dart.notNull(index) < dart.notNull(argumentCount); ind ex = dart.notNull(index) + 1) {
116 list.add(this[_arguments].get(index)); 116 list.add(this[_arguments].get(index));
117 } 117 }
118 return dart.as(makeLiteralListConst(list), core.List); 118 return dart.as(makeLiteralListConst(list), core.List);
119 } 119 }
120 get namedArguments() { 120 get namedArguments() {
121 if (this.isAccessor) 121 if (this.isAccessor)
122 return dart.map(); 122 return dart.map();
123 let namedArgumentCount = this[_namedArgumentNames].length; 123 let namedArgumentCount = this[_namedArgumentNames].length;
124 let namedArgumentsStartIndex = dart.notNull(this[_arguments].length) - dar t.notNull(namedArgumentCount); 124 let namedArgumentsStartIndex = dart.notNull(this[_arguments].length) - dar t.notNull(namedArgumentCount);
125 if (namedArgumentCount === 0) 125 if (namedArgumentCount === 0)
126 return dart.map(); 126 return dart.map();
127 let map = new core.Map(); 127 let map = new core.Map();
128 for (let i = 0; dart.notNull(i) < dart.notNull(namedArgumentCount); dart.n otNull(i)++) { 128 for (let i = 0; dart.notNull(i) < dart.notNull(namedArgumentCount); i = da rt.notNull(i) + 1) {
129 map.set(new _internal.Symbol.unvalidated(dart.as(this[_namedArgumentName s].get(i), core.String)), this[_arguments].get(dart.notNull(namedArgumentsStartI ndex) + dart.notNull(i))); 129 map.set(new _internal.Symbol.unvalidated(dart.as(this[_namedArgumentName s].get(i), core.String)), this[_arguments].get(dart.notNull(namedArgumentsStartI ndex) + dart.notNull(i)));
130 } 130 }
131 return map; 131 return map;
132 } 132 }
133 [_getCachedInvocation](object) { 133 [_getCachedInvocation](object) {
134 let interceptor = _interceptors.getInterceptor(object); 134 let interceptor = _interceptors.getInterceptor(object);
135 let receiver = object; 135 let receiver = object;
136 let name = this[_internalName]; 136 let name = this[_internalName];
137 let arguments = this[_arguments]; 137 let arguments = this[_arguments];
138 let interceptedNames = _foreign_helper.JS_EMBEDDED_GLOBAL('', dart.as(_js_ embedded_names.INTERCEPTED_NAMES, core.String)); 138 let interceptedNames = _foreign_helper.JS_EMBEDDED_GLOBAL('', dart.as(_js_ embedded_names.INTERCEPTED_NAMES, core.String));
(...skipping 104 matching lines...) Expand 10 before | Expand all | Expand 10 after
243 receiver = this.cachedInterceptor; 243 receiver = this.cachedInterceptor;
244 providedArgumentCount = dart.notNull(arguments.length) - 1; 244 providedArgumentCount = dart.notNull(arguments.length) - 1;
245 } 245 }
246 if (dart.notNull(this.info.areOptionalParametersNamed) && dart.notNull(pro videdArgumentCount) > dart.notNull(this.info.requiredParameterCount)) { 246 if (dart.notNull(this.info.areOptionalParametersNamed) && dart.notNull(pro videdArgumentCount) > dart.notNull(this.info.requiredParameterCount)) {
247 throw new UnimplementedNoSuchMethodError(`Invocation of unstubbed method '${this.info.reflectionName}'` + ` with ${arguments.length} arguments.`); 247 throw new UnimplementedNoSuchMethodError(`Invocation of unstubbed method '${this.info.reflectionName}'` + ` with ${arguments.length} arguments.`);
248 } else if (dart.notNull(providedArgumentCount) < dart.notNull(this.info.re quiredParameterCount)) { 248 } else if (dart.notNull(providedArgumentCount) < dart.notNull(this.info.re quiredParameterCount)) {
249 throw new UnimplementedNoSuchMethodError(`Invocation of unstubbed method '${this.info.reflectionName}'` + ` with ${providedArgumentCount} arguments (too few).`); 249 throw new UnimplementedNoSuchMethodError(`Invocation of unstubbed method '${this.info.reflectionName}'` + ` with ${providedArgumentCount} arguments (too few).`);
250 } else if (dart.notNull(providedArgumentCount) > dart.notNull(fullParamete rCount)) { 250 } else if (dart.notNull(providedArgumentCount) > dart.notNull(fullParamete rCount)) {
251 throw new UnimplementedNoSuchMethodError(`Invocation of unstubbed method '${this.info.reflectionName}'` + ` with ${providedArgumentCount} arguments (too many).`); 251 throw new UnimplementedNoSuchMethodError(`Invocation of unstubbed method '${this.info.reflectionName}'` + ` with ${providedArgumentCount} arguments (too many).`);
252 } 252 }
253 for (let i = providedArgumentCount; dart.notNull(i) < dart.notNull(fullPar ameterCount); dart.notNull(i)++) { 253 for (let i = providedArgumentCount; dart.notNull(i) < dart.notNull(fullPar ameterCount); i = dart.notNull(i) + 1) {
254 arguments.add(getMetadata(this.info.defaultValue(i))); 254 arguments.add(getMetadata(this.info.defaultValue(i)));
255 } 255 }
256 return this.jsFunction.apply(receiver, arguments); 256 return this.jsFunction.apply(receiver, arguments);
257 } 257 }
258 } 258 }
259 class CachedNoSuchMethodInvocation extends dart.Object { 259 class CachedNoSuchMethodInvocation extends dart.Object {
260 CachedNoSuchMethodInvocation(interceptor) { 260 CachedNoSuchMethodInvocation(interceptor) {
261 this.interceptor = interceptor; 261 this.interceptor = interceptor;
262 } 262 }
263 get isNoSuchMethod() { 263 get isNoSuchMethod() {
(...skipping 69 matching lines...) Expand 10 before | Expand all | Expand 10 after
333 if (!dart.notNull(this.areOptionalParametersNamed) || this.optionalParamet erCount === 1) { 333 if (!dart.notNull(this.areOptionalParametersNamed) || this.optionalParamet erCount === 1) {
334 return this.parameterName(parameter); 334 return this.parameterName(parameter);
335 } 335 }
336 let index = this.sortedIndex(dart.notNull(parameter) - dart.notNull(this.r equiredParameterCount)); 336 let index = this.sortedIndex(dart.notNull(parameter) - dart.notNull(this.r equiredParameterCount));
337 return this.parameterName(index); 337 return this.parameterName(index);
338 } 338 }
339 sortedIndex(unsortedIndex) { 339 sortedIndex(unsortedIndex) {
340 if (this.cachedSortedIndices === null) { 340 if (this.cachedSortedIndices === null) {
341 this.cachedSortedIndices = new core.List(this.optionalParameterCount); 341 this.cachedSortedIndices = new core.List(this.optionalParameterCount);
342 let positions = dart.map(); 342 let positions = dart.map();
343 for (let i = 0; dart.notNull(i) < dart.notNull(this.optionalParameterCou nt); dart.notNull(i)++) { 343 for (let i = 0; dart.notNull(i) < dart.notNull(this.optionalParameterCou nt); i = dart.notNull(i) + 1) {
344 let index = dart.notNull(this.requiredParameterCount) + dart.notNull(i ); 344 let index = dart.notNull(this.requiredParameterCount) + dart.notNull(i );
345 positions.set(this.parameterName(index), index); 345 positions.set(this.parameterName(index), index);
346 } 346 }
347 let index = 0; 347 let index = 0;
348 ((_) => { 348 ((_) => {
349 _.sort(); 349 _.sort();
350 return _; 350 return _;
351 }).bind(this)(positions.keys.toList()).forEach(((name) => { 351 }).bind(this)(positions.keys.toList()).forEach(((name) => {
352 this.cachedSortedIndices.set(dart.notNull(index)++, positions.get(name )); 352 this.cachedSortedIndices.set((($tmp) => index = dart.notNull($tmp) + 1 , $tmp)(index), positions.get(name));
353 }).bind(this)); 353 }).bind(this));
354 } 354 }
355 return dart.as(this.cachedSortedIndices.get(unsortedIndex), core.int); 355 return dart.as(this.cachedSortedIndices.get(unsortedIndex), core.int);
356 } 356 }
357 computeFunctionRti(jsConstructor) { 357 computeFunctionRti(jsConstructor) {
358 if (typeof this.functionType == "number") { 358 if (typeof this.functionType == "number") {
359 return getMetadata(dart.as(this.functionType, core.int)); 359 return getMetadata(dart.as(this.functionType, core.int));
360 } else if (typeof this.functionType == "function") { 360 } else if (typeof this.functionType == "function") {
361 let fakeInstance = new jsConstructor(); 361 let fakeInstance = new jsConstructor();
362 setRuntimeTypeInfo(fakeInstance, fakeInstance["<>"]); 362 setRuntimeTypeInfo(fakeInstance, fakeInstance["<>"]);
(...skipping 67 matching lines...) Expand 10 before | Expand all | Expand 10 after
430 return parseInt(source, 10); 430 return parseInt(source, 10);
431 } 431 }
432 if (dart.notNull(radix) < 10 || dart.notNull(dart.dindex(match, decima lIndex) === null)) { 432 if (dart.notNull(radix) < 10 || dart.notNull(dart.dindex(match, decima lIndex) === null)) {
433 let maxCharCode = null; 433 let maxCharCode = null;
434 if (dart.notNull(radix) <= 10) { 434 if (dart.notNull(radix) <= 10) {
435 maxCharCode = 48 + dart.notNull(radix) - 1; 435 maxCharCode = 48 + dart.notNull(radix) - 1;
436 } else { 436 } else {
437 maxCharCode = 97 + dart.notNull(radix) - 10 - 1; 437 maxCharCode = 97 + dart.notNull(radix) - 10 - 1;
438 } 438 }
439 let digitsPart = dart.as(dart.dindex(match, digitsIndex), core.Strin g); 439 let digitsPart = dart.as(dart.dindex(match, digitsIndex), core.Strin g);
440 for (let i = 0; dart.notNull(i) < dart.notNull(digitsPart.length); d art.notNull(i)++) { 440 for (let i = 0; dart.notNull(i) < dart.notNull(digitsPart.length); i = dart.notNull(i) + 1) {
441 let characterCode = dart.notNull(digitsPart.codeUnitAt(0)) | 32; 441 let characterCode = dart.notNull(digitsPart.codeUnitAt(0)) | 32;
442 if (dart.notNull(digitsPart.codeUnitAt(i)) > dart.notNull(maxCharC ode)) { 442 if (dart.notNull(digitsPart.codeUnitAt(i)) > dart.notNull(maxCharC ode)) {
443 return handleError(source); 443 return handleError(source);
444 } 444 }
445 } 445 }
446 } 446 }
447 } 447 }
448 } 448 }
449 if (match === null) 449 if (match === null)
450 return handleError(source); 450 return handleError(source);
(...skipping 239 matching lines...) Expand 10 before | Expand all | Expand 10 after
690 if (positionalArguments !== null) { 690 if (positionalArguments !== null) {
691 argumentCount = positionalArguments.length; 691 argumentCount = positionalArguments.length;
692 arguments.addAll(positionalArguments); 692 arguments.addAll(positionalArguments);
693 } 693 }
694 let names = ''; 694 let names = '';
695 if (dart.notNull(namedArguments !== null) && !dart.notNull(namedArguments. isEmpty)) { 695 if (dart.notNull(namedArguments !== null) && !dart.notNull(namedArguments. isEmpty)) {
696 namedArguments.forEach(((name, argument) => { 696 namedArguments.forEach(((name, argument) => {
697 names = `${names}$${name}`; 697 names = `${names}$${name}`;
698 namedArgumentList.add(name); 698 namedArgumentList.add(name);
699 arguments.add(argument); 699 arguments.add(argument);
700 dart.notNull(argumentCount)++; 700 argumentCount = dart.notNull(argumentCount) + 1;
701 }).bind(this)); 701 }).bind(this));
702 } 702 }
703 let selectorName = `${_foreign_helper.JS_GET_NAME("CALL_PREFIX")}$${argume ntCount}${names}`; 703 let selectorName = `${_foreign_helper.JS_GET_NAME("CALL_PREFIX")}$${argume ntCount}${names}`;
704 return dart.dinvoke(function, 'noSuchMethod', createUnmangledInvocationMir ror(dart.throw_("Unimplemented SymbolLiteral: #call"), selectorName, JSInvocatio nMirror.METHOD, arguments, namedArgumentList)); 704 return dart.dinvoke(function, 'noSuchMethod', createUnmangledInvocationMir ror(dart.throw_("Unimplemented SymbolLiteral: #call"), selectorName, JSInvocatio nMirror.METHOD, arguments, namedArgumentList));
705 } 705 }
706 static applyFunction(function, positionalArguments, namedArguments) { 706 static applyFunction(function, positionalArguments, namedArguments) {
707 return namedArguments === null ? applyFunctionWithPositionalArguments(func tion, positionalArguments) : applyFunctionWithNamedArguments(function, positiona lArguments, namedArguments); 707 return namedArguments === null ? applyFunctionWithPositionalArguments(func tion, positionalArguments) : applyFunctionWithNamedArguments(function, positiona lArguments, namedArguments);
708 } 708 }
709 static applyFunctionWithPositionalArguments(function, positionalArguments) { 709 static applyFunctionWithPositionalArguments(function, positionalArguments) {
710 let argumentCount = 0; 710 let argumentCount = 0;
(...skipping 30 matching lines...) Expand all
741 } 741 }
742 if (positionalArguments !== null) { 742 if (positionalArguments !== null) {
743 positionalArguments = new core.List.from(positionalArguments); 743 positionalArguments = new core.List.from(positionalArguments);
744 } else { 744 } else {
745 positionalArguments = new List.from([]); 745 positionalArguments = new List.from([]);
746 } 746 }
747 if (info.requiredParameterCount !== positionalArguments.length) { 747 if (info.requiredParameterCount !== positionalArguments.length) {
748 return functionNoSuchMethod(function, positionalArguments, namedArgument s); 748 return functionNoSuchMethod(function, positionalArguments, namedArgument s);
749 } 749 }
750 let defaultArguments = new core.Map(); 750 let defaultArguments = new core.Map();
751 for (let i = 0; dart.notNull(i) < dart.notNull(info.optionalParameterCount ); dart.notNull(i)++) { 751 for (let i = 0; dart.notNull(i) < dart.notNull(info.optionalParameterCount ); i = dart.notNull(i) + 1) {
752 let index = dart.notNull(i) + dart.notNull(info.requiredParameterCount); 752 let index = dart.notNull(i) + dart.notNull(info.requiredParameterCount);
753 let parameterName = info.parameterNameInOrder(index); 753 let parameterName = info.parameterNameInOrder(index);
754 let value = info.defaultValueInOrder(index); 754 let value = info.defaultValueInOrder(index);
755 let defaultValue = getMetadata(value); 755 let defaultValue = getMetadata(value);
756 defaultArguments.set(parameterName, defaultValue); 756 defaultArguments.set(parameterName, defaultValue);
757 } 757 }
758 let bad = false; 758 let bad = false;
759 namedArguments.forEach(((parameter, value) => { 759 namedArguments.forEach(((parameter, value) => {
760 if (defaultArguments.containsKey(parameter)) { 760 if (defaultArguments.containsKey(parameter)) {
761 defaultArguments.set(parameter, value); 761 defaultArguments.set(parameter, value);
(...skipping 425 matching lines...) Expand 10 before | Expand all | Expand 10 after
1187 return dart.as(dart.dload(object, 'hashCode'), core.int); 1187 return dart.as(dart.dload(object, 'hashCode'), core.int);
1188 } else { 1188 } else {
1189 return Primitives.objectHashCode(object); 1189 return Primitives.objectHashCode(object);
1190 } 1190 }
1191 } 1191 }
1192 // Function fillLiteralMap: (dynamic, Map<dynamic, dynamic>) → dynamic 1192 // Function fillLiteralMap: (dynamic, Map<dynamic, dynamic>) → dynamic
1193 function fillLiteralMap(keyValuePairs, result) { 1193 function fillLiteralMap(keyValuePairs, result) {
1194 let index = 0; 1194 let index = 0;
1195 let length = getLength(keyValuePairs); 1195 let length = getLength(keyValuePairs);
1196 while (dart.notNull(index) < dart.notNull(length)) { 1196 while (dart.notNull(index) < dart.notNull(length)) {
1197 let key = getIndex(keyValuePairs, dart.notNull(index)++); 1197 let key = getIndex(keyValuePairs, (($tmp) => index = dart.notNull($tmp) + 1, $tmp)(index));
1198 let value = getIndex(keyValuePairs, dart.notNull(index)++); 1198 let value = getIndex(keyValuePairs, (($tmp) => index = dart.notNull($tmp) + 1, $tmp)(index));
1199 result.set(key, value); 1199 result.set(key, value);
1200 } 1200 }
1201 return result; 1201 return result;
1202 } 1202 }
1203 // Function invokeClosure: (Function, dynamic, int, dynamic, dynamic, dynamic, dynamic) → dynamic 1203 // Function invokeClosure: (Function, dynamic, int, dynamic, dynamic, dynamic, dynamic) → dynamic
1204 function invokeClosure(closure, isolate, numberOfArguments, arg1, arg2, arg3, arg4) { 1204 function invokeClosure(closure, isolate, numberOfArguments, arg1, arg2, arg3, arg4) {
1205 if (numberOfArguments === 0) { 1205 if (numberOfArguments === 0) {
1206 return _foreign_helper.JS_CALL_IN_ISOLATE(isolate, () => dart.dinvokef(clo sure)); 1206 return _foreign_helper.JS_CALL_IN_ISOLATE(isolate, () => dart.dinvokef(clo sure));
1207 } else if (numberOfArguments === 1) { 1207 } else if (numberOfArguments === 1) {
1208 return _foreign_helper.JS_CALL_IN_ISOLATE(isolate, () => dart.dinvokef(clo sure, arg1)); 1208 return _foreign_helper.JS_CALL_IN_ISOLATE(isolate, () => dart.dinvokef(clo sure, arg1));
(...skipping 35 matching lines...) Expand 10 before | Expand all | Expand 10 after
1244 let callName = dart.as(function.$callName, core.String); 1244 let callName = dart.as(function.$callName, core.String);
1245 function.$reflectionInfo = reflectionInfo; 1245 function.$reflectionInfo = reflectionInfo;
1246 let info = new ReflectionInfo(function); 1246 let info = new ReflectionInfo(function);
1247 let functionType = info.functionType; 1247 let functionType = info.functionType;
1248 let prototype = isStatic ? Object.create(new TearOffClosure().constructor. prototype) : Object.create(new BoundClosure(null, null, null, null).constructor. prototype); 1248 let prototype = isStatic ? Object.create(new TearOffClosure().constructor. prototype) : Object.create(new BoundClosure(null, null, null, null).constructor. prototype);
1249 prototype.$initialize = prototype.constructor; 1249 prototype.$initialize = prototype.constructor;
1250 let constructor = isStatic ? function() { 1250 let constructor = isStatic ? function() {
1251 this.$initialize(); 1251 this.$initialize();
1252 } : isCsp ? function(a, b, c, d) { 1252 } : isCsp ? function(a, b, c, d) {
1253 this.$initialize(a, b, c, d); 1253 this.$initialize(a, b, c, d);
1254 } : new Function("a", "b", "c", "d", "this.$initialize(a,b,c,d);" + dart.n otNull(functionCounter)++); 1254 } : new Function("a", "b", "c", "d", "this.$initialize(a,b,c,d);" + (($tmp ) => functionCounter = dart.notNull($tmp) + 1, $tmp)(functionCounter));
1255 prototype.constructor = constructor; 1255 prototype.constructor = constructor;
1256 constructor.prototype = prototype; 1256 constructor.prototype = prototype;
1257 let trampoline = function; 1257 let trampoline = function;
1258 let isIntercepted = false; 1258 let isIntercepted = false;
1259 if (!dart.notNull(isStatic)) { 1259 if (!dart.notNull(isStatic)) {
1260 if (jsArguments.length == 1) { 1260 if (jsArguments.length == 1) {
1261 isIntercepted = true; 1261 isIntercepted = true;
1262 } 1262 }
1263 trampoline = forwardCallTo(receiver, function, isIntercepted); 1263 trampoline = forwardCallTo(receiver, function, isIntercepted);
1264 trampoline.$reflectionInfo = reflectionInfo; 1264 trampoline.$reflectionInfo = reflectionInfo;
(...skipping 13 matching lines...) Expand all
1278 signatureFunction = function(f, r) { 1278 signatureFunction = function(f, r) {
1279 return function() { 1279 return function() {
1280 return f.apply({$receiver: r(this)}, arguments); 1280 return f.apply({$receiver: r(this)}, arguments);
1281 }; 1281 };
1282 }(functionType, getReceiver); 1282 }(functionType, getReceiver);
1283 } else { 1283 } else {
1284 throw 'Error in reflectionInfo.'; 1284 throw 'Error in reflectionInfo.';
1285 } 1285 }
1286 prototype[_foreign_helper.JS_SIGNATURE_NAME()] = signatureFunction; 1286 prototype[_foreign_helper.JS_SIGNATURE_NAME()] = signatureFunction;
1287 prototype[callName] = trampoline; 1287 prototype[callName] = trampoline;
1288 for (let i = 1; dart.notNull(i) < dart.notNull(functions.length); dart.not Null(i)++) { 1288 for (let i = 1; dart.notNull(i) < dart.notNull(functions.length); i = dart .notNull(i) + 1) {
1289 let stub = functions.get(i); 1289 let stub = functions.get(i);
1290 let stubCallName = stub.$callName; 1290 let stubCallName = stub.$callName;
1291 if (stubCallName !== null) { 1291 if (stubCallName !== null) {
1292 prototype[stubCallName] = isStatic ? stub : forwardCallTo(receiver, st ub, isIntercepted); 1292 prototype[stubCallName] = isStatic ? stub : forwardCallTo(receiver, st ub, isIntercepted);
1293 } 1293 }
1294 } 1294 }
1295 prototype["call*"] = trampoline; 1295 prototype["call*"] = trampoline;
1296 return constructor; 1296 return constructor;
1297 } 1297 }
1298 static cspForwardCall(arity, isSuperCall, stubName, function) { 1298 static cspForwardCall(arity, isSuperCall, stubName, function) {
(...skipping 52 matching lines...) Expand 10 before | Expand all | Expand 10 after
1351 if (isIntercepted) 1351 if (isIntercepted)
1352 return forwardInterceptedCallTo(receiver, function); 1352 return forwardInterceptedCallTo(receiver, function);
1353 let stubName = dart.as(function.$stubName, core.String); 1353 let stubName = dart.as(function.$stubName, core.String);
1354 let arity = function.length; 1354 let arity = function.length;
1355 let lookedUpFunction = receiver[stubName]; 1355 let lookedUpFunction = receiver[stubName];
1356 let isSuperCall = !dart.notNull(core.identical(function, lookedUpFunction) ); 1356 let isSuperCall = !dart.notNull(core.identical(function, lookedUpFunction) );
1357 if (dart.notNull(isCsp) || dart.notNull(isSuperCall) || dart.notNull(arity ) >= 27) { 1357 if (dart.notNull(isCsp) || dart.notNull(isSuperCall) || dart.notNull(arity ) >= 27) {
1358 return cspForwardCall(arity, isSuperCall, stubName, function); 1358 return cspForwardCall(arity, isSuperCall, stubName, function);
1359 } 1359 }
1360 if (arity === 0) { 1360 if (arity === 0) {
1361 return new Function('return function(){' + `return this.${BoundClosure.s elfFieldName()}.${stubName}();` + `${dart.notNull(functionCounter)++}` + '}')(); 1361 return new Function('return function(){' + `return this.${BoundClosure.s elfFieldName()}.${stubName}();` + `${(($tmp) => functionCounter = dart.notNull($ tmp) + 1, $tmp)(functionCounter)}` + '}')();
1362 } 1362 }
1363 dart.assert(1 <= dart.notNull(arity) && dart.notNull(arity) < 27); 1363 dart.assert(1 <= dart.notNull(arity) && dart.notNull(arity) < 27);
1364 let arguments = "abcdefghijklmnopqrstuvwxyz".split("").splice(0, arity).jo in(","); 1364 let arguments = "abcdefghijklmnopqrstuvwxyz".split("").splice(0, arity).jo in(",");
1365 return new Function(`return function(${arguments}){` + `return this.${Boun dClosure.selfFieldName()}.${stubName}(${arguments});` + `${dart.notNull(function Counter)++}` + '}')(); 1365 return new Function(`return function(${arguments}){` + `return this.${Boun dClosure.selfFieldName()}.${stubName}(${arguments});` + `${(($tmp) => functionCo unter = dart.notNull($tmp) + 1, $tmp)(functionCounter)}` + '}')();
1366 } 1366 }
1367 static cspForwardInterceptedCall(arity, isSuperCall, name, function) { 1367 static cspForwardInterceptedCall(arity, isSuperCall, name, function) {
1368 let getSelf = _foreign_helper.RAW_DART_FUNCTION_REF(BoundClosure.selfOf); 1368 let getSelf = _foreign_helper.RAW_DART_FUNCTION_REF(BoundClosure.selfOf);
1369 let getReceiver = _foreign_helper.RAW_DART_FUNCTION_REF(BoundClosure.recei verOf); 1369 let getReceiver = _foreign_helper.RAW_DART_FUNCTION_REF(BoundClosure.recei verOf);
1370 if (isSuperCall) 1370 if (isSuperCall)
1371 arity = -1; 1371 arity = -1;
1372 switch (arity) { 1372 switch (arity) {
1373 case 0: 1373 case 0:
1374 throw new RuntimeError('Intercepted function with no arguments.'); 1374 throw new RuntimeError('Intercepted function with no arguments.');
1375 case 1: 1375 case 1:
(...skipping 47 matching lines...) Expand 10 before | Expand all | Expand 10 after
1423 let receiverField = BoundClosure.receiverFieldName(); 1423 let receiverField = BoundClosure.receiverFieldName();
1424 let stubName = dart.as(function.$stubName, core.String); 1424 let stubName = dart.as(function.$stubName, core.String);
1425 let arity = function.length; 1425 let arity = function.length;
1426 let isCsp = typeof dart_precompiled == "function"; 1426 let isCsp = typeof dart_precompiled == "function";
1427 let lookedUpFunction = receiver[stubName]; 1427 let lookedUpFunction = receiver[stubName];
1428 let isSuperCall = !dart.notNull(core.identical(function, lookedUpFunction) ); 1428 let isSuperCall = !dart.notNull(core.identical(function, lookedUpFunction) );
1429 if (dart.notNull(isCsp) || dart.notNull(isSuperCall) || dart.notNull(arity ) >= 28) { 1429 if (dart.notNull(isCsp) || dart.notNull(isSuperCall) || dart.notNull(arity ) >= 28) {
1430 return cspForwardInterceptedCall(arity, isSuperCall, stubName, function) ; 1430 return cspForwardInterceptedCall(arity, isSuperCall, stubName, function) ;
1431 } 1431 }
1432 if (arity === 1) { 1432 if (arity === 1) {
1433 return new Function('return function(){' + `return this.${selfField}.${s tubName}(this.${receiverField});` + `${dart.notNull(functionCounter)++}` + '}')( ); 1433 return new Function('return function(){' + `return this.${selfField}.${s tubName}(this.${receiverField});` + `${(($tmp) => functionCounter = dart.notNull ($tmp) + 1, $tmp)(functionCounter)}` + '}')();
1434 } 1434 }
1435 dart.assert(1 < dart.notNull(arity) && dart.notNull(arity) < 28); 1435 dart.assert(1 < dart.notNull(arity) && dart.notNull(arity) < 28);
1436 let arguments = "abcdefghijklmnopqrstuvwxyz".split("").splice(0, dart.notN ull(arity) - 1).join(","); 1436 let arguments = "abcdefghijklmnopqrstuvwxyz".split("").splice(0, dart.notN ull(arity) - 1).join(",");
1437 return new Function(`return function(${arguments}){` + `return this.${self Field}.${stubName}(this.${receiverField}, ${arguments});` + `${dart.notNull(func tionCounter)++}` + '}')(); 1437 return new Function(`return function(${arguments}){` + `return this.${self Field}.${stubName}(this.${receiverField}, ${arguments});` + `${(($tmp) => functi onCounter = dart.notNull($tmp) + 1, $tmp)(functionCounter)}` + '}')();
1438 } 1438 }
1439 toString() { 1439 toString() {
1440 return "Closure"; 1440 return "Closure";
1441 } 1441 }
1442 } 1442 }
1443 Closure.FUNCTION_INDEX = 0; 1443 Closure.FUNCTION_INDEX = 0;
1444 Closure.NAME_INDEX = 1; 1444 Closure.NAME_INDEX = 1;
1445 Closure.CALL_NAME_INDEX = 2; 1445 Closure.CALL_NAME_INDEX = 2;
1446 Closure.REQUIRED_PARAMETER_INDEX = 3; 1446 Closure.REQUIRED_PARAMETER_INDEX = 3;
1447 Closure.OPTIONAL_PARAMETER_INDEX = 4; 1447 Closure.OPTIONAL_PARAMETER_INDEX = 4;
(...skipping 54 matching lines...) Expand 10 before | Expand all | Expand 10 after
1502 } 1502 }
1503 static receiverFieldName() { 1503 static receiverFieldName() {
1504 if (receiverFieldNameCache === null) { 1504 if (receiverFieldNameCache === null) {
1505 receiverFieldNameCache = computeFieldNamed('receiver'); 1505 receiverFieldNameCache = computeFieldNamed('receiver');
1506 } 1506 }
1507 return receiverFieldNameCache; 1507 return receiverFieldNameCache;
1508 } 1508 }
1509 static computeFieldNamed(fieldName) { 1509 static computeFieldNamed(fieldName) {
1510 let template = new BoundClosure('self', 'target', 'receiver', 'name'); 1510 let template = new BoundClosure('self', 'target', 'receiver', 'name');
1511 let names = _interceptors.JSArray.markFixedList(dart.as(Object.getOwnPrope rtyNames(template), core.List)); 1511 let names = _interceptors.JSArray.markFixedList(dart.as(Object.getOwnPrope rtyNames(template), core.List));
1512 for (let i = 0; dart.notNull(i) < dart.notNull(names.length); dart.notNull (i)++) { 1512 for (let i = 0; dart.notNull(i) < dart.notNull(names.length); i = dart.not Null(i) + 1) {
1513 let name = names.get(i); 1513 let name = names.get(i);
1514 if (template[name] === fieldName) { 1514 if (template[name] === fieldName) {
1515 return name; 1515 return name;
1516 } 1516 }
1517 } 1517 }
1518 } 1518 }
1519 } 1519 }
1520 BoundClosure.selfFieldNameCache = null; 1520 BoundClosure.selfFieldNameCache = null;
1521 BoundClosure.receiverFieldNameCache = null; 1521 BoundClosure.receiverFieldNameCache = null;
1522 // Function jsHasOwnProperty: (dynamic, String) → bool 1522 // Function jsHasOwnProperty: (dynamic, String) → bool
(...skipping 429 matching lines...) Expand 10 before | Expand all | Expand 10 after
1952 } 1952 }
1953 if (dart.notNull(this.parameterTypes !== null) && !dart.notNull(this.param eterTypes.isEmpty)) { 1953 if (dart.notNull(this.parameterTypes !== null) && !dart.notNull(this.param eterTypes.isEmpty)) {
1954 result[_foreign_helper.JS_FUNCTION_TYPE_REQUIRED_PARAMETERS_TAG()] = lis tToRti(this.parameterTypes); 1954 result[_foreign_helper.JS_FUNCTION_TYPE_REQUIRED_PARAMETERS_TAG()] = lis tToRti(this.parameterTypes);
1955 } 1955 }
1956 if (dart.notNull(this.optionalParameterTypes !== null) && !dart.notNull(th is.optionalParameterTypes.isEmpty)) { 1956 if (dart.notNull(this.optionalParameterTypes !== null) && !dart.notNull(th is.optionalParameterTypes.isEmpty)) {
1957 result[_foreign_helper.JS_FUNCTION_TYPE_OPTIONAL_PARAMETERS_TAG()] = lis tToRti(this.optionalParameterTypes); 1957 result[_foreign_helper.JS_FUNCTION_TYPE_OPTIONAL_PARAMETERS_TAG()] = lis tToRti(this.optionalParameterTypes);
1958 } 1958 }
1959 if (this.namedParameters !== null) { 1959 if (this.namedParameters !== null) {
1960 let namedRti = Object.create(null); 1960 let namedRti = Object.create(null);
1961 let keys = _js_names.extractKeys(this.namedParameters); 1961 let keys = _js_names.extractKeys(this.namedParameters);
1962 for (let i = 0; dart.notNull(i) < dart.notNull(keys.length); dart.notNul l(i)++) { 1962 for (let i = 0; dart.notNull(i) < dart.notNull(keys.length); i = dart.no tNull(i) + 1) {
1963 let name = keys.get(i); 1963 let name = keys.get(i);
1964 let rti = dart.dinvoke(this.namedParameters[name], 'toRti'); 1964 let rti = dart.dinvoke(this.namedParameters[name], 'toRti');
1965 namedRti[name] = rti; 1965 namedRti[name] = rti;
1966 } 1966 }
1967 result[_foreign_helper.JS_FUNCTION_TYPE_NAMED_PARAMETERS_TAG()] = namedR ti; 1967 result[_foreign_helper.JS_FUNCTION_TYPE_NAMED_PARAMETERS_TAG()] = namedR ti;
1968 } 1968 }
1969 return result; 1969 return result;
1970 } 1970 }
1971 static listToRti(list) { 1971 static listToRti(list) {
1972 list = list; 1972 list = list;
1973 let result = []; 1973 let result = [];
1974 for (let i = 0; i['<'](dart.dload(list, 'length')); dart.notNull(i)++) { 1974 for (let i = 0; i['<'](dart.dload(list, 'length')); i = dart.notNull(i) + 1) {
1975 result.push(dart.dinvoke(dart.dindex(list, i), 'toRti')); 1975 result.push(dart.dinvoke(dart.dindex(list, i), 'toRti'));
1976 } 1976 }
1977 return result; 1977 return result;
1978 } 1978 }
1979 toString() { 1979 toString() {
1980 let result = '('; 1980 let result = '(';
1981 let needsComma = false; 1981 let needsComma = false;
1982 if (this.parameterTypes !== null) { 1982 if (this.parameterTypes !== null) {
1983 for (let i = 0; dart.notNull(i) < dart.notNull(this.parameterTypes.lengt h); dart.notNull(i)++) { 1983 for (let i = 0; dart.notNull(i) < dart.notNull(this.parameterTypes.lengt h); i = dart.notNull(i) + 1) {
1984 let type = this.parameterTypes.get(i); 1984 let type = this.parameterTypes.get(i);
1985 if (needsComma) 1985 if (needsComma)
1986 result = ', '; 1986 result = ', ';
1987 result = `${type}`; 1987 result = `${type}`;
1988 needsComma = true; 1988 needsComma = true;
1989 } 1989 }
1990 } 1990 }
1991 if (dart.notNull(this.optionalParameterTypes !== null) && !dart.notNull(th is.optionalParameterTypes.isEmpty)) { 1991 if (dart.notNull(this.optionalParameterTypes !== null) && !dart.notNull(th is.optionalParameterTypes.isEmpty)) {
1992 if (needsComma) 1992 if (needsComma)
1993 result = ', '; 1993 result = ', ';
1994 needsComma = false; 1994 needsComma = false;
1995 result = '['; 1995 result = '[';
1996 for (let i = 0; dart.notNull(i) < dart.notNull(this.optionalParameterTyp es.length); dart.notNull(i)++) { 1996 for (let i = 0; dart.notNull(i) < dart.notNull(this.optionalParameterTyp es.length); i = dart.notNull(i) + 1) {
1997 let type = this.optionalParameterTypes.get(i); 1997 let type = this.optionalParameterTypes.get(i);
1998 if (needsComma) 1998 if (needsComma)
1999 result = ', '; 1999 result = ', ';
2000 result = `${type}`; 2000 result = `${type}`;
2001 needsComma = true; 2001 needsComma = true;
2002 } 2002 }
2003 result = ']'; 2003 result = ']';
2004 } else if (this.namedParameters !== null) { 2004 } else if (this.namedParameters !== null) {
2005 if (needsComma) 2005 if (needsComma)
2006 result = ', '; 2006 result = ', ';
2007 needsComma = false; 2007 needsComma = false;
2008 result = '{'; 2008 result = '{';
2009 let keys = _js_names.extractKeys(this.namedParameters); 2009 let keys = _js_names.extractKeys(this.namedParameters);
2010 for (let i = 0; dart.notNull(i) < dart.notNull(keys.length); dart.notNul l(i)++) { 2010 for (let i = 0; dart.notNull(i) < dart.notNull(keys.length); i = dart.no tNull(i) + 1) {
2011 let name = keys.get(i); 2011 let name = keys.get(i);
2012 if (needsComma) 2012 if (needsComma)
2013 result = ', '; 2013 result = ', ';
2014 let rti = dart.dinvoke(this.namedParameters[name], 'toRti'); 2014 let rti = dart.dinvoke(this.namedParameters[name], 'toRti');
2015 result = `${rti} ${name}`; 2015 result = `${rti} ${name}`;
2016 needsComma = true; 2016 needsComma = true;
2017 } 2017 }
2018 result = '}'; 2018 result = '}';
2019 } 2019 }
2020 result = `) -> ${this.returnType}`; 2020 result = `) -> ${this.returnType}`;
(...skipping 68 matching lines...) Expand 10 before | Expand all | Expand 10 after
2089 // Function convertRtiToRuntimeType: (dynamic) → RuntimeType 2089 // Function convertRtiToRuntimeType: (dynamic) → RuntimeType
2090 function convertRtiToRuntimeType(rti) { 2090 function convertRtiToRuntimeType(rti) {
2091 if (rti === null) { 2091 if (rti === null) {
2092 return getDynamicRuntimeType(); 2092 return getDynamicRuntimeType();
2093 } else if (typeof rti == "function") { 2093 } else if (typeof rti == "function") {
2094 return new RuntimeTypePlain(rti.name); 2094 return new RuntimeTypePlain(rti.name);
2095 } else if (rti.constructor == Array) { 2095 } else if (rti.constructor == Array) {
2096 let list = dart.as(rti, core.List); 2096 let list = dart.as(rti, core.List);
2097 let name = list.get(0).name; 2097 let name = list.get(0).name;
2098 let arguments = new List.from([]); 2098 let arguments = new List.from([]);
2099 for (let i = 1; dart.notNull(i) < dart.notNull(list.length); dart.notNull( i)++) { 2099 for (let i = 1; dart.notNull(i) < dart.notNull(list.length); i = dart.notN ull(i) + 1) {
2100 arguments.add(convertRtiToRuntimeType(list.get(i))); 2100 arguments.add(convertRtiToRuntimeType(list.get(i)));
2101 } 2101 }
2102 return new RuntimeTypeGeneric(name, dart.as(arguments, core.List$(RuntimeT ype)), rti); 2102 return new RuntimeTypeGeneric(name, dart.as(arguments, core.List$(RuntimeT ype)), rti);
2103 } else if ("func" in rti) { 2103 } else if ("func" in rti) {
2104 return new FunctionTypeInfoDecoderRing(rti).toRuntimeType(); 2104 return new FunctionTypeInfoDecoderRing(rti).toRuntimeType();
2105 } else { 2105 } else {
2106 throw new RuntimeError("Cannot convert " + `'${JSON.stringify(rti)}' to Ru ntimeType.`); 2106 throw new RuntimeError("Cannot convert " + `'${JSON.stringify(rti)}' to Ru ntimeType.`);
2107 } 2107 }
2108 } 2108 }
2109 class RuntimeTypePlain extends RuntimeType { 2109 class RuntimeTypePlain extends RuntimeType {
(...skipping 372 matching lines...) Expand 10 before | Expand all | Expand 10 after
2482 get(key) { 2482 get(key) {
2483 if (!dart.notNull(this.containsKey(key))) 2483 if (!dart.notNull(this.containsKey(key)))
2484 return null; 2484 return null;
2485 return dart.as(this[_fetch](key), V); 2485 return dart.as(this[_fetch](key), V);
2486 } 2486 }
2487 [_fetch](key) { 2487 [_fetch](key) {
2488 return jsPropertyAccess(this[_jsObject], dart.as(key, core.String)); 2488 return jsPropertyAccess(this[_jsObject], dart.as(key, core.String));
2489 } 2489 }
2490 forEach(f) { 2490 forEach(f) {
2491 let keys = this[_keys]; 2491 let keys = this[_keys];
2492 for (let i = 0; i['<'](dart.dload(keys, 'length')); dart.notNull(i)++) { 2492 for (let i = 0; i['<'](dart.dload(keys, 'length')); i = dart.notNull(i) + 1) {
2493 let key = dart.dindex(keys, i); 2493 let key = dart.dindex(keys, i);
2494 f(dart.as(key, K), dart.as(this[_fetch](key), V)); 2494 f(dart.as(key, K), dart.as(this[_fetch](key), V));
2495 } 2495 }
2496 } 2496 }
2497 get keys() { 2497 get keys() {
2498 return new _ConstantMapKeyIterable(this); 2498 return new _ConstantMapKeyIterable(this);
2499 } 2499 }
2500 get values() { 2500 get values() {
2501 return new _internal.MappedIterable(this[_keys], dart.as(((key) => this[ _fetch](key)).bind(this), dart.throw_("Unimplemented type (K) → V"))); 2501 return new _internal.MappedIterable(this[_keys], dart.as(((key) => this[ _fetch](key)).bind(this), dart.throw_("Unimplemented type (K) → V")));
2502 } 2502 }
(...skipping 262 matching lines...) Expand 10 before | Expand all | Expand 10 after
2765 function initNativeDispatchContinue() { 2765 function initNativeDispatchContinue() {
2766 exports.dispatchRecordsForInstanceTags = Object.create(null); 2766 exports.dispatchRecordsForInstanceTags = Object.create(null);
2767 exports.interceptorsForUncacheableTags = Object.create(null); 2767 exports.interceptorsForUncacheableTags = Object.create(null);
2768 initHooks(); 2768 initHooks();
2769 let map = exports.interceptorsByTag; 2769 let map = exports.interceptorsByTag;
2770 let tags = Object.getOwnPropertyNames(map); 2770 let tags = Object.getOwnPropertyNames(map);
2771 if (typeof window != "undefined") { 2771 if (typeof window != "undefined") {
2772 let context = window; 2772 let context = window;
2773 let fun = function() { 2773 let fun = function() {
2774 }; 2774 };
2775 for (let i = 0; i['<'](dart.dload(tags, 'length')); dart.notNull(i)++) { 2775 for (let i = 0; i['<'](dart.dload(tags, 'length')); i = dart.notNull(i) + 1) {
2776 let tag = dart.dindex(tags, i); 2776 let tag = dart.dindex(tags, i);
2777 let proto = dart.dinvokef(exports.prototypeForTagFunction, tag); 2777 let proto = dart.dinvokef(exports.prototypeForTagFunction, tag);
2778 if (proto !== null) { 2778 if (proto !== null) {
2779 let interceptorClass = map[tag]; 2779 let interceptorClass = map[tag];
2780 let record = makeDefaultDispatchRecord(tag, interceptorClass, proto); 2780 let record = makeDefaultDispatchRecord(tag, interceptorClass, proto);
2781 if (record !== null) { 2781 if (record !== null) {
2782 _interceptors.setDispatchProperty(proto, record); 2782 _interceptors.setDispatchProperty(proto, record);
2783 fun.prototype = proto; 2783 fun.prototype = proto;
2784 } 2784 }
2785 } 2785 }
2786 } 2786 }
2787 } 2787 }
2788 for (let i = 0; i['<'](dart.dload(tags, 'length')); dart.notNull(i)++) { 2788 for (let i = 0; i['<'](dart.dload(tags, 'length')); i = dart.notNull(i) + 1) {
2789 let tag = tags[i]; 2789 let tag = tags[i];
2790 if (/^[A-Za-z_]/.test(tag)) { 2790 if (/^[A-Za-z_]/.test(tag)) {
2791 let interceptorClass = propertyGet(map, tag); 2791 let interceptorClass = propertyGet(map, tag);
2792 propertySet(map, dart.as(dart.dbinary(INSTANCE_CACHED_MARK, '+', tag), c ore.String), interceptorClass); 2792 propertySet(map, dart.as(dart.dbinary(INSTANCE_CACHED_MARK, '+', tag), c ore.String), interceptorClass);
2793 propertySet(map, dart.as(dart.dbinary(UNCACHED_MARK, '+', tag), core.Str ing), interceptorClass); 2793 propertySet(map, dart.as(dart.dbinary(UNCACHED_MARK, '+', tag), core.Str ing), interceptorClass);
2794 propertySet(map, dart.as(dart.dbinary(LEAF_MARK, '+', tag), core.String) , interceptorClass); 2794 propertySet(map, dart.as(dart.dbinary(LEAF_MARK, '+', tag), core.String) , interceptorClass);
2795 propertySet(map, dart.as(dart.dbinary(INTERIOR_MARK, '+', tag), core.Str ing), interceptorClass); 2795 propertySet(map, dart.as(dart.dbinary(INTERIOR_MARK, '+', tag), core.Str ing), interceptorClass);
2796 propertySet(map, dart.as(dart.dbinary(DISCRIMINATED_MARK, '+', tag), cor e.String), interceptorClass); 2796 propertySet(map, dart.as(dart.dbinary(DISCRIMINATED_MARK, '+', tag), cor e.String), interceptorClass);
2797 } 2797 }
2798 } 2798 }
2799 } 2799 }
2800 // Function initHooks: () → void 2800 // Function initHooks: () → void
2801 function initHooks() { 2801 function initHooks() {
2802 let hooks = _baseHooks(); 2802 let hooks = _baseHooks();
2803 let _fallbackConstructorHooksTransformer = _fallbackConstructorHooksTransfor merGenerator(_constructorNameFallback); 2803 let _fallbackConstructorHooksTransformer = _fallbackConstructorHooksTransfor merGenerator(_constructorNameFallback);
2804 hooks = applyHooksTransformer(_fallbackConstructorHooksTransformer, hooks); 2804 hooks = applyHooksTransformer(_fallbackConstructorHooksTransformer, hooks);
2805 hooks = applyHooksTransformer(_firefoxHooksTransformer, hooks); 2805 hooks = applyHooksTransformer(_firefoxHooksTransformer, hooks);
2806 hooks = applyHooksTransformer(_ieHooksTransformer, hooks); 2806 hooks = applyHooksTransformer(_ieHooksTransformer, hooks);
2807 hooks = applyHooksTransformer(_operaHooksTransformer, hooks); 2807 hooks = applyHooksTransformer(_operaHooksTransformer, hooks);
2808 hooks = applyHooksTransformer(_safariHooksTransformer, hooks); 2808 hooks = applyHooksTransformer(_safariHooksTransformer, hooks);
2809 hooks = applyHooksTransformer(_fixDocumentHooksTransformer, hooks); 2809 hooks = applyHooksTransformer(_fixDocumentHooksTransformer, hooks);
2810 hooks = applyHooksTransformer(_dartExperimentalFixupGetTagHooksTransformer, hooks); 2810 hooks = applyHooksTransformer(_dartExperimentalFixupGetTagHooksTransformer, hooks);
2811 if (typeof dartNativeDispatchHooksTransformer != "undefined") { 2811 if (typeof dartNativeDispatchHooksTransformer != "undefined") {
2812 let transformers = dartNativeDispatchHooksTransformer; 2812 let transformers = dartNativeDispatchHooksTransformer;
2813 if (typeof transformers == "function") { 2813 if (typeof transformers == "function") {
2814 transformers = new List.from([transformers]); 2814 transformers = new List.from([transformers]);
2815 } 2815 }
2816 if (transformers.constructor == Array) { 2816 if (transformers.constructor == Array) {
2817 for (let i = 0; dart.notNull(i) < transformers.length; dart.notNull(i)++ ) { 2817 for (let i = 0; dart.notNull(i) < transformers.length; i = dart.notNull( i) + 1) {
2818 let transformer = transformers[i]; 2818 let transformer = transformers[i];
2819 if (typeof transformer == "function") { 2819 if (typeof transformer == "function") {
2820 hooks = applyHooksTransformer(transformer, hooks); 2820 hooks = applyHooksTransformer(transformer, hooks);
2821 } 2821 }
2822 } 2822 }
2823 } 2823 }
2824 } 2824 }
2825 let getTag = hooks.getTag; 2825 let getTag = hooks.getTag;
2826 let getUnknownTag = hooks.getUnknownTag; 2826 let getUnknownTag = hooks.getUnknownTag;
2827 let prototypeForTag = hooks.prototypeForTag; 2827 let prototypeForTag = hooks.prototypeForTag;
(...skipping 208 matching lines...) Expand 10 before | Expand all | Expand 10 after
3036 } 3036 }
3037 moveNext() { 3037 moveNext() {
3038 if (this[_string] === null) 3038 if (this[_string] === null)
3039 return false; 3039 return false;
3040 if (dart.notNull(this[_nextIndex]) <= dart.notNull(this[_string].length)) { 3040 if (dart.notNull(this[_nextIndex]) <= dart.notNull(this[_string].length)) {
3041 let match = this[_regExp]._execGlobal(this[_string], this[_nextIndex]); 3041 let match = this[_regExp]._execGlobal(this[_string], this[_nextIndex]);
3042 if (match !== null) { 3042 if (match !== null) {
3043 this[_current] = match; 3043 this[_current] = match;
3044 let nextIndex = match.end; 3044 let nextIndex = match.end;
3045 if (match.start === nextIndex) { 3045 if (match.start === nextIndex) {
3046 dart.notNull(nextIndex)++; 3046 nextIndex = dart.notNull(nextIndex) + 1;
3047 } 3047 }
3048 this[_nextIndex] = nextIndex; 3048 this[_nextIndex] = nextIndex;
3049 return true; 3049 return true;
3050 } 3050 }
3051 } 3051 }
3052 this[_current] = null; 3052 this[_current] = null;
3053 this[_string] = null; 3053 this[_string] = null;
3054 return false; 3054 return false;
3055 } 3055 }
3056 } 3056 }
(...skipping 38 matching lines...) Expand 10 before | Expand all | Expand 10 after
3095 while (true) { 3095 while (true) {
3096 let position = haystack.indexOf(needle, startIndex); 3096 let position = haystack.indexOf(needle, startIndex);
3097 if (position === -1) { 3097 if (position === -1) {
3098 break; 3098 break;
3099 } 3099 }
3100 result.add(new StringMatch(position, haystack, needle)); 3100 result.add(new StringMatch(position, haystack, needle));
3101 let endIndex = dart.notNull(position) + dart.notNull(patternLength); 3101 let endIndex = dart.notNull(position) + dart.notNull(patternLength);
3102 if (endIndex === length) { 3102 if (endIndex === length) {
3103 break; 3103 break;
3104 } else if (position === endIndex) { 3104 } else if (position === endIndex) {
3105 ++dart.notNull(startIndex); 3105 startIndex = dart.notNull(startIndex) + 1;
3106 } else { 3106 } else {
3107 startIndex = endIndex; 3107 startIndex = endIndex;
3108 } 3108 }
3109 } 3109 }
3110 return result; 3110 return result;
3111 } 3111 }
3112 // Function stringContainsUnchecked: (dynamic, dynamic, dynamic) → dynamic 3112 // Function stringContainsUnchecked: (dynamic, dynamic, dynamic) → dynamic
3113 function stringContainsUnchecked(receiver, other, startIndex) { 3113 function stringContainsUnchecked(receiver, other, startIndex) {
3114 if (typeof other == string) { 3114 if (typeof other == string) {
3115 return !dart.equals(dart.dinvoke(receiver, 'indexOf', other, startIndex), -1); 3115 return !dart.equals(dart.dinvoke(receiver, 'indexOf', other, startIndex), -1);
(...skipping 23 matching lines...) Expand all
3139 function stringReplaceAllUnchecked(receiver, from, to) { 3139 function stringReplaceAllUnchecked(receiver, from, to) {
3140 checkString(to); 3140 checkString(to);
3141 if (typeof from == string) { 3141 if (typeof from == string) {
3142 if (dart.equals(from, "")) { 3142 if (dart.equals(from, "")) {
3143 if (dart.equals(receiver, "")) { 3143 if (dart.equals(receiver, "")) {
3144 return to; 3144 return to;
3145 } else { 3145 } else {
3146 let result = new core.StringBuffer(); 3146 let result = new core.StringBuffer();
3147 let length = dart.as(dart.dload(receiver, 'length'), core.int); 3147 let length = dart.as(dart.dload(receiver, 'length'), core.int);
3148 result.write(to); 3148 result.write(to);
3149 for (let i = 0; dart.notNull(i) < dart.notNull(length); dart.notNull(i )++) { 3149 for (let i = 0; dart.notNull(i) < dart.notNull(length); i = dart.notNu ll(i) + 1) {
3150 result.write(dart.dindex(receiver, i)); 3150 result.write(dart.dindex(receiver, i));
3151 result.write(to); 3151 result.write(to);
3152 } 3152 }
3153 return result.toString(); 3153 return result.toString();
3154 } 3154 }
3155 } else { 3155 } else {
3156 let quoter = new RegExp(ESCAPE_REGEXP, 'g'); 3156 let quoter = new RegExp(ESCAPE_REGEXP, 'g');
3157 let quoted = from.replace(quoter, "\\$&"); 3157 let quoted = from.replace(quoter, "\\$&");
3158 let replacer = new RegExp(quoted, 'g'); 3158 let replacer = new RegExp(quoted, 'g');
3159 return stringReplaceJS(receiver, replacer, to); 3159 return stringReplaceJS(receiver, replacer, to);
(...skipping 47 matching lines...) Expand 10 before | Expand all | Expand 10 after
3207 let code = dart.as(dart.dinvoke(receiver, 'codeUnitAt', i), core.int); 3207 let code = dart.as(dart.dinvoke(receiver, 'codeUnitAt', i), core.int);
3208 if ((dart.notNull(code) & ~1023) === 55296 && dart.notNull(length) > dart. notNull(i) + 1) { 3208 if ((dart.notNull(code) & ~1023) === 55296 && dart.notNull(length) > dart. notNull(i) + 1) {
3209 code = dart.as(dart.dinvoke(receiver, 'codeUnitAt', dart.notNull(i) + 1) , core.int); 3209 code = dart.as(dart.dinvoke(receiver, 'codeUnitAt', dart.notNull(i) + 1) , core.int);
3210 if ((dart.notNull(code) & ~1023) === 56320) { 3210 if ((dart.notNull(code) & ~1023) === 56320) {
3211 buffer.write(dart.dinvokef(onNonMatch, dart.dinvoke(receiver, 'substri ng', i, dart.notNull(i) + 2))); 3211 buffer.write(dart.dinvokef(onNonMatch, dart.dinvoke(receiver, 'substri ng', i, dart.notNull(i) + 2)));
3212 i = 2; 3212 i = 2;
3213 continue; 3213 continue;
3214 } 3214 }
3215 } 3215 }
3216 buffer.write(dart.dinvokef(onNonMatch, dart.dindex(receiver, i))); 3216 buffer.write(dart.dinvokef(onNonMatch, dart.dindex(receiver, i)));
3217 dart.notNull(i)++; 3217 i = dart.notNull(i) + 1;
3218 } 3218 }
3219 buffer.write(dart.dinvokef(onMatch, new StringMatch(i, dart.as(receiver, cor e.String), ""))); 3219 buffer.write(dart.dinvokef(onMatch, new StringMatch(i, dart.as(receiver, cor e.String), "")));
3220 buffer.write(dart.dinvokef(onNonMatch, "")); 3220 buffer.write(dart.dinvokef(onNonMatch, ""));
3221 return buffer.toString(); 3221 return buffer.toString();
3222 } 3222 }
3223 // Function stringReplaceAllStringFuncUnchecked: (dynamic, dynamic, dynamic, d ynamic) → dynamic 3223 // Function stringReplaceAllStringFuncUnchecked: (dynamic, dynamic, dynamic, d ynamic) → dynamic
3224 function stringReplaceAllStringFuncUnchecked(receiver, pattern, onMatch, onNon Match) { 3224 function stringReplaceAllStringFuncUnchecked(receiver, pattern, onMatch, onNon Match) {
3225 let patternLength = dart.as(dart.dload(pattern, 'length'), core.int); 3225 let patternLength = dart.as(dart.dload(pattern, 'length'), core.int);
3226 if (patternLength === 0) { 3226 if (patternLength === 0) {
3227 return stringReplaceAllEmptyFuncUnchecked(receiver, onMatch, onNonMatch); 3227 return stringReplaceAllEmptyFuncUnchecked(receiver, onMatch, onNonMatch);
(...skipping 135 matching lines...) Expand 10 before | Expand all | Expand 10 after
3363 } 3363 }
3364 // Function joinArguments: (dynamic, int, {onTypeVariable: (int) → String}) → String 3364 // Function joinArguments: (dynamic, int, {onTypeVariable: (int) → String}) → String
3365 function joinArguments(types, startIndex, opt$) { 3365 function joinArguments(types, startIndex, opt$) {
3366 let onTypeVariable = opt$.onTypeVariable === void 0 ? null : opt$.onTypeVari able; 3366 let onTypeVariable = opt$.onTypeVariable === void 0 ? null : opt$.onTypeVari able;
3367 if (types === null) 3367 if (types === null)
3368 return ''; 3368 return '';
3369 dart.assert(isJsArray(types)); 3369 dart.assert(isJsArray(types));
3370 let firstArgument = true; 3370 let firstArgument = true;
3371 let allDynamic = true; 3371 let allDynamic = true;
3372 let buffer = new core.StringBuffer(); 3372 let buffer = new core.StringBuffer();
3373 for (let index = startIndex; dart.notNull(index) < dart.notNull(getLength(ty pes)); dart.notNull(index)++) { 3373 for (let index = startIndex; dart.notNull(index) < dart.notNull(getLength(ty pes)); index = dart.notNull(index) + 1) {
3374 if (firstArgument) { 3374 if (firstArgument) {
3375 firstArgument = false; 3375 firstArgument = false;
3376 } else { 3376 } else {
3377 buffer.write(', '); 3377 buffer.write(', ');
3378 } 3378 }
3379 let argument = getIndex(types, index); 3379 let argument = getIndex(types, index);
3380 if (argument !== null) { 3380 if (argument !== null) {
3381 allDynamic = false; 3381 allDynamic = false;
3382 } 3382 }
3383 buffer.write(runtimeTypeToString(argument, {onTypeVariable: onTypeVariable })); 3383 buffer.write(runtimeTypeToString(argument, {onTypeVariable: onTypeVariable }));
(...skipping 76 matching lines...) Expand 10 before | Expand all | Expand 10 after
3460 return areSubtypes(substitute(substitution, arguments), checks); 3460 return areSubtypes(substitute(substitution, arguments), checks);
3461 } 3461 }
3462 // Function areSubtypes: (dynamic, dynamic) → bool 3462 // Function areSubtypes: (dynamic, dynamic) → bool
3463 function areSubtypes(s, t) { 3463 function areSubtypes(s, t) {
3464 if (dart.notNull(s === null) || dart.notNull(t === null)) 3464 if (dart.notNull(s === null) || dart.notNull(t === null))
3465 return true; 3465 return true;
3466 dart.assert(isJsArray(s)); 3466 dart.assert(isJsArray(s));
3467 dart.assert(isJsArray(t)); 3467 dart.assert(isJsArray(t));
3468 dart.assert(getLength(s) === getLength(t)); 3468 dart.assert(getLength(s) === getLength(t));
3469 let len = getLength(s); 3469 let len = getLength(s);
3470 for (let i = 0; dart.notNull(i) < dart.notNull(len); dart.notNull(i)++) { 3470 for (let i = 0; dart.notNull(i) < dart.notNull(len); i = dart.notNull(i) + 1 ) {
3471 if (!dart.notNull(isSubtype(getIndex(s, i), getIndex(t, i)))) { 3471 if (!dart.notNull(isSubtype(getIndex(s, i), getIndex(t, i)))) {
3472 return false; 3472 return false;
3473 } 3473 }
3474 } 3474 }
3475 return true; 3475 return true;
3476 } 3476 }
3477 // Function computeSignature: (dynamic, dynamic, dynamic) → dynamic 3477 // Function computeSignature: (dynamic, dynamic, dynamic) → dynamic
3478 function computeSignature(signature, context, contextName) { 3478 function computeSignature(signature, context, contextName) {
3479 let typeArguments = getRuntimeTypeArguments(context, contextName); 3479 let typeArguments = getRuntimeTypeArguments(context, contextName);
3480 return invokeOn(signature, context, typeArguments); 3480 return invokeOn(signature, context, typeArguments);
(...skipping 91 matching lines...) Expand 10 before | Expand all | Expand 10 after
3572 dart.assert(isJsArray(t)); 3572 dart.assert(isJsArray(t));
3573 let sLength = getLength(s); 3573 let sLength = getLength(s);
3574 let tLength = getLength(t); 3574 let tLength = getLength(t);
3575 if (allowShorter) { 3575 if (allowShorter) {
3576 if (dart.notNull(sLength) < dart.notNull(tLength)) 3576 if (dart.notNull(sLength) < dart.notNull(tLength))
3577 return false; 3577 return false;
3578 } else { 3578 } else {
3579 if (sLength !== tLength) 3579 if (sLength !== tLength)
3580 return false; 3580 return false;
3581 } 3581 }
3582 for (let i = 0; dart.notNull(i) < dart.notNull(tLength); dart.notNull(i)++) { 3582 for (let i = 0; dart.notNull(i) < dart.notNull(tLength); i = dart.notNull(i) + 1) {
3583 if (!dart.notNull(isAssignable(getIndex(s, i), getIndex(t, i)))) { 3583 if (!dart.notNull(isAssignable(getIndex(s, i), getIndex(t, i)))) {
3584 return false; 3584 return false;
3585 } 3585 }
3586 } 3586 }
3587 return true; 3587 return true;
3588 } 3588 }
3589 // Function areAssignableMaps: (dynamic, dynamic) → bool 3589 // Function areAssignableMaps: (dynamic, dynamic) → bool
3590 function areAssignableMaps(s, t) { 3590 function areAssignableMaps(s, t) {
3591 if (t === null) 3591 if (t === null)
3592 return true; 3592 return true;
3593 if (s === null) 3593 if (s === null)
3594 return false; 3594 return false;
3595 dart.assert(isJsObject(s)); 3595 dart.assert(isJsObject(s));
3596 dart.assert(isJsObject(t)); 3596 dart.assert(isJsObject(t));
3597 let names = _interceptors.JSArray.markFixedList(dart.as(Object.getOwnPropert yNames(t), core.List)); 3597 let names = _interceptors.JSArray.markFixedList(dart.as(Object.getOwnPropert yNames(t), core.List));
3598 for (let i = 0; dart.notNull(i) < dart.notNull(names.length); dart.notNull(i )++) { 3598 for (let i = 0; dart.notNull(i) < dart.notNull(names.length); i = dart.notNu ll(i) + 1) {
3599 let name = names.get(i); 3599 let name = names.get(i);
3600 if (!Object.hasOwnProperty.call(s, name)) { 3600 if (!Object.hasOwnProperty.call(s, name)) {
3601 return false; 3601 return false;
3602 } 3602 }
3603 let tType = t[name]; 3603 let tType = t[name];
3604 let sType = s[name]; 3604 let sType = s[name];
3605 if (!dart.notNull(isAssignable(tType, sType))) 3605 if (!dart.notNull(isAssignable(tType, sType)))
3606 return false; 3606 return false;
3607 } 3607 }
3608 return true; 3608 return true;
(...skipping 28 matching lines...) Expand all
3637 return false; 3637 return false;
3638 } 3638 }
3639 if (sParametersLen === tParametersLen) { 3639 if (sParametersLen === tParametersLen) {
3640 if (!dart.notNull(areAssignable(dart.as(sParameterTypes, core.List), dart. as(tParameterTypes, core.List), false))) 3640 if (!dart.notNull(areAssignable(dart.as(sParameterTypes, core.List), dart. as(tParameterTypes, core.List), false)))
3641 return false; 3641 return false;
3642 if (!dart.notNull(areAssignable(dart.as(sOptionalParameterTypes, core.List ), dart.as(tOptionalParameterTypes, core.List), true))) { 3642 if (!dart.notNull(areAssignable(dart.as(sOptionalParameterTypes, core.List ), dart.as(tOptionalParameterTypes, core.List), true))) {
3643 return false; 3643 return false;
3644 } 3644 }
3645 } else { 3645 } else {
3646 let pos = 0; 3646 let pos = 0;
3647 for (; dart.notNull(pos) < dart.notNull(sParametersLen); dart.notNull(pos) ++) { 3647 for (; dart.notNull(pos) < dart.notNull(sParametersLen); pos = dart.notNul l(pos) + 1) {
3648 if (!dart.notNull(isAssignable(getIndex(sParameterTypes, pos), getIndex( tParameterTypes, pos)))) { 3648 if (!dart.notNull(isAssignable(getIndex(sParameterTypes, pos), getIndex( tParameterTypes, pos)))) {
3649 return false; 3649 return false;
3650 } 3650 }
3651 } 3651 }
3652 let sPos = 0; 3652 let sPos = 0;
3653 let tPos = pos; 3653 let tPos = pos;
3654 for (; dart.notNull(tPos) < dart.notNull(tParametersLen); dart.notNull(sPo s)++, dart.notNull(tPos)++) { 3654 for (; dart.notNull(tPos) < dart.notNull(tParametersLen); sPos = dart.notN ull(sPos) + 1, tPos = dart.notNull(tPos) + 1) {
3655 if (!dart.notNull(isAssignable(getIndex(sOptionalParameterTypes, sPos), getIndex(tParameterTypes, tPos)))) { 3655 if (!dart.notNull(isAssignable(getIndex(sOptionalParameterTypes, sPos), getIndex(tParameterTypes, tPos)))) {
3656 return false; 3656 return false;
3657 } 3657 }
3658 } 3658 }
3659 tPos = 0; 3659 tPos = 0;
3660 for (; dart.notNull(tPos) < dart.notNull(tOptionalParametersLen); dart.not Null(sPos)++, dart.notNull(tPos)++) { 3660 for (; dart.notNull(tPos) < dart.notNull(tOptionalParametersLen); sPos = d art.notNull(sPos) + 1, tPos = dart.notNull(tPos) + 1) {
3661 if (!dart.notNull(isAssignable(getIndex(sOptionalParameterTypes, sPos), getIndex(tOptionalParameterTypes, tPos)))) { 3661 if (!dart.notNull(isAssignable(getIndex(sOptionalParameterTypes, sPos), getIndex(tOptionalParameterTypes, tPos)))) {
3662 return false; 3662 return false;
3663 } 3663 }
3664 } 3664 }
3665 } 3665 }
3666 let sNamedParameters = getField(s, `${_foreign_helper.JS_FUNCTION_TYPE_NAMED _PARAMETERS_TAG()}`); 3666 let sNamedParameters = getField(s, `${_foreign_helper.JS_FUNCTION_TYPE_NAMED _PARAMETERS_TAG()}`);
3667 let tNamedParameters = getField(t, `${_foreign_helper.JS_FUNCTION_TYPE_NAMED _PARAMETERS_TAG()}`); 3667 let tNamedParameters = getField(t, `${_foreign_helper.JS_FUNCTION_TYPE_NAMED _PARAMETERS_TAG()}`);
3668 return areAssignableMaps(sNamedParameters, tNamedParameters); 3668 return areAssignableMaps(sNamedParameters, tNamedParameters);
3669 } 3669 }
3670 // Function invoke: (dynamic, dynamic) → dynamic 3670 // Function invoke: (dynamic, dynamic) → dynamic
(...skipping 277 matching lines...) Expand 10 before | Expand all | Expand 10 after
3948 exports.getIndex = getIndex; 3948 exports.getIndex = getIndex;
3949 exports.getLength = getLength; 3949 exports.getLength = getLength;
3950 exports.isJsArray = isJsArray; 3950 exports.isJsArray = isJsArray;
3951 exports.hasField = hasField; 3951 exports.hasField = hasField;
3952 exports.hasNoField = hasNoField; 3952 exports.hasNoField = hasNoField;
3953 exports.isJsFunction = isJsFunction; 3953 exports.isJsFunction = isJsFunction;
3954 exports.isJsObject = isJsObject; 3954 exports.isJsObject = isJsObject;
3955 exports.isIdentical = isIdentical; 3955 exports.isIdentical = isIdentical;
3956 exports.isNotIdentical = isNotIdentical; 3956 exports.isNotIdentical = isNotIdentical;
3957 })(_js_helper || (_js_helper = {})); 3957 })(_js_helper || (_js_helper = {}));
OLDNEW
« no previous file with comments | « test/codegen/expect/dart/_isolate_helper.js ('k') | test/codegen/expect/dart/_native_typed_data.js » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698