| OLD | NEW |
| 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 | 8 import '../common/names.dart' show |
| 9 Selectors; | 9 Selectors; |
| 10 import '../common/resolution.dart' show | 10 import '../common/resolution.dart' show |
| (...skipping 162 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 173 // fields. | 173 // fields. |
| 174 inInstanceContext = (element.isInstanceMember && !element.isField) | 174 inInstanceContext = (element.isInstanceMember && !element.isField) |
| 175 || element.isGenerativeConstructor, | 175 || element.isGenerativeConstructor, |
| 176 this.currentClass = element.isClassMember ? element.enclosingClass | 176 this.currentClass = element.isClassMember ? element.enclosingClass |
| 177 : null, | 177 : null, |
| 178 this.statementScope = new StatementScope(), | 178 this.statementScope = new StatementScope(), |
| 179 scope = useEnclosingScope | 179 scope = useEnclosingScope |
| 180 ? Scope.buildEnclosingScope(element) : element.buildScope(), | 180 ? Scope.buildEnclosingScope(element) : element.buildScope(), |
| 181 // The type annotations on a typedef do not imply type checks. | 181 // The type annotations on a typedef do not imply type checks. |
| 182 // TODO(karlklose): clean this up (dartbug.com/8870). | 182 // TODO(karlklose): clean this up (dartbug.com/8870). |
| 183 inCheckContext = compiler.enableTypeAssertions && | 183 inCheckContext = compiler.options.enableTypeAssertions && |
| 184 !element.isLibrary && | 184 !element.isLibrary && |
| 185 !element.isTypedef && | 185 !element.isTypedef && |
| 186 !element.enclosingElement.isTypedef, | 186 !element.enclosingElement.isTypedef, |
| 187 inCatchBlock = false, | 187 inCatchBlock = false, |
| 188 constantState = element.isConst | 188 constantState = element.isConst |
| 189 ? ConstantState.CONSTANT : ConstantState.NON_CONSTANT, | 189 ? ConstantState.CONSTANT : ConstantState.NON_CONSTANT, |
| 190 super(compiler, registry); | 190 super(compiler, registry); |
| 191 | 191 |
| 192 CoreClasses get coreClasses => compiler.coreClasses; | 192 CoreClasses get coreClasses => compiler.coreClasses; |
| 193 | 193 |
| (...skipping 295 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 489 }); | 489 }); |
| 490 }); | 490 }); |
| 491 if (inCheckContext) { | 491 if (inCheckContext) { |
| 492 functionParameters.forEachParameter((ParameterElement element) { | 492 functionParameters.forEachParameter((ParameterElement element) { |
| 493 registry.registerTypeUse(new TypeUse.checkedModeCheck(element.type)); | 493 registry.registerTypeUse(new TypeUse.checkedModeCheck(element.type)); |
| 494 }); | 494 }); |
| 495 } | 495 } |
| 496 } | 496 } |
| 497 | 497 |
| 498 ResolutionResult visitAssert(Assert node) { | 498 ResolutionResult visitAssert(Assert node) { |
| 499 if (!compiler.enableAssertMessage) { | 499 if (!compiler.options.enableAssertMessage) { |
| 500 if (node.hasMessage) { | 500 if (node.hasMessage) { |
| 501 reporter.reportErrorMessage( | 501 reporter.reportErrorMessage( |
| 502 node, MessageKind.EXPERIMENTAL_ASSERT_MESSAGE); | 502 node, MessageKind.EXPERIMENTAL_ASSERT_MESSAGE); |
| 503 } | 503 } |
| 504 } | 504 } |
| 505 // TODO(sra): We could completely ignore the assert in production mode if we | 505 // TODO(sra): We could completely ignore the assert in production mode if we |
| 506 // didn't need it to be resolved for type checking. | 506 // didn't need it to be resolved for type checking. |
| 507 registry.registerFeature( | 507 registry.registerFeature( |
| 508 node.hasMessage ? Feature.ASSERT_WITH_MESSAGE : Feature.ASSERT); | 508 node.hasMessage ? Feature.ASSERT_WITH_MESSAGE : Feature.ASSERT); |
| 509 visit(node.condition); | 509 visit(node.condition); |
| (...skipping 4360 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 4870 } | 4870 } |
| 4871 return const NoneResult(); | 4871 return const NoneResult(); |
| 4872 } | 4872 } |
| 4873 } | 4873 } |
| 4874 | 4874 |
| 4875 /// Looks up [name] in [scope] and unwraps the result. | 4875 /// Looks up [name] in [scope] and unwraps the result. |
| 4876 Element lookupInScope(DiagnosticReporter reporter, Node node, | 4876 Element lookupInScope(DiagnosticReporter reporter, Node node, |
| 4877 Scope scope, String name) { | 4877 Scope scope, String name) { |
| 4878 return Elements.unwrap(scope.lookup(name), reporter, node); | 4878 return Elements.unwrap(scope.lookup(name), reporter, node); |
| 4879 } | 4879 } |
| OLD | NEW |