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

Side by Side Diff: pkg/kernel/lib/transformations/insert_covariance_checks.dart

Issue 2747113004: Run dartfmt on kernel package (Closed)
Patch Set: Created 3 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
« no previous file with comments | « pkg/kernel/lib/transformations/closure/context.dart ('k') | pkg/kernel/test/reify/suite.dart » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright (c) 2016, the Dart project authors. Please see the AUTHORS file 1 // Copyright (c) 2016, the Dart project authors. Please see the AUTHORS file
2 // for details. All rights reserved. Use of this source code is governed by a 2 // for details. All rights reserved. Use of this source code is governed by a
3 // BSD-style license that can be found in the LICENSE file. 3 // BSD-style license that can be found in the LICENSE file.
4 library kernel.transformations.insert_covariance_checks; 4 library kernel.transformations.insert_covariance_checks;
5 5
6 import '../class_hierarchy.dart'; 6 import '../class_hierarchy.dart';
7 import '../clone.dart'; 7 import '../clone.dart';
8 import '../core_types.dart'; 8 import '../core_types.dart';
9 import '../kernel.dart'; 9 import '../kernel.dart';
10 import '../log.dart'; 10 import '../log.dart';
(...skipping 360 matching lines...) Expand 10 before | Expand all | Expand 10 after
371 if (unsafeInputs == null) { 371 if (unsafeInputs == null) {
372 return new VariableGet(cloneParameter); // No check needed. 372 return new VariableGet(cloneParameter); // No check needed.
373 } 373 }
374 // Change the actual parameter type to the safe type, and cast to the 374 // Change the actual parameter type to the safe type, and cast to the
375 // type declared on the original parameter. 375 // type declared on the original parameter.
376 // Use the cloner to map function type parameters to the cloned 376 // Use the cloner to map function type parameters to the cloned
377 // function type parameters (in case the function is generic). 377 // function type parameters (in case the function is generic).
378 var targetType = cloneParameter.type; 378 var targetType = cloneParameter.type;
379 cloneParameter.type = cloner.visitType(getSafeType(unsafeInputs)); 379 cloneParameter.type = cloner.visitType(getSafeType(unsafeInputs));
380 return new AsExpression(new VariableGet(cloneParameter), targetType) 380 return new AsExpression(new VariableGet(cloneParameter), targetType)
381 ..fileOffset = parameter.fileOffset; 381 ..fileOffset = parameter.fileOffset;
382 } 382 }
383 383
384 // TODO: Insert checks for type parameter bounds. 384 // TODO: Insert checks for type parameter bounds.
385 var types = checkedFunction.typeParameters 385 var types = checkedFunction.typeParameters
386 .map((p) => new TypeParameterType(p)) 386 .map((p) => new TypeParameterType(p))
387 .toList(); 387 .toList();
388 var positional = function.positionalParameters.map(getParameter).toList(); 388 var positional = function.positionalParameters.map(getParameter).toList();
389 var named = function.namedParameters 389 var named = function.namedParameters
390 .map((p) => new NamedExpression(p.name, getParameter(p))) 390 .map((p) => new NamedExpression(p.name, getParameter(p)))
391 .toList(); 391 .toList();
(...skipping 19 matching lines...) Expand all
411 } 411 }
412 } 412 }
413 413
414 void generateCheckedFieldSetter(Field field) { 414 void generateCheckedFieldSetter(Field field) {
415 var parameter = getFieldSetterParameter(field); 415 var parameter = getFieldSetterParameter(field);
416 var unsafeTypes = unsafeParameterTypes[parameter]; 416 var unsafeTypes = unsafeParameterTypes[parameter];
417 Expression argument = new VariableGet(parameter); 417 Expression argument = new VariableGet(parameter);
418 if (unsafeTypes != null) { 418 if (unsafeTypes != null) {
419 var castType = substitute(field.type, ownSubstitution); 419 var castType = substitute(field.type, ownSubstitution);
420 argument = new AsExpression(argument, castType) 420 argument = new AsExpression(argument, castType)
421 ..fileOffset = field.fileOffset; 421 ..fileOffset = field.fileOffset;
422 var inputType = substitute(getSafeType(unsafeTypes), ownSubstitution); 422 var inputType = substitute(getSafeType(unsafeTypes), ownSubstitution);
423 parameter.type = inputType; 423 parameter.type = inputType;
424 } 424 }
425 425
426 Statement body = field.isInExternalLibrary 426 Statement body = field.isInExternalLibrary
427 ? null 427 ? null
428 : new ExpressionStatement( 428 : new ExpressionStatement(
429 new DirectPropertySet(new ThisExpression(), field, argument)); 429 new DirectPropertySet(new ThisExpression(), field, argument));
430 430
431 var setter = new Procedure( 431 var setter = new Procedure(
(...skipping 84 matching lines...) Expand 10 before | Expand all | Expand 10 after
516 @override 516 @override
517 visitPropertySet(PropertySet node) { 517 visitPropertySet(PropertySet node) {
518 var target = getChecked(node.receiver, node.interfaceTarget); 518 var target = getChecked(node.receiver, node.interfaceTarget);
519 if (target != null) { 519 if (target != null) {
520 node.interfaceTarget = target; 520 node.interfaceTarget = target;
521 node.name = target.name; 521 node.name = target.name;
522 } 522 }
523 node.visitChildren(this); 523 node.visitChildren(this);
524 } 524 }
525 } 525 }
OLDNEW
« no previous file with comments | « pkg/kernel/lib/transformations/closure/context.dart ('k') | pkg/kernel/test/reify/suite.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698