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

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: 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') | dart/frog/leg/lib/clock.dart » ('J')
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 FunctionElement implementation;
371
370 FunctionElement(SourceString name, 372 FunctionElement(SourceString name,
371 ElementKind kind, 373 ElementKind kind,
372 Modifiers this.modifiers, 374 Modifiers modifiers,
373 Element enclosing) 375 Element enclosing)
374 : super(name, kind, enclosing); 376 : this.tooMuchOverloading(name, null, kind, modifiers, enclosing, null);
375 377
376 FunctionElement.node(SourceString name, 378 FunctionElement.node(SourceString name,
377 FunctionExpression node, 379 FunctionExpression node,
378 ElementKind kind, 380 ElementKind kind,
379 Modifiers this.modifiers, 381 Modifiers modifiers,
380 Element enclosing) 382 Element enclosing)
381 : super(name, kind, enclosing), cachedNode = node; 383 : this.tooMuchOverloading(name, node, kind, modifiers, enclosing, null);
382 384
383 FunctionElement.from(SourceString name, 385 FunctionElement.from(SourceString name,
384 FunctionElement other, 386 FunctionElement other,
385 Element enclosing) 387 Element enclosing)
386 : super(name, other.kind, enclosing), 388 : this.tooMuchOverloading(name, other.cachedNode, other.kind,
387 cachedNode = other.cachedNode, 389 other.modifiers, enclosing,
388 modifiers = other.modifiers, 390 other.functionParameters);
389 functionParameters = other.functionParameters; 391
392 FunctionElement.tooMuchOverloading(SourceString name,
ngeoffray 2012/02/17 09:45:21 Unsurprisingly, this is too much. Why didn't you k
ahe 2012/02/17 15:43:11 As we discussed, I'd like to raise the abstraction
393 FunctionExpression this.cachedNode,
394 ElementKind kind,
395 Modifiers this.modifiers,
396 Element enclosing,
397 FunctionParameters this.functionParameters)
398 : super(name, kind, enclosing)
399 {
400 implementation = this;
401 }
390 402
391 bool isInstanceMember() { 403 bool isInstanceMember() {
392 return isMember() 404 return isMember()
393 && kind != ElementKind.GENERATIVE_CONSTRUCTOR 405 && kind != ElementKind.GENERATIVE_CONSTRUCTOR
394 && !modifiers.isFactory() 406 && !modifiers.isFactory()
395 && !modifiers.isStatic(); 407 && !modifiers.isStatic();
396 } 408 }
397 409
398 FunctionParameters computeParameters(Compiler compiler) { 410 FunctionParameters computeParameters(Compiler compiler) {
399 if (functionParameters !== null) return functionParameters; 411 if (functionParameters !== null) return functionParameters;
(...skipping 322 matching lines...) Expand 10 before | Expand all | Expand 10 after
722 bool isContinueTarget = false; 734 bool isContinueTarget = false;
723 735
724 StatementElement(this.origin, Element enclosingElement) 736 StatementElement(this.origin, Element enclosingElement)
725 : super(const SourceString(""), ElementKind.STATEMENT, enclosingElement); 737 : super(const SourceString(""), ElementKind.STATEMENT, enclosingElement);
726 StatementElement.label(String name, this.origin, Element enclosingElement) 738 StatementElement.label(String name, this.origin, Element enclosingElement)
727 : super(new SourceString(name), ElementKind.STATEMENT, enclosingElement); 739 : super(new SourceString(name), ElementKind.STATEMENT, enclosingElement);
728 bool get isTarget() => isBreakTarget || isContinueTarget; 740 bool get isTarget() => isBreakTarget || isContinueTarget;
729 741
730 Node parseNode(DiagnosticListener l) => origin; 742 Node parseNode(DiagnosticListener l) => origin;
731 } 743 }
OLDNEW
« no previous file with comments | « no previous file | dart/frog/leg/emitter.dart » ('j') | dart/frog/leg/lib/clock.dart » ('J')

Powered by Google App Engine
This is Rietveld 408576698