Commit Graph

28909 Commits

Author SHA1 Message Date
Cyrus Najmabadi ff9f59c913 Remove unused constants. 2014-12-18 19:43:36 -08:00
Cyrus Najmabadi a6ea497ff1 Classify the '=' sign in variable/parameter/property as if it was an operator. 2014-12-18 19:38:19 -08:00
Cyrus Najmabadi 48bef4698b Provide better error recovery when we encounter merge markers in the source.
Previously we would just treat each merge marker as trivia and then continue
scanning and parsing like normal.  This worked well in some scenarios, but
fell down in others like:

```
class C {
    public foo() {
<<<<<<< HEAD
        this.bar();
    }
=======
        this.baz();
    }
>>>>>>> Branch

    public bar() { }
}
```

The problem stems from the previous approach trying to incorporate both branches of the merge into
the final tree.  In a case like this, that approach breaks down entirely.  The the parser ends up
seeing the close curly in both included sections, and it considers the class finished.  Then, it
starts erroring when it encounters "public bar()".

The fix is to only incorporate one of these sections into the tree.  Specifically, we only include
the first section.  The second sectoin is treated like trivia and does not affect the parse at all.
To make the experience more pleasant we do *lexically* classify the second section.  That way it
does not appear as just plain black text in the editor.  Instead, it will have appropriate lexicla
classifications for keywords, literals, comments, operators, punctuation, etc.  However, any syntactic
or semantic feature will not work in the second block due to this being trivia as far as any feature
is concerned.

This experience is still much better than what we had originally (where merge markers would absolutely)
destroy the parse tree.  And it is better than what we checked in last week, which could easily create
a borked tree for many types of merges.

Now, almost all merges should still leave the tree in good shape.  All LS features will work in the
first section, and lexical classification will work in the second.
2014-12-18 19:18:13 -08:00
Cyrus Najmabadi 828b33aae7 Add test demonstrating the problem with conflict markers. 2014-12-18 17:23:34 -08:00
Daniel Rosenwasser 4aa37691a1 Fixed issue where the second type's signature having type parameters would not cause an error. 2014-12-18 16:45:29 -08:00
Daniel Rosenwasser 50d0f9b719 Added tests/baselines. 2014-12-18 16:45:26 -08:00
CyrusNajmabadi 5ecc28834e Merge pull request #1512 from Microsoft/layering
Compiler Layering
2014-12-18 13:02:57 -08:00
Cyrus Najmabadi ef2087add5 Merge branch 'master' into layering 2014-12-18 12:20:32 -08:00
Daniel Rosenwasser af9b56bdd9 Merge pull request #1528 from Microsoft/goToDefOnUnionMethod
Fix crash on go-to-def on union method
2014-12-18 12:11:05 -08:00
Cyrus Najmabadi 67b2f13cce Merge branch 'master' into layering
Conflicts:
	src/compiler/parser.ts
2014-12-18 00:39:56 -08:00
Daniel Rosenwasser 6fed3e2601 Merge pull request #1501 from Arnavion/no-emit
Add -noEmit compiler flag that skips the emit stage in ts.compile()
2014-12-17 18:00:33 -08:00
Cyrus Najmabadi b155351e0a Remove unnecessary capture of the diagnostics type checker. 2014-12-17 17:06:12 -08:00
Daniel Rosenwasser 46cd90daf0 Added test, modified test, updated baselines. 2014-12-17 17:05:05 -08:00
Daniel Rosenwasser fac5201765 Only error on non-ambient instantiated modules preceding clodules. 2014-12-17 17:00:42 -08:00
Anders Hejlsberg b2a02fe9ef Merge pull request #1443 from Microsoft/improvedTypeInference
Make initial inferences from parameterless function expressions
2014-12-17 16:19:49 -08:00
Daniel Rosenwasser ca5d243ca7 Added test from original issue. 2014-12-17 15:49:00 -08:00
Cyrus Najmabadi b37b98138d Merge branch 'master' into layering
Conflicts:
	src/compiler/checker.ts
	src/compiler/utilities.ts
2014-12-17 15:35:30 -08:00
Daniel Rosenwasser b3ccb562fb Added test for goToDef on union types. 2014-12-17 15:11:43 -08:00
Daniel Rosenwasser 42babc52d3 Use 'definitionCountIs' in union property tests. 2014-12-17 15:11:40 -08:00
Daniel Rosenwasser 6c753496e7 Rename file. 2014-12-17 15:11:38 -08:00
Daniel Rosenwasser 7a1be3cc04 Added test using code from original issue. 2014-12-17 15:11:35 -08:00
Daniel Rosenwasser ec64c0f929 Fixed 'verifyDefinitionsName' to check the container name properly. 2014-12-17 15:11:33 -08:00
Daniel Rosenwasser af4d7d3ff4 Added goToDef count verification in fourslash facilities. 2014-12-17 15:11:31 -08:00
Daniel Rosenwasser eaaf7ad468 Normalize a few fourslash line endings. 2014-12-17 15:11:29 -08:00
Daniel Rosenwasser 90a32ad2b0 Fixed messed-up formatting from moving around code. 2014-12-17 15:11:26 -08:00
Daniel Rosenwasser 017486b119 Made 'location' non-optional in 'getSymbolKind'. 2014-12-17 15:11:22 -08:00
Daniel Rosenwasser b37221142c Moved helpers to bottom of 'getDefinitionAtPosition'. 2014-12-17 15:11:18 -08:00
Jason Freeman ae0caed8f7 Merge pull request #1473 from Microsoft/parsePrimaryExpression
Switch order of switch cases in parsePrimaryExpression
2014-12-17 14:50:16 -08:00
Jason Freeman de062aec67 Merge pull request #1515 from Microsoft/moduleSharesNameWithImportInside
Fix issue #1503 with modules and imports sharing a name
2014-12-17 14:49:08 -08:00
Jason Freeman 29dfa3d6c0 Add module emit test 2014-12-17 14:33:32 -08:00
CyrusNajmabadi 51e5abe3f0 Merge pull request #1434 from Microsoft/sourceFileUpdate
Add support for incremental parsing.
2014-12-17 13:44:16 -08:00
Cyrus Najmabadi 6a08c54f42 Merge branch 'master' into sourceFileUpdate
Conflicts:
	src/compiler/checker.ts
	src/compiler/diagnosticInformationMap.generated.ts
	src/compiler/diagnosticMessages.json
	src/harness/fourslash.ts
