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

Side by Side Diff: pkg/kernel/lib/analyzer/ast_from_analyzer.dart

Issue 2665723002: Implement canonical name scheme in kernel. (Closed)
Patch Set: Address Kevin's comments Created 3 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
« no previous file with comments | « pkg/kernel/binary.md ('k') | pkg/kernel/lib/analyzer/loader.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) 2016, the Dart project authors. Please see the AUTHORS file 1 // Copyright (c) 2016, 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 library kernel.analyzer.ast_from_analyzer; 4 library kernel.analyzer.ast_from_analyzer;
5 5
6 import '../ast.dart' as ast; 6 import '../ast.dart' as ast;
7 import '../frontend/accessors.dart'; 7 import '../frontend/accessors.dart';
8 import '../frontend/super_initializers.dart'; 8 import '../frontend/super_initializers.dart';
9 import '../log.dart'; 9 import '../log.dart';
10 import '../type_algebra.dart'; 10 import '../type_algebra.dart';
(...skipping 2845 matching lines...) Expand 10 before | Expand all | Expand 10 after
2856 new ast.Name("_redirecting#", scope.currentLibrary); 2856 new ast.Name("_redirecting#", scope.currentLibrary);
2857 ast.Field constructorsField; 2857 ast.Field constructorsField;
2858 for (ast.Field field in classNode.fields) { 2858 for (ast.Field field in classNode.fields) {
2859 if (field.name == constructors) { 2859 if (field.name == constructors) {
2860 constructorsField = field; 2860 constructorsField = field;
2861 break; 2861 break;
2862 } 2862 }
2863 } 2863 }
2864 if (constructorsField == null) { 2864 if (constructorsField == null) {
2865 ast.ListLiteral literal = new ast.ListLiteral(<ast.Expression>[]); 2865 ast.ListLiteral literal = new ast.ListLiteral(<ast.Expression>[]);
2866 constructorsField = new ast.Field(constructors, isStatic: true, 2866 constructorsField = new ast.Field(constructors,
2867 initializer: literal, fileUri: classNode.fileUri) 2867 isStatic: true,
2868 ..fileOffset = classNode.fileOffset; 2868 initializer: literal,
2869 fileUri: classNode.fileUri)..fileOffset = classNode.fileOffset;
2869 classNode.addMember(constructorsField); 2870 classNode.addMember(constructorsField);
2870 } 2871 }
2871 ast.ListLiteral literal = constructorsField.initializer; 2872 ast.ListLiteral literal = constructorsField.initializer;
2872 literal.expressions.add(new ast.StaticGet(procedure)..parent = literal); 2873 literal.expressions.add(new ast.StaticGet(procedure)..parent = literal);
2873 } else { 2874 } else {
2874 var name = node.redirectedConstructor.type.name.name; 2875 var name = node.redirectedConstructor.type.name.name;
2875 if (node.redirectedConstructor.name != null) { 2876 if (node.redirectedConstructor.name != null) {
2876 name += '.' + node.redirectedConstructor.name.name; 2877 name += '.' + node.redirectedConstructor.name.name;
2877 } 2878 }
2878 // TODO(asgerf): Sometimes a TypeError should be thrown. 2879 // TODO(asgerf): Sometimes a TypeError should be thrown.
2879 expression = scope.buildThrowNoSuchMethodError( 2880 expression = scope.buildThrowNoSuchMethodError(
2880 new ast.NullLiteral(), name, new ast.Arguments.empty()); 2881 new ast.NullLiteral(), name, new ast.Arguments.empty());
2881 } 2882 }
2882 var function = procedure.function; 2883 var function = procedure.function;
2883 function.body = new ast.ExpressionStatement(expression) 2884 function.body = new ast.ExpressionStatement(expression)
2884 ..parent = function; 2885 ..parent = function;
2885 } 2886 }
2886 } 2887 }
2887 2888
2888 visitMethodDeclaration(MethodDeclaration node) { 2889 visitMethodDeclaration(MethodDeclaration node) {
2889 addAnnotations(node.metadata); 2890 addAnnotations(node.metadata);
2890 ast.Procedure procedure = currentMember; 2891 ast.Procedure procedure = currentMember;
2891 procedure.function = scope.buildFunctionNode(node.parameters, node.body, 2892 procedure.function = scope.buildFunctionNode(node.parameters, node.body,
2892 returnType: node.returnType, 2893 returnType: node.returnType,
2893 inferredReturnType: scope.buildType( 2894 inferredReturnType: scope.buildType(
2894 resolutionMap.elementDeclaredByMethodDeclaration(node).returnType), 2895 resolutionMap.elementDeclaredByMethodDeclaration(node).returnType),
(...skipping 144 matching lines...) Expand 10 before | Expand all | Expand 10 after
3039 if (list[i - 1].compareTo(item) == 0) { 3040 if (list[i - 1].compareTo(item) == 0) {
3040 ++deleted; 3041 ++deleted;
3041 } else if (deleted > 0) { 3042 } else if (deleted > 0) {
3042 list[i - deleted] = item; 3043 list[i - deleted] = item;
3043 } 3044 }
3044 } 3045 }
3045 if (deleted > 0) { 3046 if (deleted > 0) {
3046 list.length -= deleted; 3047 list.length -= deleted;
3047 } 3048 }
3048 } 3049 }
OLDNEW
« no previous file with comments | « pkg/kernel/binary.md ('k') | pkg/kernel/lib/analyzer/loader.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698