| Index: dart/lib/compiler/implementation/scanner/class_element_parser.dart
|
| diff --git a/dart/lib/compiler/implementation/scanner/class_element_parser.dart b/dart/lib/compiler/implementation/scanner/class_element_parser.dart
|
| index bf0c1ddc6f35765723ab3ac02ed8ad523c41da23..545688c29179752ebfd51910d1736b4624e3fba8 100644
|
| --- a/dart/lib/compiler/implementation/scanner/class_element_parser.dart
|
| +++ b/dart/lib/compiler/implementation/scanner/class_element_parser.dart
|
| @@ -32,22 +32,27 @@ class PartialClassElement extends ClassElement {
|
| super.resolutionState = state;
|
| }
|
|
|
| - ClassNode parseNode(DiagnosticListener diagnosticListener) {
|
| + ClassNode parseNode(Compiler compiler) {
|
| if (cachedNode != null) return cachedNode;
|
| - // TODO(ahe): Measure these tasks.
|
| - MemberListener listener = new MemberListener(diagnosticListener, this);
|
| - Parser parser = new ClassElementParser(listener);
|
| - Token token = parser.parseTopLevelDeclaration(beginToken);
|
| - assert(token === endToken.next);
|
| - cachedNode = listener.popNode();
|
| - assert(listener.nodes.isEmpty());
|
| - if (isPatched) {
|
| - // TODO(lrn): Perhaps extract functionality so it doesn't need compiler.
|
| - Compiler compiler = diagnosticListener;
|
| - ClassNode patchNode = compiler.patchParser.parsePatchClassNode(patch);
|
| - Link<Element> patches = patch.localMembers;
|
| - compiler.applyContainerPatch(this, patches);
|
| - }
|
| + compiler.withCurrentElement(this, () {
|
| + compiler.parser.measure(() {
|
| + MemberListener listener = new MemberListener(compiler, this);
|
| + Parser parser = new ClassElementParser(listener);
|
| + Token token = parser.parseTopLevelDeclaration(beginToken);
|
| + assert(token === endToken.next);
|
| + cachedNode = listener.popNode();
|
| + assert(listener.nodes.isEmpty());
|
| + });
|
| + compiler.patchParser.measure(() {
|
| + if (isPatched) {
|
| + // TODO(lrn): Perhaps extract functionality so it doesn't
|
| + // need compiler.
|
| + ClassNode patchNode = compiler.patchParser.parsePatchClassNode(patch);
|
| + Link<Element> patches = patch.localMembers;
|
| + compiler.applyContainerPatch(this, patches);
|
| + }
|
| + });
|
| + });
|
| return cachedNode;
|
| }
|
|
|
| @@ -114,8 +119,13 @@ class MemberListener extends NodeListener {
|
| if (send === null) return methodName.asIdentifier().source;
|
| Identifier receiver = send.receiver.asIdentifier();
|
| Identifier selector = send.selector.asIdentifier();
|
| - if (selector.asOperator() !== null) {
|
| - return Elements.constructOperatorName(receiver.source, selector.source);
|
| + Operator operator = selector.asOperator();
|
| + if (operator !== null) {
|
| + assert(receiver.source.stringValue === 'operator');
|
| + // TODO(ahe): It is a hack to compare to ')', but it beats
|
| + // parsing the node.
|
| + bool isUnary = operator.token.next.next.stringValue === ')';
|
| + return Elements.constructOperatorName(operator.source, isUnary);
|
| } else {
|
| return Elements.constructConstructorName(receiver.source,
|
| selector.source);
|
|
|