2014-12-17 13:22:04 -08:00
Anders Hejlsberg 3eb8fb7093 Merge pull request #1463 from Microsoft/spreadAndRest
ECMAScript 6 spread and rest support
2014-12-17 13:01:03 -08:00
Cyrus Najmabadi 4545549e07 Disable incremental by default before merging into master. 2014-12-17 12:41:08 -08:00
Cyrus Najmabadi 5516c07e11 Merge branch 'master' into sourceFileUpdate 2014-12-17 12:37:21 -08:00
Cyrus Najmabadi 8048163714 CR feedback. 2014-12-17 12:36:53 -08:00
Anders Hejlsberg a667959b1f Accepting new baselines 2014-12-17 11:50:03 -08:00
Anders Hejlsberg 766756b4b1 Merge branch 'master' into spreadAndRest
Conflicts:
	src/compiler/parser.ts
2014-12-17 11:49:45 -08:00
CyrusNajmabadi a40a5a8571 Merge pull request #1521 from Microsoft/diagnostics
Remove 'grammarDiagnostics' from SourceFile.
2014-12-16 23:50:08 -08:00
Cyrus Najmabadi 3decdb19de Merge branch 'master' into layering 2014-12-16 23:48:58 -08:00
Cyrus Najmabadi f459951431 Merge branch 'diagnostics' into sourceFileUpdate
Conflicts:
	src/compiler/parser.ts
2014-12-16 23:48:00 -08:00
CyrusNajmabadi 63eca44e17 Merge pull request #1522 from Microsoft/LKG2
Update LKG.
2014-12-16 23:44:26 -08:00
Mohamed Hegazy 54d1d952e1 Update LKG 2014-12-16 23:42:59 -08:00
Cyrus Najmabadi 291b468262 Update LKG. 2014-12-16 23:22:46 -08:00
Cyrus Najmabadi 5df0ca529e Merge branch 'master' into layering
Conflicts:
	src/compiler/checker.ts
	src/compiler/parser.ts
2014-12-16 23:15:57 -08:00
Cyrus Najmabadi 2748a5b163 Remove 'grammarDiagnostics' from SourceFile. 2014-12-16 23:00:14 -08:00
Mohamed Hegazy c5b702d066 Update LKG 2014-12-16 21:51:10 -08:00
Cyrus Najmabadi cd308e78ba Merge branch 'master' into sourceFileUpdate
Conflicts:
	src/compiler/checker.ts
	src/compiler/diagnosticInformationMap.generated.ts
	src/compiler/parser.ts
	tests/baselines/reference/FunctionDeclaration5_es6.errors.txt
	tests/baselines/reference/VariableDeclaration2_es6.errors.txt
	tests/baselines/reference/VariableDeclaration4_es6.errors.txt
	tests/baselines/reference/anonymousModules.errors.txt
	tests/baselines/reference/callSignaturesWithParameterInitializers2.errors.txt
	tests/baselines/reference/conflictMarkerTrivia1.errors.txt
	tests/baselines/reference/dottedModuleName.errors.txt
	tests/baselines/reference/innerModExport1.errors.txt
	tests/baselines/reference/innerModExport2.errors.txt
	tests/baselines/reference/parserAccessors10.errors.txt
	tests/baselines/reference/parserComputedPropertyName5.errors.txt
	tests/baselines/reference/parserErrantEqualsGreaterThanAfterFunction1.errors.txt
	tests/baselines/reference/parserErrantEqualsGreaterThanAfterFunction2.errors.txt
	tests/baselines/reference/parserModifierOnStatementInBlock2.errors.txt
	tests/baselines/reference/parserSkippedTokens16.errors.txt
	tests/baselines/reference/privateIndexer2.errors.txt
2014-12-16 21:50:10 -08:00
CyrusNajmabadi 1776734e66 Merge pull request #1423 from Microsoft/refactorGrammarCheck
Move grammar checking code into the type checker.
2014-12-16 20:59:55 -08:00
Arnavion 880e5c50d7 Don't allow -noEmit with -declaration 2014-12-16 20:25:20 -08:00