Chromium Code Reviews| Index: pkg/compiler/lib/src/resolution/members.dart |
| diff --git a/pkg/compiler/lib/src/resolution/members.dart b/pkg/compiler/lib/src/resolution/members.dart |
| index 9d8b71edc0c6469738331192db7638e5d3f8eeb0..b28cb7672c723d00cca8979c00a7254cbfed18d8 100644 |
| --- a/pkg/compiler/lib/src/resolution/members.dart |
| +++ b/pkg/compiler/lib/src/resolution/members.dart |
| @@ -499,6 +499,15 @@ class ResolverVisitor extends MappingVisitor<ResolutionResult> { |
| } |
| } |
| + ResolutionResult visitAssert(Assert node) { |
| + // TODO(sra): We could completely ignore the assert in production mode if we |
| + // didn't need it to be resolved for type checking. |
| + registry.registerAssert(node.hasMessage); |
| + visit(node.condition); |
| + visit(node.message); |
|
Johnni Winther
2015/09/16 16:48:38
The fastest way is the add an option like in https
sra1
2015/09/16 17:33:29
I will do this under a separate CL.
A separate CL
|
| + return const NoneResult(); |
| + } |
| + |
| ResolutionResult visitCascade(Cascade node) { |
| visit(node.expression); |
| return const NoneResult(); |
| @@ -1526,34 +1535,6 @@ class ResolverVisitor extends MappingVisitor<ResolutionResult> { |
| return const NoneResult(); |
| } |
| - /// Handle a, possibly invalid, assertion, like `assert(cond)` or `assert()`. |
| - ResolutionResult handleAssert(Send node) { |
| - assert(invariant(node, node.isCall, |
| - message: "Unexpected assert: $node")); |
| - // If this send is of the form "assert(expr);", then |
| - // this is an assertion. |
| - |
| - CallStructure callStructure = |
| - resolveArguments(node.argumentsNode).callStructure; |
| - SendStructure sendStructure = const AssertStructure(); |
| - if (callStructure.argumentCount != 1) { |
| - compiler.reportError( |
| - node.selector, |
| - MessageKind.WRONG_NUMBER_OF_ARGUMENTS_FOR_ASSERT, |
| - {'argumentCount': callStructure.argumentCount}); |
| - sendStructure = const InvalidAssertStructure(); |
| - } else if (callStructure.namedArgumentCount != 0) { |
| - compiler.reportError( |
| - node.selector, |
| - MessageKind.ASSERT_IS_GIVEN_NAMED_ARGUMENTS, |
| - {'argumentCount': callStructure.namedArgumentCount}); |
| - sendStructure = const InvalidAssertStructure(); |
| - } |
| - registry.registerAssert(node); |
| - registry.registerSendStructure(node, sendStructure); |
| - return const AssertResult(); |
| - } |
| - |
| /// Handle access of a property of [name] on `this`, like `this.name` and |
| /// `this.name()`, or `name` and `name()` in instance context. |
| ResolutionResult handleThisPropertyAccess(Send node, Name name) { |
| @@ -3031,10 +3012,7 @@ class ResolverVisitor extends MappingVisitor<ResolutionResult> { |
| return handleExpressionInvoke(node); |
| } |
| String text = selector.source; |
| - if (text == 'assert') { |
| - // `assert()`. |
| - return handleAssert(node); |
| - } else if (text == 'this') { |
| + if (text == 'this') { |
| // `this()`. |
| return handleThisAccess(node); |
| } |