OLD | NEW |
1 /* | 1 /* |
2 * Copyright (c) 2012, the Dart project authors. | 2 * Copyright (c) 2012, the Dart project authors. |
3 * | 3 * |
4 * Licensed under the Eclipse Public License v1.0 (the "License"); you may not u
se this file except | 4 * Licensed under the Eclipse Public License v1.0 (the "License"); you may not u
se this file except |
5 * in compliance with the License. You may obtain a copy of the License at | 5 * in compliance with the License. You may obtain a copy of the License at |
6 * | 6 * |
7 * http://www.eclipse.org/legal/epl-v10.html | 7 * http://www.eclipse.org/legal/epl-v10.html |
8 * | 8 * |
9 * Unless required by applicable law or agreed to in writing, software distribut
ed under the License | 9 * Unless required by applicable law or agreed to in writing, software distribut
ed under the License |
10 * is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY K
IND, either express | 10 * is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY K
IND, either express |
(...skipping 36 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
47 import com.google.dart.compiler.ast.DartThisExpression; | 47 import com.google.dart.compiler.ast.DartThisExpression; |
48 import com.google.dart.compiler.ast.DartTypeNode; | 48 import com.google.dart.compiler.ast.DartTypeNode; |
49 import com.google.dart.compiler.ast.DartTypeParameter; | 49 import com.google.dart.compiler.ast.DartTypeParameter; |
50 import com.google.dart.compiler.ast.DartUnit; | 50 import com.google.dart.compiler.ast.DartUnit; |
51 import com.google.dart.compiler.ast.DartUnqualifiedInvocation; | 51 import com.google.dart.compiler.ast.DartUnqualifiedInvocation; |
52 import com.google.dart.compiler.ast.DartVariable; | 52 import com.google.dart.compiler.ast.DartVariable; |
53 import com.google.dart.compiler.ast.DartVariableStatement; | 53 import com.google.dart.compiler.ast.DartVariableStatement; |
54 import com.google.dart.compiler.ast.DartWhileStatement; | 54 import com.google.dart.compiler.ast.DartWhileStatement; |
55 import com.google.dart.compiler.ast.LibraryUnit; | 55 import com.google.dart.compiler.ast.LibraryUnit; |
56 import com.google.dart.compiler.common.SourceInfo; | 56 import com.google.dart.compiler.common.SourceInfo; |
57 import com.google.dart.compiler.parser.DartScannerParserContext; | |
58 import com.google.dart.compiler.parser.ParserContext; | |
59 import com.google.dart.compiler.resolver.ClassElement; | 57 import com.google.dart.compiler.resolver.ClassElement; |
60 import com.google.dart.compiler.resolver.ClassNodeElement; | 58 import com.google.dart.compiler.resolver.ClassNodeElement; |
61 import com.google.dart.compiler.resolver.ConstructorElement; | 59 import com.google.dart.compiler.resolver.ConstructorElement; |
62 import com.google.dart.compiler.resolver.CyclicDeclarationException; | 60 import com.google.dart.compiler.resolver.CyclicDeclarationException; |
63 import com.google.dart.compiler.resolver.Element; | 61 import com.google.dart.compiler.resolver.Element; |
64 import com.google.dart.compiler.resolver.ElementKind; | 62 import com.google.dart.compiler.resolver.ElementKind; |
65 import com.google.dart.compiler.resolver.FieldElement; | 63 import com.google.dart.compiler.resolver.FieldElement; |
66 import com.google.dart.compiler.resolver.FieldNodeElement; | 64 import com.google.dart.compiler.resolver.FieldNodeElement; |
67 import com.google.dart.compiler.resolver.FunctionAliasElement; | 65 import com.google.dart.compiler.resolver.FunctionAliasElement; |
68 import com.google.dart.compiler.resolver.LibraryElement; | 66 import com.google.dart.compiler.resolver.LibraryElement; |
(...skipping 1386 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1455 public void complete(LibrarySource library, DartSource sourceFile, String sour
ceContent, | 1453 public void complete(LibrarySource library, DartSource sourceFile, String sour
ceContent, |
1456 int completionPosition, int pos) throws DartModelException { | 1454 int completionPosition, int pos) throws DartModelException { |
1457 source = sourceContent; | 1455 source = sourceContent; |
1458 actualCompletionPosition = completionPosition - 1; | 1456 actualCompletionPosition = completionPosition - 1; |
1459 offset = pos; | 1457 offset = pos; |
1460 isCompletionAfterDot = actualCompletionPosition >= 0 | 1458 isCompletionAfterDot = actualCompletionPosition >= 0 |
1461 && source.charAt(actualCompletionPosition) == '.'; | 1459 && source.charAt(actualCompletionPosition) == '.'; |
1462 CompletionMetrics metrics = requestor.getMetrics(); | 1460 CompletionMetrics metrics = requestor.getMetrics(); |
1463 | 1461 |
1464 DartCompilerListener listener = DartCompilerListener.EMPTY; | 1462 DartCompilerListener listener = DartCompilerListener.EMPTY; |
1465 ParserContext ctx = new DartScannerParserContext(sourceFile, source, listene
r); | |
1466 prefixes = new HashSet<String>(); | 1463 prefixes = new HashSet<String>(); |
1467 if (currentCompilationUnit != null) { | 1464 if (currentCompilationUnit != null) { |
1468 DartImport[] imports = currentCompilationUnit.getLibrary().getImports(); | 1465 DartImport[] imports = currentCompilationUnit.getLibrary().getImports(); |
1469 for (DartImport imp : imports) { | 1466 for (DartImport imp : imports) { |
1470 String prefix = imp.getPrefix(); | 1467 String prefix = imp.getPrefix(); |
1471 if (prefix != null) { | 1468 if (prefix != null) { |
1472 prefixes.add(prefix); | 1469 prefixes.add(prefix); |
1473 } | 1470 } |
1474 } | 1471 } |
1475 } | 1472 } |
1476 CompletionParser parser = new CompletionParser(ctx, prefixes); | 1473 CompletionParser parser = new CompletionParser(sourceFile, source, prefixes,
listener, null); |
1477 parser.setCompletionPosition(completionPosition); | 1474 parser.setCompletionPosition(completionPosition); |
1478 parsedUnit = DartCompilerUtilities.secureParseUnit(parser, sourceFile); | 1475 parsedUnit = DartCompilerUtilities.secureParseUnit(parser, sourceFile); |
1479 | 1476 |
1480 if (parsedUnit == null) { | 1477 if (parsedUnit == null) { |
1481 return; | 1478 return; |
1482 } | 1479 } |
1483 if (parsedUnit.getTopLevelNodes().isEmpty()) { | 1480 if (parsedUnit.getTopLevelNodes().isEmpty()) { |
1484 return; | 1481 return; |
1485 } | 1482 } |
1486 Collection<DartCompilationError> parseErrors = new ArrayList<DartCompilation
Error>(); | 1483 Collection<DartCompilationError> parseErrors = new ArrayList<DartCompilation
Error>(); |
(...skipping 1109 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2596 } | 2593 } |
2597 } | 2594 } |
2598 | 2595 |
2599 private void visitorNotImplementedYet(DartNode node, DartNode sourceNode, | 2596 private void visitorNotImplementedYet(DartNode node, DartNode sourceNode, |
2600 Class<? extends ASTVisitor<Void>> astClass) { | 2597 Class<? extends ASTVisitor<Void>> astClass) { |
2601 if (metrics != null) { | 2598 if (metrics != null) { |
2602 metrics.visitorNotImplementedYet(node, sourceNode, astClass); | 2599 metrics.visitorNotImplementedYet(node, sourceNode, astClass); |
2603 } | 2600 } |
2604 } | 2601 } |
2605 } | 2602 } |
OLD | NEW |