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

Side by Side Diff: dart/frog/leg/elements/elements.dart

Issue 9419009: Use shared implementation of Stopwatch. (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge
Patch Set: address review comments Created 8 years, 10 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 | Annotate | Revision Log
« no previous file with comments | « no previous file | dart/frog/leg/emitter.dart » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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('elements'); 5 #library('elements');
6 6
7 #import('../tree/tree.dart'); 7 #import('../tree/tree.dart');
8 #import('../scanner/scannerlib.dart'); 8 #import('../scanner/scannerlib.dart');
9 #import('../leg.dart'); // TODO(karlklose): we only need type. 9 #import('../leg.dart'); // TODO(karlklose): we only need type.
10 #import('../util/util.dart'); 10 #import('../util/util.dart');
(...skipping 349 matching lines...) Expand 10 before | Expand all | Expand 10 after
360 int get parameterCount() => requiredParameterCount + optionalParameterCount; 360 int get parameterCount() => requiredParameterCount + optionalParameterCount;
361 } 361 }
362 362
363 class FunctionElement extends Element { 363 class FunctionElement extends Element {
364 FunctionExpression cachedNode; 364 FunctionExpression cachedNode;
365 Type type; 365 Type type;
366 final Modifiers modifiers; 366 final Modifiers modifiers;
367 367
368 FunctionParameters functionParameters; 368 FunctionParameters functionParameters;
369 369
370 /**
371 * If this is an interface constructor, [defaultImplementation] will
372 * changed by the resolver to point to the default
373 * implementation. Otherwise, [:defaultImplementation === this:].
374 */
375 FunctionElement defaultImplementation;
376
370 FunctionElement(SourceString name, 377 FunctionElement(SourceString name,
371 ElementKind kind, 378 ElementKind kind,
372 Modifiers this.modifiers, 379 Modifiers modifiers,
373 Element enclosing) 380 Element enclosing)
374 : super(name, kind, enclosing); 381 : this.tooMuchOverloading(name, null, kind, modifiers, enclosing, null);
375 382
376 FunctionElement.node(SourceString name, 383 FunctionElement.node(SourceString name,
377 FunctionExpression node, 384 FunctionExpression node,
378 ElementKind kind, 385 ElementKind kind,
379 Modifiers this.modifiers, 386 Modifiers modifiers,
380 Element enclosing) 387 Element enclosing)
381 : super(name, kind, enclosing), cachedNode = node; 388 : this.tooMuchOverloading(name, node, kind, modifiers, enclosing, null);
382 389
383 FunctionElement.from(SourceString name, 390 FunctionElement.from(SourceString name,
384 FunctionElement other, 391 FunctionElement other,
385 Element enclosing) 392 Element enclosing)
386 : super(name, other.kind, enclosing), 393 : this.tooMuchOverloading(name, other.cachedNode, other.kind,
387 cachedNode = other.cachedNode, 394 other.modifiers, enclosing,
388 modifiers = other.modifiers, 395 other.functionParameters);
389 functionParameters = other.functionParameters; 396
397 FunctionElement.tooMuchOverloading(SourceString name,
398 FunctionExpression this.cachedNode,
399 ElementKind kind,
400 Modifiers this.modifiers,
401 Element enclosing,
402 FunctionParameters this.functionParameters)
403 : super(name, kind, enclosing)
404 {
405 defaultImplementation = this;
406 }
390 407
391 bool isInstanceMember() { 408 bool isInstanceMember() {
392 return isMember() 409 return isMember()
393 && kind != ElementKind.GENERATIVE_CONSTRUCTOR 410 && kind != ElementKind.GENERATIVE_CONSTRUCTOR
394 && !modifiers.isFactory() 411 && !modifiers.isFactory()
395 && !modifiers.isStatic(); 412 && !modifiers.isStatic();
396 } 413 }
397 414
398 FunctionParameters computeParameters(Compiler compiler) { 415 FunctionParameters computeParameters(Compiler compiler) {
399 if (functionParameters !== null) return functionParameters; 416 if (functionParameters !== null) return functionParameters;
(...skipping 191 matching lines...) Expand 10 before | Expand all | Expand 10 after
591 Element result = constructors[normalizedName]; 608 Element result = constructors[normalizedName];
592 if (result === null && noMatch !== null) { 609 if (result === null && noMatch !== null) {
593 result = noMatch(lookupLocalMember(constructorName)); 610 result = noMatch(lookupLocalMember(constructorName));
594 } 611 }
595 return result; 612 return result;
596 } 613 }
597 614
598 bool canHaveDefaultConstructor() => constructors.length == 0; 615 bool canHaveDefaultConstructor() => constructors.length == 0;
599 616
600 SynthesizedConstructorElement getSynthesizedConstructor() { 617 SynthesizedConstructorElement getSynthesizedConstructor() {
618 // TODO(ahe): Get rid of this method. Add the
619 // SynthesizedConstructorElement to [constructors] if empty when
620 // [resolve] is called.
601 if (synthesizedConstructor === null && canHaveDefaultConstructor()) { 621 if (synthesizedConstructor === null && canHaveDefaultConstructor()) {
602 synthesizedConstructor = new SynthesizedConstructorElement(this); 622 synthesizedConstructor = new SynthesizedConstructorElement(this);
603 } 623 }
604 return synthesizedConstructor; 624 return synthesizedConstructor;
605 } 625 }
606 626
607 /** 627 /**
608 * Returns the super class, if any. 628 * Returns the super class, if any.
609 * 629 *
610 * The returned element may not be resolved yet. 630 * The returned element may not be resolved yet.
(...skipping 111 matching lines...) Expand 10 before | Expand all | Expand 10 after
722 bool isContinueTarget = false; 742 bool isContinueTarget = false;
723 743
724 StatementElement(this.origin, Element enclosingElement) 744 StatementElement(this.origin, Element enclosingElement)
725 : super(const SourceString(""), ElementKind.STATEMENT, enclosingElement); 745 : super(const SourceString(""), ElementKind.STATEMENT, enclosingElement);
726 StatementElement.label(String name, this.origin, Element enclosingElement) 746 StatementElement.label(String name, this.origin, Element enclosingElement)
727 : super(new SourceString(name), ElementKind.STATEMENT, enclosingElement); 747 : super(new SourceString(name), ElementKind.STATEMENT, enclosingElement);
728 bool get isTarget() => isBreakTarget || isContinueTarget; 748 bool get isTarget() => isBreakTarget || isContinueTarget;
729 749
730 Node parseNode(DiagnosticListener l) => origin; 750 Node parseNode(DiagnosticListener l) => origin;
731 } 751 }
OLDNEW
« no previous file with comments | « no previous file | dart/frog/leg/emitter.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698