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

Side by Side Diff: pkg/compiler/lib/src/inferrer/type_graph_nodes.dart

Issue 2033383002: Handle use of fromEnvironment from serialized data. (Closed) Base URL: https://github.com/dart-lang/sdk.git@master
Patch Set: Fixes Created 4 years, 6 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 // Copyright (c) 2013, the Dart project authors. Please see the AUTHORS file 1 // Copyright (c) 2013, 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 4
5 library compiler.src.inferrer.type_graph_nodes; 5 library compiler.src.inferrer.type_graph_nodes;
6 6
7 import 'dart:collection' show IterableBase; 7 import 'dart:collection' show IterableBase;
8 8
9 import '../common.dart'; 9 import '../common.dart';
10 import '../common/names.dart' show Identifiers; 10 import '../common/names.dart' show Identifiers;
(...skipping 476 matching lines...) Expand 10 before | Expand all | Expand 10 after
487 } else { 487 } else {
488 return inferrer 488 return inferrer
489 .typeOfNativeBehavior( 489 .typeOfNativeBehavior(
490 native.NativeBehavior.ofMethod(element, inferrer.compiler)) 490 native.NativeBehavior.ofMethod(element, inferrer.compiler))
491 .type; 491 .type;
492 } 492 }
493 } 493 }
494 } 494 }
495 495
496 Compiler compiler = inferrer.compiler; 496 Compiler compiler = inferrer.compiler;
497 if (element.declaration == compiler.intEnvironment) { 497 if (element.isConstructor) {
498 giveUp(inferrer); 498 ConstructorElement constructor = element;
499 return compiler.typesTask.intType.nullable(); 499 if (constructor.isIntFromEnvironmentConstructor) {
500 } else if (element.declaration == compiler.boolEnvironment) { 500 giveUp(inferrer);
501 giveUp(inferrer); 501 return compiler.typesTask.intType.nullable();
502 return compiler.typesTask.boolType.nullable(); 502 } else if (constructor.isBoolFromEnvironmentConstructor) {
503 } else if (element.declaration == compiler.stringEnvironment) { 503 giveUp(inferrer);
504 giveUp(inferrer); 504 return compiler.typesTask.boolType.nullable();
505 return compiler.typesTask.stringType.nullable(); 505 } else if (constructor.isStringFromEnvironmentConstructor) {
506 giveUp(inferrer);
507 return compiler.typesTask.stringType.nullable();
508 }
506 } 509 }
507 return null; 510 return null;
508 } 511 }
509 512
510 TypeMask potentiallyNarrowType( 513 TypeMask potentiallyNarrowType(
511 TypeMask mask, TypeGraphInferrerEngine inferrer) { 514 TypeMask mask, TypeGraphInferrerEngine inferrer) {
512 Compiler compiler = inferrer.compiler; 515 Compiler compiler = inferrer.compiler;
513 if (!compiler.options.trustTypeAnnotations && 516 if (!compiler.options.trustTypeAnnotations &&
514 !compiler.options.enableTypeAssertions && 517 !compiler.options.enableTypeAssertions &&
515 !inferrer.annotations.trustTypeAnnotations(element)) { 518 !inferrer.annotations.trustTypeAnnotations(element)) {
(...skipping 1195 matching lines...) Expand 10 before | Expand all | Expand 10 after
1711 } else if (annotation.isVoid) { 1714 } else if (annotation.isVoid) {
1712 otherType = compiler.typesTask.nullType; 1715 otherType = compiler.typesTask.nullType;
1713 } else { 1716 } else {
1714 assert(annotation.isInterfaceType); 1717 assert(annotation.isInterfaceType);
1715 otherType = new TypeMask.nonNullSubtype(annotation.element, compiler.world); 1718 otherType = new TypeMask.nonNullSubtype(annotation.element, compiler.world);
1716 } 1719 }
1717 if (isNullable) otherType = otherType.nullable(); 1720 if (isNullable) otherType = otherType.nullable();
1718 if (type == null) return otherType; 1721 if (type == null) return otherType;
1719 return type.intersection(otherType, compiler.world); 1722 return type.intersection(otherType, compiler.world);
1720 } 1723 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698