예제 #1
0
 internal void HandleUndeclaredVariable(string name, IndexSpan span, LocationResolver indexResolver)
 {
     if (!HasAlreadySeenErrorFor(name))
     {
         HandleError(JSError.UndeclaredVariable, span, indexResolver);
     }
 }
예제 #2
0
 public EncodedSpan CombineWith(LocationResolver resolver, EncodedSpan otherSpan)
 {
     return(new EncodedSpan(
                resolver,
                GetSpan(resolver).CombineWith(otherSpan.GetSpan(resolver))
                ));
 }
예제 #3
0
 internal JScriptException(JSError errorNumber, IndexSpan span, LocationResolver resolver) {
     m_valueObject = null;
     _span = span;
     _resolver = resolver;
     m_errorCode = errorNumber;
     SetHResult();
 }
예제 #4
0
 public EncodedSpan(LocationResolver resolver, int start, int length)
 {
     if (start < (1 << _offsetBits) && length < (1 << _lengthBits))
     {
         Span = start | (length << _offsetBits);
     }
     else
     {
         Span = resolver.AddSpan(start, length);
     }
 }
        private ResolutionVisitor(ActivationObject rootScope, LocationResolver indexResolver, ErrorSink errorSink) {
            // create the lexical and variable scope stacks and push the root scope onto them
            m_lexicalStack = new Stack<ActivationObject>();
            m_lexicalStack.Push(rootScope);

            m_variableStack = new Stack<ActivationObject>();
            m_variableStack.Push(rootScope);

            _locationResolver = indexResolver;
            _errorSink = errorSink;
        }
예제 #6
0
        public IndexSpan GetSpan(LocationResolver resolver)
        {
            if ((Span & 0x80000000) == 0)
            {
                return(new IndexSpan(
                           Span & ((1 << _offsetBits) - 1),
                           (Span >> _offsetBits) & ((1 << _lengthBits) - 1)
                           ));
            }

            return(resolver._spans[(int)(Span & ~(0x80000000))]);
        }
예제 #7
0
        private ResolutionVisitor(ActivationObject rootScope, LocationResolver indexResolver, ErrorSink errorSink)
        {
            // create the lexical and variable scope stacks and push the root scope onto them
            m_lexicalStack = new Stack <ActivationObject>();
            m_lexicalStack.Push(rootScope);

            m_variableStack = new Stack <ActivationObject>();
            m_variableStack.Push(rootScope);

            _locationResolver = indexResolver;
            _errorSink        = errorSink;
        }
예제 #8
0
        internal void HandleError(JSError errorId, IndexSpan span, LocationResolver resolver, bool forceToError = false) {
            var error = new JScriptException(errorId, span, resolver);

            if (forceToError) {
                error.IsError = true;
            } else {
                error.IsError = error.Severity < 2;
            }

            if (!OnCompilerError(error)) {

            }
        }
예제 #9
0
        internal void HandleError(JSError errorId, IndexSpan span, LocationResolver resolver, bool forceToError = false)
        {
            var error = new JScriptException(errorId, span, resolver);

            if (forceToError)
            {
                error.IsError = true;
            }
            else
            {
                error.IsError = error.Severity < 2;
            }

            if (!OnCompilerError(error))
            {
            }
        }
예제 #10
0
        public static void Apply(Node node, ActivationObject scope, LocationResolver indexResolver, ErrorSink errorSink)
        {
            if (node != null && scope != null)
            {
                // create the visitor and run it. This will create all the child
                // scopes and populate all the scopes with the var-decl, lex-decl,
                // and lookup references within them.
                var visitor = new ResolutionVisitor(scope, indexResolver, errorSink);
                node.Walk(visitor);

                // now that all the scopes are created and they all know what decls
                // they contains, create all the fields
                visitor.CreateFields(scope);

                // now that all the fields have been created in all the scopes,
                // let's go through and resolve all the references
                visitor.ResolveLookups(scope);

                // now that everything is declared and resolved as per the language specs,
                // we need to go back and add ghosted fields for older versions of IE that
                // incorrectly implement catch-variables and named function expressions.
                visitor.AddGhostedFields(scope);
            }
        }
        public static void Apply(Node node, ActivationObject scope, LocationResolver indexResolver, ErrorSink errorSink)
        {
            if (node != null && scope != null)
            {
                // create the visitor and run it. This will create all the child
                // scopes and populate all the scopes with the var-decl, lex-decl,
                // and lookup references within them.
                var visitor = new ResolutionVisitor(scope, indexResolver, errorSink);
                node.Walk(visitor);

                // now that all the scopes are created and they all know what decls
                // they contains, create all the fields
                visitor.CreateFields(scope);

                // now that all the fields have been created in all the scopes,
                // let's go through and resolve all the references
                visitor.ResolveLookups(scope);

                // now that everything is declared and resolved as per the language specs,
                // we need to go back and add ghosted fields for older versions of IE that
                // incorrectly implement catch-variables and named function expressions.
                visitor.AddGhostedFields(scope);
            }
        }
예제 #12
0
 public int GetStartIndex(LocationResolver resolver)
 {
     return(GetSpan(resolver).Start);
 }
예제 #13
0
 internal JsAst(EncodedSpan span, LocationResolver indexResolver)
     : base(span) {
     _locationResolver = indexResolver;
 }
예제 #14
0
 public IndexSpan GetSpan(LocationResolver parent)
 {
     return(EncodedSpan.GetSpan(parent));
 }
예제 #15
0
 public EncodedSpan(LocationResolver resolver, IndexSpan span)
     : this(resolver, span.Start, span.Length)
 {
 }
예제 #16
0
 public int GetStartIndex(LocationResolver parent)
 {
     return(GetSpan(parent).Start);
 }
예제 #17
0
 public int GetEndIndex(LocationResolver resolver)
 {
     return(GetSpan(resolver).End);
 }
예제 #18
0
 public IndexSpan GetNameSpan(LocationResolver resolver)
 {
     return(NameSpan);
 }
예제 #19
0
 public int GetEndIndex(LocationResolver parent)
 {
     return(GetSpan(parent).End);
 }
예제 #20
0
 internal void HandleUndeclaredVariable(string name, IndexSpan span, LocationResolver indexResolver) {
     if (!HasAlreadySeenErrorFor(name)) {
         HandleError(JSError.UndeclaredVariable, span, indexResolver);
     }
 }
예제 #21
0
파일: JsAst.cs 프로젝트: Weflac/nodejstools
 internal JsAst(EncodedSpan span, LocationResolver indexResolver)
     : base(span)
 {
     _locationResolver = indexResolver;
 }
예제 #22
0
 internal SourceLocation GetStart(LocationResolver jsAst)
 {
     return(jsAst.IndexToLocation(GetSpan(jsAst).Start));
 }
예제 #23
0
 internal SourceLocation GetEnd(LocationResolver jsAst)
 {
     return(jsAst.IndexToLocation(GetSpan(jsAst).End));
 }
 public IndexSpan GetNameSpan(LocationResolver locationResolver) {
     return NameSpan;
 }
예제 #25
0
 public IndexSpan GetNameSpan(LocationResolver locationResolver)
 {
     return(GetSpan(locationResolver));
 }