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

Side by Side Diff: pkg/compiler/lib/src/resolution/members.dart

Issue 2129183002: Support checked mode (Closed) Base URL: https://github.com/dart-lang/sdk.git@master
Patch Set: Created 4 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
OLDNEW
1 // Copyright (c) 2012, the Dart project authors. Please see the AUTHORS file 1 // Copyright (c) 2012, 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 dart2js.resolution.members; 5 library dart2js.resolution.members;
6 6
7 import '../common.dart'; 7 import '../common.dart';
8 import '../common/names.dart' show Selectors; 8 import '../common/names.dart' show Selectors;
9 import '../common/resolution.dart' show Feature; 9 import '../common/resolution.dart' show Feature;
10 import '../compiler.dart' show Compiler; 10 import '../compiler.dart' show Compiler;
(...skipping 352 matching lines...) Expand 10 before | Expand all | Expand 10 after
363 } else if (element.isClass && sendIsMemberAccess) { 363 } else if (element.isClass && sendIsMemberAccess) {
364 return new PrefixResult(null, element); 364 return new PrefixResult(null, element);
365 } 365 }
366 return new ElementResult(element); 366 return new ElementResult(element);
367 } 367 }
368 return const NoneResult(); 368 return const NoneResult();
369 } 369 }
370 } 370 }
371 371
372 TypeResult visitTypeAnnotation(TypeAnnotation node) { 372 TypeResult visitTypeAnnotation(TypeAnnotation node) {
373 DartType type = resolveTypeAnnotation(node); 373 return new TypeResult(resolveTypeAnnotation(node));
374 if (inCheckContext) {
375 registry.registerTypeUse(new TypeUse.checkedModeCheck(type));
376 }
377 return new TypeResult(type);
378 } 374 }
379 375
380 bool isNamedConstructor(Send node) => node.receiver != null; 376 bool isNamedConstructor(Send node) => node.receiver != null;
381 377
382 Name getRedirectingThisOrSuperConstructorName(Send node) { 378 Name getRedirectingThisOrSuperConstructorName(Send node) {
383 if (isNamedConstructor(node)) { 379 if (isNamedConstructor(node)) {
384 String constructorName = node.selector.asIdentifier().source; 380 String constructorName = node.selector.asIdentifier().source;
385 return new Name(constructorName, enclosingElement.library); 381 return new Name(constructorName, enclosingElement.library);
386 } else { 382 } else {
387 return const PublicName(''); 383 return const PublicName('');
(...skipping 62 matching lines...) Expand 10 before | Expand all | Expand 10 after
450 addToScope(parameterElement); 446 addToScope(parameterElement);
451 } 447 }
452 parameterNodes = parameterNodes.tail; 448 parameterNodes = parameterNodes.tail;
453 }); 449 });
454 addDeferredAction(enclosingElement, () { 450 addDeferredAction(enclosingElement, () {
455 functionSignature.forEachOptionalParameter((ParameterElementX parameter) { 451 functionSignature.forEachOptionalParameter((ParameterElementX parameter) {
456 parameter.constant = 452 parameter.constant =
457 compiler.resolver.constantCompiler.compileConstant(parameter); 453 compiler.resolver.constantCompiler.compileConstant(parameter);
458 }); 454 });
459 }); 455 });
460 if (inCheckContext) { 456 functionSignature.forEachParameter((ParameterElement element) {
461 functionSignature.forEachParameter((ParameterElement element) { 457 registry.registerTypeUse(new TypeUse.checkedModeCheck(element.type));
462 registry.registerTypeUse(new TypeUse.checkedModeCheck(element.type)); 458 });
463 });
464 }
465 } 459 }
466 460
467 ResolutionResult visitAssert(Assert node) { 461 ResolutionResult visitAssert(Assert node) {
468 if (!compiler.options.enableAssertMessage) { 462 if (!compiler.options.enableAssertMessage) {
469 if (node.hasMessage) { 463 if (node.hasMessage) {
470 reporter.reportErrorMessage( 464 reporter.reportErrorMessage(
471 node, MessageKind.EXPERIMENTAL_ASSERT_MESSAGE); 465 node, MessageKind.EXPERIMENTAL_ASSERT_MESSAGE);
472 } 466 }
473 } 467 }
474 // TODO(sra): We could completely ignore the assert in production mode if we 468 // TODO(sra): We could completely ignore the assert in production mode if we
(...skipping 3580 matching lines...) Expand 10 before | Expand all | Expand 10 after
4055 {bool inConstContext: false}) { 4049 {bool inConstContext: false}) {
4056 return node.accept(new ConstructorResolver(compiler, this, 4050 return node.accept(new ConstructorResolver(compiler, this,
4057 inConstContext: inConstContext)); 4051 inConstContext: inConstContext));
4058 } 4052 }
4059 4053
4060 DartType resolveTypeAnnotation(TypeAnnotation node, 4054 DartType resolveTypeAnnotation(TypeAnnotation node,
4061 {bool malformedIsError: false, bool deferredIsMalformed: true}) { 4055 {bool malformedIsError: false, bool deferredIsMalformed: true}) {
4062 DartType type = typeResolver.resolveTypeAnnotation(this, node, 4056 DartType type = typeResolver.resolveTypeAnnotation(this, node,
4063 malformedIsError: malformedIsError, 4057 malformedIsError: malformedIsError,
4064 deferredIsMalformed: deferredIsMalformed); 4058 deferredIsMalformed: deferredIsMalformed);
4065 if (inCheckContext) { 4059 registry.registerTypeUse(new TypeUse.checkedModeCheck(type));
4066 registry.registerTypeUse(new TypeUse.checkedModeCheck(type));
4067 }
4068 return type; 4060 return type;
4069 } 4061 }
4070 4062
4071 ResolutionResult visitLiteralList(LiteralList node) { 4063 ResolutionResult visitLiteralList(LiteralList node) {
4072 bool isValidAsConstant = true; 4064 bool isValidAsConstant = true;
4073 sendIsMemberAccess = false; 4065 sendIsMemberAccess = false;
4074 4066
4075 NodeList arguments = node.typeArguments; 4067 NodeList arguments = node.typeArguments;
4076 DartType typeArgument; 4068 DartType typeArgument;
4077 if (arguments != null) { 4069 if (arguments != null) {
(...skipping 645 matching lines...) Expand 10 before | Expand all | Expand 10 after
4723 } 4715 }
4724 return const NoneResult(); 4716 return const NoneResult();
4725 } 4717 }
4726 } 4718 }
4727 4719
4728 /// Looks up [name] in [scope] and unwraps the result. 4720 /// Looks up [name] in [scope] and unwraps the result.
4729 Element lookupInScope( 4721 Element lookupInScope(
4730 DiagnosticReporter reporter, Node node, Scope scope, String name) { 4722 DiagnosticReporter reporter, Node node, Scope scope, String name) {
4731 return Elements.unwrap(scope.lookup(name), reporter, node); 4723 return Elements.unwrap(scope.lookup(name), reporter, node);
4732 } 4724 }
OLDNEW
« no previous file with comments | « pkg/compiler/lib/src/js_backend/runtime_types.dart ('k') | pkg/compiler/lib/src/resolution/signatures.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698