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

Side by Side Diff: pkg/compiler/lib/src/resolution/members.dart

Issue 1892183002: Refactor Parsing to remove compiler dependency (Closed) Base URL: git@github.com:dart-lang/sdk.git@master
Patch Set: Created 4 years, 8 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
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 dart2js.resolution.members; 5 library dart2js.resolution.members;
6 6
7 import '../common.dart'; 7 import '../common.dart';
8 import '../common/names.dart' show Selectors; 8 import '../common/names.dart' show Selectors;
9 import '../common/resolution.dart' show Feature; 9 import '../common/resolution.dart' show Feature;
10 import '../compiler.dart' show Compiler; 10 import '../compiler.dart' show Compiler;
(...skipping 370 matching lines...) Expand 10 before | Expand all | Expand 10 after
381 Name getRedirectingThisOrSuperConstructorName(Send node) { 381 Name getRedirectingThisOrSuperConstructorName(Send node) {
382 if (isNamedConstructor(node)) { 382 if (isNamedConstructor(node)) {
383 String constructorName = node.selector.asIdentifier().source; 383 String constructorName = node.selector.asIdentifier().source;
384 return new Name(constructorName, enclosingElement.library); 384 return new Name(constructorName, enclosingElement.library);
385 } else { 385 } else {
386 return const PublicName(''); 386 return const PublicName('');
387 } 387 }
388 } 388 }
389 389
390 FunctionElement resolveConstructorRedirection(FunctionElementX constructor) { 390 FunctionElement resolveConstructorRedirection(FunctionElementX constructor) {
391 FunctionExpression node = constructor.parseNode(resolution.parsing); 391 FunctionExpression node = constructor.parseNode(resolution.parsingContext);
392 392
393 // A synthetic constructor does not have a node. 393 // A synthetic constructor does not have a node.
394 if (node == null) return null; 394 if (node == null) return null;
395 if (node.initializers == null) return null; 395 if (node.initializers == null) return null;
396 Link<Node> initializers = node.initializers.nodes; 396 Link<Node> initializers = node.initializers.nodes;
397 if (!initializers.isEmpty && 397 if (!initializers.isEmpty &&
398 Initializers.isConstructorRedirect(initializers.head)) { 398 Initializers.isConstructorRedirect(initializers.head)) {
399 Name name = getRedirectingThisOrSuperConstructorName(initializers.head); 399 Name name = getRedirectingThisOrSuperConstructorName(initializers.head);
400 final ClassElement classElement = constructor.enclosingClass; 400 final ClassElement classElement = constructor.enclosingClass;
401 return classElement.lookupConstructor(name.text); 401 return classElement.lookupConstructor(name.text);
(...skipping 4269 matching lines...) Expand 10 before | Expand all | Expand 10 after
4671 } 4671 }
4672 return const NoneResult(); 4672 return const NoneResult();
4673 } 4673 }
4674 } 4674 }
4675 4675
4676 /// Looks up [name] in [scope] and unwraps the result. 4676 /// Looks up [name] in [scope] and unwraps the result.
4677 Element lookupInScope( 4677 Element lookupInScope(
4678 DiagnosticReporter reporter, Node node, Scope scope, String name) { 4678 DiagnosticReporter reporter, Node node, Scope scope, String name) {
4679 return Elements.unwrap(scope.lookup(name), reporter, node); 4679 return Elements.unwrap(scope.lookup(name), reporter, node);
4680 } 4680 }
OLDNEW
« no previous file with comments | « pkg/compiler/lib/src/resolution/constructors.dart ('k') | pkg/compiler/lib/src/resolution/resolution.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698