| OLD | NEW |
| 1 // Copyright (c) 2011, the Dart project authors. Please see the AUTHORS file | 1 // Copyright (c) 2011, 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 package com.google.dart.compiler.resolver; | 5 package com.google.dart.compiler.resolver; |
| 6 | 6 |
| 7 import com.google.common.annotations.VisibleForTesting; | 7 import com.google.common.annotations.VisibleForTesting; |
| 8 import com.google.dart.compiler.DartCompilerContext; | 8 import com.google.dart.compiler.DartCompilerContext; |
| 9 import com.google.dart.compiler.ast.DartClass; | 9 import com.google.dart.compiler.ast.DartClass; |
| 10 import com.google.dart.compiler.ast.DartExpression; | 10 import com.google.dart.compiler.ast.DartExpression; |
| (...skipping 169 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 180 resolveConstantExpression(node.getValue()); | 180 resolveConstantExpression(node.getValue()); |
| 181 return null; | 181 return null; |
| 182 } | 182 } |
| 183 | 183 |
| 184 @Override | 184 @Override |
| 185 public Element visitMethodDefinition(DartMethodDefinition node) { | 185 public Element visitMethodDefinition(DartMethodDefinition node) { |
| 186 MethodElement member = node.getSymbol(); | 186 MethodElement member = node.getSymbol(); |
| 187 ResolutionContext previousContext = context; | 187 ResolutionContext previousContext = context; |
| 188 context = context.extend(member.getName()); | 188 context = context.extend(member.getName()); |
| 189 DartFunction functionNode = node.getFunction(); | 189 DartFunction functionNode = node.getFunction(); |
| 190 List<DartParameter> parameters = functionNode.getParams(); | 190 List<DartParameter> parameters = functionNode.getParameters(); |
| 191 for (DartParameter parameter : parameters) { | 191 for (DartParameter parameter : parameters) { |
| 192 getContext().declare(parameter.getSymbol(), null, null); | 192 getContext().declare(parameter.getSymbol(), null, null); |
| 193 // Then resolve the default values. | 193 // Then resolve the default values. |
| 194 resolveConstantExpression(parameter.getDefaultExpr()); | 194 resolveConstantExpression(parameter.getDefaultExpr()); |
| 195 } | 195 } |
| 196 Element element = node.getSymbol(); | 196 Element element = node.getSymbol(); |
| 197 if (ElementKind.of(element) == ElementKind.CONSTRUCTOR && | 197 if (ElementKind.of(element) == ElementKind.CONSTRUCTOR && |
| 198 node.getModifiers().isConstant()) { | 198 node.getModifiers().isConstant()) { |
| 199 for (DartInitializer initializer : node.getInitializers()) { | 199 for (DartInitializer initializer : node.getInitializers()) { |
| 200 DartExpression initializerValue = initializer.getValue(); | 200 DartExpression initializerValue = initializer.getValue(); |
| (...skipping 38 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 239 exec(unit, compilerContext, unit.getLibrary().getElement().getScope(), typeP
rovider); | 239 exec(unit, compilerContext, unit.getLibrary().getElement().getScope(), typeP
rovider); |
| 240 } | 240 } |
| 241 | 241 |
| 242 @VisibleForTesting | 242 @VisibleForTesting |
| 243 public void exec(DartUnit unit, DartCompilerContext compilerContext, | 243 public void exec(DartUnit unit, DartCompilerContext compilerContext, |
| 244 Scope scope, CoreTypeProvider typeProvider) { | 244 Scope scope, CoreTypeProvider typeProvider) { |
| 245 unit.accept(new ConstResolveVisitor(unit, compilerContext, scope, | 245 unit.accept(new ConstResolveVisitor(unit, compilerContext, scope, |
| 246 typeProvider)); | 246 typeProvider)); |
| 247 } | 247 } |
| 248 } | 248 } |
| OLD | NEW |